Fix lurking bug in datastore bucket sorting routines #3281
Merged
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 A demonstrates the bug, commit B fixes it and passes the test.
Our public API exposes a well-defined order when logging from a single-thread, and that order is encoded into our
RowId
s.As such it is expected that:
RowId
(however it got there) toggles the dirty bit.This shouldn't be possible with the current clients since we do not yet have reordering retries (as far as I remember), but it'll be coming at some point and we can't trust the clients anyhow.
RowId
must be used as tie-breaker when sorting the buckets.We use a stable sort so this shouldn't be an issue as of today, but this is a nasty bug waiting to happen nonetheless.
What
Checklist