-
Notifications
You must be signed in to change notification settings - Fork 109
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
core: Replay database prefix #527
Conversation
5adb3bd
to
8416436
Compare
); | ||
let total_segments = message_log.total_segments(); | ||
|
||
'replay: for (segment_offset, segment) in message_log.segments().enumerate() { |
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.
Note that I intend to reduce the rightward drift here and move the replay logic elsewhere.
I left it here for this patch to preserve the side-by-side diff for review.
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.
lgtm pending Joshua's feedback.
dc307d5
to
6438675
Compare
If a commit cannot be decoded from the log, stop replaying and truncate the log to the known-good prefix.
When rotating a segment, the max_offset got incremented, leading to a gap of one between the segment's min offset and the offset of the first commit (when viewed as a commit log). This means that offset calculations for truncation or suffix iterators were off by one.
0ecc5cc
to
fa0d2e5
Compare
Description of Changes
When replaying the log, stop if a commit is encountered which cannot be decoded. As this implies a corrupted log, truncate the log to the known-good prefix.
Depends on #526
API and ABI
If the API is breaking, please state below what will break
Expected complexity level and risk
3 -- the risk of truncating the commit log wrongly is data loss.