Skip to content

compaction: add a new option 'check_range_overlap_on_bottom_level' for manual compact#421

Merged
ti-chi-bot[bot] merged 7 commits intotikv:8.10.tikvfrom
glorv:manual-compact-bottom-check
Nov 18, 2025
Merged

compaction: add a new option 'check_range_overlap_on_bottom_level' for manual compact#421
ti-chi-bot[bot] merged 7 commits intotikv:8.10.tikvfrom
glorv:manual-compact-bottom-check

Conversation

@glorv
Copy link

@glorv glorv commented Aug 19, 2025

  • The new option bottom_level_check_range_overlap is used for manual compact to ensure the SST file in the bottom level with a huge range can be force partitioned with manual compaction.
  • Also add a few log for the SST ingest level selection to make it easier to investigate unexpected SST ingestion level.

@ti-chi-bot ti-chi-bot bot added dco-signoff: yes Indicates the PR's author has signed the dco. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 19, 2025
}
}
if (!check_overlap_within_file) {
if (!check_overlap_within_file ||
Copy link
Member

Choose a reason for hiding this comment

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

Why !check_overlap_within_file is not sufficient?

if (!partitioner->CanDoTrivialMove(*begin, *end)) {
check_overlap_within_file = false;
}

Seems that if there are partitioner boundaries within the target range, it will trigger a compaction, not trivial move (by setting overlap to the current level)

Copy link
Author

Choose a reason for hiding this comment

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

Yes, you are right, it's better to just change the CanDoTrivialMove implement in the SSTPartitioner. No need to add a new option.

Copy link
Member

Choose a reason for hiding this comment

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

But it seems CanDoTrivialMove can't tell whether we are at the bottommost level? It only sees the key range

Copy link
Author

Choose a reason for hiding this comment

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

Yes, but I think we should force partition/manual compact the overlapped SST files in all the level, not only the bottom level. This approach should gain better compatibility. So reuse CanDoTrivialMove is enough here.

@glorv
Copy link
Author

glorv commented Aug 20, 2025

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 20, 2025
}
if (!check_overlap_within_file) {
if (!check_overlap_within_file ||
(!overlap && options.bottom_level_check_range_overlap &&
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a comment to elaborate on why this can ensure the SST file in the bottom level with a huge range can be force partitioned with manual compaction.

Copy link
Author

Choose a reason for hiding this comment

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

done.

@glorv
Copy link
Author

glorv commented Nov 17, 2025

@v01dstar @Connor1996 PTAL again.
Originally, I decided to rely on CanDoTrivialMove in SSTPartitioner to handle this, but it turns on this can't fully resolve the problem. Because CanDoTrivialMove applies to all levels, so it's likely to trigger false-positive ManualCompact because the range overlaps with l0 ssts ranges but there is actually no data overlap.

@glorv
Copy link
Author

glorv commented Nov 18, 2025

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 18, 2025
Copy link

@hhwyt hhwyt left a comment

Choose a reason for hiding this comment

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

LGTM

// If set to true, it will check file range overlap instead of keys overlap
// for the bottom level. This is used in manual compact for SST ingestion
// scenario.
bool bottom_level_check_range_overlap = false;
Copy link

Choose a reason for hiding this comment

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

I suggest renaming it to check_range_overlap_on_bottom_level to match the existing naming style.

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Nov 18, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Nov 18, 2025

@hhwyt: Your lgtm message is repeated, so it is ignored.

Details

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 18, 2025
@glorv
Copy link
Author

glorv commented Nov 18, 2025

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 18, 2025
Signed-off-by: glorv <glorvs@163.com>
@ti-chi-bot ti-chi-bot bot removed the lgtm label Nov 18, 2025
@glorv glorv changed the title compaction: add a new option 'bottom_level_check_range_overlap' for manual compact compaction: add a new option 'check_range_overlap_at_bottom_level' for manual compact Nov 18, 2025
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Nov 18, 2025
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 18, 2025
@glorv
Copy link
Author

glorv commented Nov 18, 2025

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 18, 2025
Signed-off-by: glorv <glorvs@163.com>
@ti-chi-bot ti-chi-bot bot removed the lgtm label Nov 18, 2025
@glorv glorv changed the title compaction: add a new option 'check_range_overlap_at_bottom_level' for manual compact compaction: add a new option 'check_range_overlap_on_bottom_level' for manual compact Nov 18, 2025
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Nov 18, 2025
@glorv
Copy link
Author

glorv commented Nov 18, 2025

/retest

@glorv
Copy link
Author

glorv commented Nov 18, 2025

/run-test

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 18, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Nov 18, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-11-18 03:12:45.142904941 +0000 UTC m=+1363014.585934810: ☑️ agreed by hhwyt.
  • 2025-11-18 05:17:51.901306892 +0000 UTC m=+1370521.344336771: ☑️ agreed by hbisheng.
  • 2025-11-18 05:22:51.632543955 +0000 UTC m=+1370821.075573834: ✖️🔁 reset by glorv.
  • 2025-11-18 05:23:44.183958266 +0000 UTC m=+1370873.626988144: ☑️ agreed by hbisheng.
  • 2025-11-18 05:24:19.494582602 +0000 UTC m=+1370908.937612471: ☑️ agreed by hhwyt.
  • 2025-11-18 05:28:08.621903617 +0000 UTC m=+1371138.064933506: ✖️🔁 reset by glorv.
  • 2025-11-18 06:31:05.371275693 +0000 UTC m=+1374914.814305572: ☑️ agreed by v01dstar.
  • 2025-11-18 08:12:35.155982861 +0000 UTC m=+1381004.599012730: ☑️ agreed by hhwyt.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Nov 18, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hbisheng, hhwyt, v01dstar

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot merged commit b4ef4c1 into tikv:8.10.tikv Nov 18, 2025
5 checks passed
@glorv glorv deleted the manual-compact-bottom-check branch November 18, 2025 08:17
ti-chi-bot bot pushed a commit to tikv/tikv that referenced this pull request Nov 18, 2025
…e_partition_range` (#19121)

close #19106, close #19120

This PR include the new change in tikv/rocksdb#421 that introduce a new config `check_range_overlap_on_bottom_level`. By set this config to true, the manual compaction while use range overlap instead of key overlap on the bottom level for selecting candidate SST files. This can ensure the manual compact can split large range SST files at the bottom level which blocks SST ingesting to the bottom level.

Signed-off-by: glorv <glorvs@163.com>
ti-chi-bot bot pushed a commit to tikv/tikv that referenced this pull request Nov 18, 2025
…e_partition_range` (#19121) (#19124)

close #19106, close #19120

This PR include the new change in tikv/rocksdb#421 that introduce a new config `check_range_overlap_on_bottom_level`. By set this config to true, the manual compaction while use range overlap instead of key overlap on the bottom level for selecting candidate SST files. This can ensure the manual compact can split large range SST files at the bottom level which blocks SST ingesting to the bottom level.

Signed-off-by: glorv <glorvs@163.com>

Co-authored-by: glorv <glorvs@163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved dco-signoff: yes Indicates the PR's author has signed the dco. lgtm size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants