Skip to content
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

wal: correctly set nextTx on Truncate #866

Merged
merged 1 commit into from
May 20, 2024
Merged

wal: correctly set nextTx on Truncate #866

merged 1 commit into from
May 20, 2024

Conversation

asubiotto
Copy link
Member

On Truncate(k), if k was logged to the WAL the behavior is unchanged. However, if k had not yet been logged to the WAL, the WAL performed a full reset of the WAL and set the next expected txn to k+1. This is incorrect, since the semantics of truncate are that k becomes the first entry in the WAL after truncation.

@asubiotto asubiotto requested a review from thorfour May 17, 2024 11:43
@asubiotto
Copy link
Member Author

This was found by DST and fixes a data loss bug (previously k would've been incorrectly dropped after a snapshot)

Copy link
Member

@metalmatze metalmatze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting and good find!

On Truncate(k), if k was logged to the WAL the behavior is unchanged. However,
if k had not yet been logged to the WAL, the WAL performed a full reset of the
WAL and set the next expected txn to k+1. This is incorrect, since the
semantics of truncate are that k becomes the first entry in the WAL after
truncation.
@asubiotto asubiotto merged commit 13880aa into main May 20, 2024
7 checks passed
@asubiotto asubiotto deleted the alfonso-truncate branch May 20, 2024 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants