-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add rpc to query raft status #3336
Changes from 2 commits
c2f3d91
da5d406
eb45dbf
e6395d9
ae6adbd
b4d5754
d0a0df4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -7,6 +7,21 @@ namespace cpp nebula.raftex | |||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
include "common.thrift" | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
enum Role { | ||||||||||||||||||||||||||||||
LEADER = 1, // the leader | ||||||||||||||||||||||||||||||
FOLLOWER = 2; // following a leader | ||||||||||||||||||||||||||||||
CANDIDATE = 3; // Has sent AskForVote request | ||||||||||||||||||||||||||||||
LEARNER = 4; // It is the same with FOLLOWER, | ||||||||||||||||||||||||||||||
// except it does not participate in leader election | ||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
enum Status { | ||||||||||||||||||||||||||||||
STARTING = 0; // The part is starting, not ready for service | ||||||||||||||||||||||||||||||
RUNNING = 1; // The part is running | ||||||||||||||||||||||||||||||
STOPPED = 2; // The part has been stopped | ||||||||||||||||||||||||||||||
WAITING_SNAPSHOT = 3; // Waiting for the snapshot. | ||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These enum types have been defined in following source file, could you unify the usage of these enum types? nebula/src/kvstore/raftex/RaftPart.h Lines 239 to 252 in b7c6901
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yixinglu updated, PTAL |
||||||||||||||||||||||||||||||
enum ErrorCode { | ||||||||||||||||||||||||||||||
SUCCEEDED = 0; | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
|
@@ -154,9 +169,26 @@ struct SendSnapshotResponse { | |||||||||||||||||||||||||||||
1: ErrorCode error_code; | ||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
struct GetStateRequest { | ||||||||||||||||||||||||||||||
1: GraphSpaceID space; // Graphspace ID | ||||||||||||||||||||||||||||||
2: PartitionID part; // Partition ID | ||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
struct GetStateResponse { | ||||||||||||||||||||||||||||||
1: ErrorCode error_code; | ||||||||||||||||||||||||||||||
2: Role role; | ||||||||||||||||||||||||||||||
3: TermID term; | ||||||||||||||||||||||||||||||
4: bool is_leader; | ||||||||||||||||||||||||||||||
5: LogID committed_log_id; | ||||||||||||||||||||||||||||||
6: LogID last_log_id; | ||||||||||||||||||||||||||||||
7: TermID last_log_term; | ||||||||||||||||||||||||||||||
8: Status status; | ||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
service RaftexService { | ||||||||||||||||||||||||||||||
AskForVoteResponse askForVote(1: AskForVoteRequest req); | ||||||||||||||||||||||||||||||
AppendLogResponse appendLog(1: AppendLogRequest req); | ||||||||||||||||||||||||||||||
SendSnapshotResponse sendSnapshot(1: SendSnapshotRequest req); | ||||||||||||||||||||||||||||||
HeartbeatResponse heartbeat(1: HeartbeatRequest req) (thread = 'eb'); | ||||||||||||||||||||||||||||||
GetStateResponse getState(1: GetStateRequest req); | ||||||||||||||||||||||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could add a
(cpp.enum_strict)
here and below