forked from hashicorp/raft
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce MonotonicLogStore interface
This commit introduces an interface which acts as a handler for a leaky abstraction in the structure of underlying log stores. In order to properly handle post-snapshot-restore cleanup for log stores generically, we need some awareness of whether the underlying store permits gaps. Boltdb allows for gaps in log store indices, but to handle them it requires a freelist, which is written on every commit. This is costly, particularly when the freelist is large. By completely resetting the LogStore after snapshot, we grow the size of the freelist, which would result in performance degradation. The MonotonicLogStore interface is implemented by LogStores with guarantees of sequential/monotonic indices, like raft-wal, but reverts to the old behavior for boltdb. This also requires special handling within LogStore wrappers (like LogCache), to ensure that the type assertion is passed to the underlying store.
- Loading branch information
Showing
4 changed files
with
100 additions
and
1 deletion.
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