Open
Conversation
- Extends `commit::Metadata` to include the checksum
- Extends `segment::Metadata` to include `Some(commit::Metadata)`
containing the last commit in the segment (if there is one)
- Changes `committed_meta` to:
- ignore empty segments at the end of the log
- try harder to provide useful metadata, even if only a prefix of the
latest segment is readable
This is allows to eliminate remaining `Commitlog::open` calls with the
purpose of querying the latest commit (offset). `Commitlog::open`
creates an empty segment if the tail of the log is corrupt, which is a
non-obvious side-effect that can be confusing when debugging.
It also allows to eliminate uses where the `commits_from` iterator is
used to find the latest full commit. The `Commits` iterator requires the
caller to handle the case of a corrupted commit at the end of the log,
by advancing the iterator once more after it has yielded an error in
order to check that it is exhausted, and then deciding whether to ignore
the error. This is easy to forget.
`committed_meta` now just does the right thing, preserving information
about tail corruption for when that's useful.
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.
commit::Metadatato include the checksumsegment::Metadatato includeSome(commit::Metadata)containing the last commit in the segment (if there is one)
committed_metato:latest segment is readable
This is allows to eliminate remaining
Commitlog::opencalls with thepurpose of querying the latest commit (offset).
Commitlog::opencreates an empty segment if the tail of the log is corrupt, which is a
non-obvious side-effect that can be confusing when debugging.
It also allows to eliminate uses where the
commits_fromiterator isused to find the latest full commit. The
Commitsiterator requires thecaller to handle the case of a corrupted commit at the end of the log,
by advancing the iterator once more after it has yielded an error in
order to check that it is exhausted, and then deciding whether to ignore
the error. This is easy to forget.
committed_metanow just does the right thing, preserving informationabout tail corruption for when that's useful.