Repository navigation
feat: number writes with store revisions - #272
Merged
Merged
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Every write that changes the keyspace now gets a revision, so callers can tell which write produced the state they see. Data directories move to format 2. Format 1 directories are upgraded in place.
Type of Change
Changes
Store.RevisionandStore.WriteRevisionreport the store's revision. A transaction is one revision however many keys it touches; a transaction that changes nothing does not advance it.EntrygainsCreateRevisionandModRevision. Recreating a deleted or expired key counts as a new creation.set,del, andflush, and a newrevrecord heads every snapshot and log rewrite, so a store reopens at the revision it stopped at rather than one past whatever survived compaction. Records without revisions (format 1) load at revision 1.ApplyReplicatedtakes that index and ignores the leader's speculative revisions;ReplaceWithrestores the snapshot's revision, including zero for an empty snapshot.SetReplicatorand the FSM now return the committed revision.internal/datadir: format version 2, which also reads format 1 and restamps it.Changelog
changie newfragment added — one sentence, two at most, 280 characters maxTesting
go test ./...passesNew tests in
pkg/kvs/revision_test.gocover revision counting, restart persistence, legacy logs, replicated revisions, and snapshot restore (including an empty snapshot).internal/clusterandinternal/datadirtests cover the Raft-index revision and the format 1 to 2 upgrade.Related Issues
None