Repository navigation
Conversation
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.
Hi team, I found the following SQL seems to suffer storage leak (already added into regression test)
which gets error message
In this test, I tried to craft a testing scenario where,
In the normal code path, where there's no concurrent checkpoint and optimistic writes
But when there're concurrent checkpoint and optimistic write,
.wal.checkpoint)Because WAL recording is definitely needed, the easiest fix, is to record these blocks as free blocks in header.
Note
High Risk
Changes WAL/block-manager lifecycle during concurrent checkpoints and optimistic commit revert paths, which are correctness-critical for persistence and can cause leaks or corruption if wrong.
Overview
Fixes a storage block leak when optimistic writes commit into the checkpoint WAL during an in-flight concurrent checkpoint.
Checkpoint WAL row-group blocks are no longer marked checkpointed at
WriteRowGroupDatatime. They are tracked inpending_checkpoint_blocksuntilWALFinishCheckpointcallsMarkPendingBlocksAsCheckpointedafter the checkpoint header is written, so the header’s free/in-use state matches what the replayed WAL will reference. Reverted optimistic commits remove their blocks from that pending set viaRemovePendingCheckpointBlocksinRevertCommit.Adds two slow regression tests: concurrent checkpoint + successful optimistic insert (detach/reattach +
debug_verify_blocks), and the same race with a forced commit failure followed by a successful insert.Reviewed by Cursor Bugbot for commit 85b53de. Bugbot is set up for automated code reviews on this repo. Configure here.