-
Notifications
You must be signed in to change notification settings - Fork 836
refactor(storage): refactor compact #10506
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
related issue #10520 |
|
Conflicting files |
snapshot before snapshot after the order of blocks is not the same, after segment compaction: is this expected? |
Yes, this result is as expected. |
OK. let me summarize a memo about the "order" of blocks, @zhyass pls correct me if things are not described correctly: before this PR, given a snapshot, if the blocks are traversed in the following way (one of the ways), before and after segment compactions, the same order of blocks could be observed (note that segment compaction does not merge blocks): after this PR, given a snapshot, the same order of block metas can also be observed (before and after segment compactions) if they are traversed in the following way (one of the ways):
during block compaction, the segments are traversed from the last (ordered by their positions in and the block of each segment is traversed from the first to the last (ordered by their positions in |
@zhyass pls have a look at the above memo, if this memo looks good to you, I'd like to put it into the summary of this PR |
I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/
Summary
refactor compact block:
CompactSource: the compact tasks, will compact and generate a new block.CompactAggregator: gather the new blocks, generate and write the new segments.Add status for compact segment and compact block.
Read segments in batch to avoid oom.
Memo (draft)
memo about the "order" of blocks, @zhyass pls correct me if things are not described correctly:
before this PR, given a snapshot, if the blocks are traversed in the following way (one of the ways), before and after segment compactions, the same order of blocks could be observed
(note that segment compaction does not merge blocks):
after this PR, given a snapshot, the same order of block metas can also be observed (before and after segment compactions) if they are traversed in the following way (one of the ways):
during block compaction, the segments are traversed from the last (ordered by their positions in
TableSnapshot.segments : Vec<_>, to the first.and the block of each segment is traversed from the first to the last (ordered by their positions in
SegmentInfo.blocks : Vec<_>.Closes #10520