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
doc: add textual description of the raft.Apply process #511
Merged
huikang
merged 5 commits into
hashicorp:main
from
huikang:doc-textual-description-apply
Jul 14, 2022
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
22cdaea
doc: add textual description of the raft.Apply process
huikang 9fbb51e
Apply suggestions from code review
huikang bcc971a
explanation of committed and applied command, and return to the client
huikang b86d3df
Add more details of how follower updates its commitIndex
huikang def80ed
Update docs/apply.md
huikang File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I am not exactly sure where in this flow but do you think it would be good to point out the stepping nature of the processLogs within the append entries RPC.
One RPC will contain new logs entries but the LeaderCommitIndex will lag behind those log indexes. For example the following flow is likely
AppenEntries(Log: 1..5, LeaderCommitIndex: 0)
AppendEntries(Log: 6..8, LeaderCommitIndex: 4)
AppendEntries(Log: 9, LeaderCommitIndex: 8)
AppendEntries(Log: , LeaderCommitIndex: 9)
Sometimes append entries rpcs wont contain new logs but only be bumping the commit index. Only if a server is far enough behind the majority of all servers will it ever see logs with a leader commit index which is greater or equal to the logs index within the rpc.
This subtlety is important because when the first AppendEntries RPC from my example above returns, the follower will not have queued up any applies to the FSM.
Due to this behavior its possible that a very small window of time exists when all followers have committed the log to disk, the write has been realized in the FSM of the leader but the followers have not yet applied the log to their FSM.
Paul's replies in this issue are relevant: #508
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.
@mkeeler , thanks for your suggestions. Totally agreed that it is worth to point out the details. Will send a new commit to update.
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.
Hi, @mkeeler , could you please take another look at the updated PR when you have a chance? Thanks.