This repository has been archived by the owner on Mar 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This solves a bug that came up during jepsen tests, it occurs when: - a server is killed ungracefully (leading to a written open segment in the directory when the system restarts) - a snapshot file exists - no closed segments exist Because open segments are not closed before writing a snapshot, raft, when starting up and reading the files in the data directory, erroneously assumes that all the entries in the open segment are newer than the entries in the snapshot, while in reality the entries are already contained in the snapshot, leading to a wrong state. Closing the current open segments before writing the snapshot ensures that no old entries can mistakenly be identified as new entries, all entries in the open segments will be newer than the snapshot. To close the open segments before making a snapshot, we perform a `barrier` request, but we need to make a distinction between a 'blocking' and a 'non-blocking' barrier in order to save performance. Both barriers close all current open segments before firing the barrier callback, but a 'non-blocking' barrier allows writes to go through to newly created open-segments. This non-blocking barrier is used when raft is creating a snapshot during regular operation, the blocking barrier is used when installing snapshots and truncating the log.
- Loading branch information
Mathieu Borderé
committed
Feb 11, 2022
1 parent
88c3c89
commit 424de42
Showing
6 changed files
with
119 additions
and
28 deletions.
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
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
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