-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[core] Fix snapshot lookup for duplicate commit timestamps #9437
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -382,8 +382,8 @@ public long repairEarliestSnapshot(long snapshotId) { | |
| earliest = mid + 1; // Search in the right half | ||
| finalSnapshot = snapshot; | ||
| } else { | ||
| finalSnapshot = snapshot; // Found the exact match | ||
| break; | ||
| finalSnapshot = snapshot; | ||
| earliest = mid + 1; | ||
| } | ||
| } | ||
| return finalSnapshot; | ||
|
|
@@ -415,8 +415,8 @@ public long repairEarliestSnapshot(long snapshotId) { | |
| } else if (commitTime < timestampMills) { | ||
| earliest = mid + 1; // Search in the right half | ||
| } else { | ||
| finalSnapshot = snapshot; // Found the exact match | ||
| break; | ||
| finalSnapshot = snapshot; | ||
| latest = mid - 1; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] Refresh the lower bound before searching past an exact match
Please obtain the lower bound through |
||
| } | ||
| } | ||
| return finalSnapshot; | ||
|
|
||
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.
[P2] Refresh the upper bound before searching past an exact match
latestis only an ID captured before the search. A concurrent rollback can update the latest hint and delete that snapshot afterlatestSnapshotId()returns. With snapshots 0/1/2 sharing this timestamp, if rollback removes snapshot 2 after we capture it, the first probe hits snapshot 1; this new continuation then probes snapshot 2 and throwsSnapshot file ... does not exist, although snapshot 1 is still the correct answer. The oldbreakreturned snapshot 1.Please resolve the upper boundary through the existing live-snapshot path (for example,
latestSnapshot()plus an early boundary return) and add a rollback-race regression test.