Skip to content

[hotfix-to-7.5.6] raftstore: directly write kvs rather than ingestion when merging small regions. (#17408)#18518

Merged
overvenus merged 1 commit intotikv:add-index-ingest-allow-writefrom
LykxSassinator:cp_pr1_to_hotfix
Jun 6, 2025
Merged

[hotfix-to-7.5.6] raftstore: directly write kvs rather than ingestion when merging small regions. (#17408)#18518
overvenus merged 1 commit intotikv:add-index-ingest-allow-writefrom
LykxSassinator:cp_pr1_to_hotfix

Conversation

@LykxSassinator
Copy link
Contributor

This is a manual cherry-pick of #17408

What is changed and how it works?

Issue Number: Close #17412, #17376

What's Changed:

Previously, snapshots of regions, with the exception of the `lock_cf` column family,
were flushed to SST files, while `lock_cf` was flushed to plain files. This approach could
lead to a high volume of `ingest` tasks for merging regions, especially when the TiKV
node contained a large number of small-sized regions.  As we all know, an excess of `ingest`
tasks can significantly impair the overall performance of the TiKV node.

To address this issue, this pull request introduces a new configuration option called
`snap_min_ingest_size`. When a region's size is below the threshold set by `snap_min_ingest_size`,
its corresponding snapshot will now be applied without `ingest` SST files. This change
is expected to reduce the frequency of ingest tasks and thereby enhance the TiKV node's processing efficiency.

And the following comparison shows that this pr can greatly reduce the duration of merging numerous small regions.

Nightly(222e0a) This PR
image image

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Release note

To mitigate the high apply wait duration problem, it directly dumps and flushes key-value pairs in sst files of snapshots when merging small regions rather than ingestion.

…l regions. (tikv#17408)

Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has signed the dco. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 6, 2025
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jun 6, 2025
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jun 6, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-06-06 10:06:20.526598536 +0000 UTC m=+3958.754913800: ☑️ agreed by overvenus.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jun 6, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: overvenus
Once this PR has been reviewed and has the lgtm label, please assign cfzjywxk for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found 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

@overvenus overvenus merged commit 243dd52 into tikv:add-index-ingest-allow-write Jun 6, 2025
2 of 3 checks passed
@LykxSassinator LykxSassinator deleted the cp_pr1_to_hotfix branch June 6, 2025 10:25
ti-chi-bot bot pushed a commit that referenced this pull request Jun 10, 2025
 

Rollup of following sst ingestion optimizations

* raftstore: directly write kvs rather than ingestion when merging small regions. (#17408) (#18518)
* raftstore: remove stale ranges by DeleteByKeys rather than ingesting. (#18040) (#18519)
* raftstore: support rocksdb writes during ingestion #18096 (#18520)
* storage: support online config for flow-control module (#17396). (#18523)
* sst_importer: allow write during ingesting sst (#18514) (#18522)

Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
Signed-off-by: Neil Shen <overvenus@gmail.com>

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

Labels

dco-signoff: yes Indicates the PR's author has signed the dco. needs-1-more-lgtm Indicates a PR needs 1 more LGTM. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants