-
Notifications
You must be signed in to change notification settings - Fork 246
Sigterm propose vote #7514
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
Sigterm propose vote #7514
Conversation
I don't think we can ever guarantee that, this is a best effort behaviour. Once we disintermediate sending (i.e. remove the ringbuffer), we can try to prioritise this (and other consensus traffic) higher than the rest, but that's still best effort, not a guarantee. |
To be specific we could go further than this PR to do this during every shutdown of the enclave, where we delay shutdown until the relevant message is sent. But yes especially with the ringbuffer this is difficult to do, and more difficult to get any actual guarantees about it. |
|
@cjen1-msft do you mean every shutdown while we are primary? |
@achamayou Yep. So every shutdown of a primary should nominate a successor (not just those where we have ignore_first_sigterm set), and the key constraint would be waiting long enough for the message to be sent before we shutdown. |
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.
Pull request overview
This PR adds support for proposing a successor vote when a leader receives a SIGTERM signal, bringing CCF closer to parity with etcd's proposeRequestVotes behavior. This reduces downtime when a leader must be suddenly retired by allowing it to nominate the most up-to-date node as a successor rather than waiting for an election timeout.
Key changes:
- Refactored successor nomination logic into a reusable
send_propose_request_vote()method - Added
nominate_successor()interface method that is called on SIGTERM viastop_notice() - Extended TLA+ specification with
SigTermProposeVoteaction for formal verification
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
tla/consensus/ccfraft.tla |
Added SigTermProposeVote action to model leader proposing successor on termination |
tla/consensus/Traceccfraft.tla |
Added trace validation for the new step_down_and_nominate_successor event |
tla/consensus/SIMccfraft.tla |
Added simulation support for SigTermProposeVote |
tla/consensus/SIMccfraft.cfg |
Configured simulation to use SIMSigTermProposeVote |
src/node/node_state.h |
Added call to nominate_successor() in stop_notice() handler |
src/kv/kv_types.h |
Added virtual nominate_successor() method to consensus interface |
src/consensus/aft/raft.h |
Refactored successor nomination logic into send_propose_request_vote() and implemented nominate_successor() |
src/consensus/aft/test/driver.h |
Added nominate_successor command support for test scenarios |
src/consensus/aft/test/driver.cpp |
Implemented parsing for nominate_successor command |
tests/raft_scenarios/nominate_successor |
New test scenario validating successor selection based on match_idx |
tests/raft_scenarios_runner.py |
Modified command tracking to persist across entries for proper trace validation |
tests/e2e_operations.py |
Added E2E test verifying propose_request_vote behavior on SIGTERM |
doc/architecture/consensus/index.rst |
Documented the new ProposeRequestVote behavior on termination signal |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This is true, and in this case we think it is beneficial to make this change, but it's worth clarifying that parity with etcd behaviour is not generally a goal. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Amaury Chamayou <amaury@xargs.fr>
Closes #7402
This brings us closer to parity with what etcd does with proposeRequestVotes, which helps to reduce downtime when hosts are killed.
The idea is that when we receive a sigterm when
ignore_first_sigtermis enabled, if we're the leader, we should to nominate a successor rather than waiting for an election timeout.This can also prevent repeated elections, as the nominated successor will have the highest MatchIndex, and hence likely be a valid candidate before any other valid candidates have had their election timeout trigger.
One limitation of the current implementation is that the ProposeRequestVote message is not guaranteed to send before the process terminates. I'm not quite sure what the best approach would be for this.