-
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3336 +/- ##
==========================================
- Coverage 85.31% 85.25% -0.07%
==========================================
Files 1289 1279 -10
Lines 120073 119010 -1063
==========================================
- Hits 102442 101459 -983
+ Misses 17631 17551 -80
Continue to review full report at Codecov.
|
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.
LGTM
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 comment
The 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
enum class Status { | |
STARTING = 0, // The part is starting, not ready for service | |
RUNNING, // The part is running | |
STOPPED, // The part has been stopped | |
WAITING_SNAPSHOT // Waiting for the snapshot. | |
}; | |
enum class Role { | |
LEADER = 1, // the leader | |
FOLLOWER, // following a leader | |
CANDIDATE, // Has sent AskForVote request | |
LEARNER // It is the same with FOLLOWER, | |
// except it does not participate in leader election | |
}; |
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.
@yixinglu updated, PTAL
src/interface/raftex.thrift
Outdated
CANDIDATE = 3; // Has sent AskForVote request | ||
LEARNER = 4; // same with FOLLOWER, except that it does | ||
// not vote in leader election | ||
} |
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
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.
Others LGTM
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.
LGTM
What type of PR is this?
What does this PR do?
This PR add an readonly raft rpc
getState()
to query raft info like: leadership, running status, current term and etc. We expect this rpc to help us find the correct leader as soon as possible when leader change happends during our test, it's a replacement for meta api which has high latency and sometime return incorrect leader information.