Reduce disk I/O of time-based compaction#6169
Open
lava wants to merge 1 commit into
Open
Conversation
When the partition transformer (used by compaction) creates output partitions, it was copying the source partition's full min/max import time range onto every output partition synopsis. That makes the compacted partition's time range overlap the original input range, so time-based compaction rules consider it eligible for compaction again on the next run. Aggregate min/max import time from the slices that actually end up in each output partition instead, so the resulting partition's range reflects its actual contents.
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.
🔍 Problem
When a time-based compaction rule deletes part of a partition's data, the
output partition's synopsis should reflect the time range of the slices that
survived. Instead, the old code copied the input partition's full
min_import_time/max_import_timeonto the output synopsis.So an input partition spanning a wide time range that's been trimmed by
compaction kept advertising the original wide range. Time-based compaction
rules use that range to pick eligible partitions, so the same partition got
selected and rewritten again on every run, even though there was nothing
left to do.
🛠️ Solution
min/maximport time from the slices that actually end up ineach output partition with
std::min/std::max.partition_synopsissentinels (min_import_time = time::max(),max_import_time = time::min()) make the first slice seed the rangecorrectly.
💬 Review
- Side fix discovered while investigating TNZ-527; should not close that
- No new test — the existing transformer/compaction tests don't assert on
🎫 References TNZ-527ticket.
per-partition import-time ranges. Happy to add one if you want.