zhang-arvin opened a new pull request, #68836:
URL: https://github.com/apache/doris/pull/68836
### What problem does this PR solve?
Fixes #68807.
In `time_series` cumulative compaction,
`TimeSeriesCumulativeCompactionPolicy::pick_input_rowsets` selects the level-2
inputs with a loop that `continue`s past a level-1 rowset whose age is still
inside `MAX_LEVEL2_COMPACTION_TIMEOUT`, and keeps appending later, eligible
level-1 rowsets. That produces a **non-contiguous** selection.
`CompactionMixin::build_basic_info` builds the output version from the first
and last selected rowset:
```cpp
_output_version =
Version(_input_rowsets.front()->start_version(),
_input_rowsets.back()->end_version());
```
So a selection like `[2-30] + [101-120]` commits an output with version
`[2-120]` that claims to cover the `[31-100]` rowset that was never merged.
Replacing only the selected inputs then leaves two **active** rowsets whose
version ranges overlap. This matches the reported symptom (a level-2 output
spanning a wide interval that still holds active level-1 rowsets inside it, on
a single-replica tablet that then rejects Stream Load).
The candidate list is already made version-continuous by
`find_longest_consecutive_version` before `pick_input_rowsets` runs, so the gap
is introduced entirely by the `continue`.
### What changed
Stop the level-2 loop at the first not-yet-eligible level-1 rowset instead
of skipping over it. The selection is then always the contiguous prefix of
eligible rowsets, so the first/last-derived output version can never span an
unmerged rowset. No separate post-filter continuity check is needed to reject a
spanning output — the selection cannot form one.
### Tests
Added `pick_input_rowsets_level2_skips_recent_level1` to
`cumulative_compaction_time_series_policy_test.cpp`: level-1 rowsets `[2-30]`
(eligible) / `[31-100]` (fresh, ineligible) / `[101-120]` (eligible) with
Condition 4 able to fire. The test asserts the selected inputs are
version-continuous and that `[101-120]` is not selected past the skipped
rowset. Without the fix the selection is `[0-1], [2-30], [101-120]`
(non-contiguous, output `[0-120]`); with the fix no spanning selection is
produced.
`build-support/check-format.sh` passes (clang-format 16).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]