Skip to content

region-size: Inherit relevant configs on region-size from the last config file. (#18505)#18545

Merged
ti-chi-bot[bot] merged 6 commits intotikv:release-8.5from
ti-chi-bot:cherry-pick-18505-to-release-8.5
Jul 3, 2025
Merged

region-size: Inherit relevant configs on region-size from the last config file. (#18505)#18545
ti-chi-bot[bot] merged 6 commits intotikv:release-8.5from
ti-chi-bot:cherry-pick-18505-to-release-8.5

Conversation

@ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #18505

What is changed and how it works?

Issue Number: Close #18503

What's Changed:

This PR introduces an inheritance mechanism for region-size configurations to ensure smooth
upgrades from earlier versions to v8.5+. When upgrading, the system will automatically retain
the previous region-size settings unless they were manually modified in the current tikv.toml
before startup.

image

Make TiKV can inherit the last configurations on `region-size` to avoid change the default size
of region unexpectedly.

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

Make TiKV can inherit the last configurations on `region-size` to avoid change the default size
of region unexpectedly.

Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
@ti-chi-bot ti-chi-bot added dco-signoff: yes Indicates the PR's author has signed the dco. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR. labels Jun 13, 2025
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jun 13, 2025
@ti-chi-bot ti-chi-bot bot added cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Jun 30, 2025
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jul 2, 2025
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jul 2, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-06-13 07:14:53.611678759 +0000 UTC m=+598471.839994015: ☑️ agreed by LykxSassinator.
  • 2025-07-02 09:36:34.609556506 +0000 UTC m=+1474047.332735482: ☑️ agreed by hbisheng.

@zhangjinpeng87
Copy link
Member

bugbot run

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Incorrect Configuration Reference in `compatible_adjust`

The compatible_adjust function's deprecation detection and migration logic for raftstore.region-max-size and raftstore.region-split-size is flawed. When a last_config is provided, the function incorrectly uses last_config.raft_store as the reference for comparison instead of RaftstoreConfig::default(). This leads to incorrect deprecation warnings and migration behavior.

src/config/mod.rs#L4164-L4197

tikv/src/config/mod.rs

Lines 4164 to 4197 in ef6a180

#[allow(deprecated)]
pub fn compatible_adjust(&mut self, last_config: Option<&TikvConfig>) {
let (default_raft_store, default_coprocessor) = last_config
.map_or((RaftstoreConfig::default(), CopConfig::default()), |cfg| {
(cfg.raft_store.clone(), cfg.coprocessor.clone())
});
if self.raft_store.region_max_size != default_raft_store.region_max_size {
warn!(
"deprecated configuration, \
raftstore.region-max-size has been moved to coprocessor"
);
if self.coprocessor.region_max_size == default_coprocessor.region_max_size {
warn!(
"override coprocessor.region-max-size with raftstore.region-max-size, {:?}",
self.raft_store.region_max_size
);
self.coprocessor.region_max_size = Some(self.raft_store.region_max_size);
}
self.raft_store.region_max_size = default_raft_store.region_max_size;
}
if self.raft_store.region_split_size != default_raft_store.region_split_size {
warn!(
"deprecated configuration, \
raftstore.region-split-size has been moved to coprocessor",
);
if self.coprocessor.region_split_size == default_coprocessor.region_split_size {
warn!(
"override coprocessor.region-split-size with raftstore.region-split-size, {:?}",
self.raft_store.region_split_size
);
self.coprocessor.region_split_size = Some(self.raft_store.region_split_size);
}
self.raft_store.region_split_size = default_raft_store.region_split_size;
}

Fix in Cursor


BugBot free trial expires on July 22, 2025
You have used $0.00 of your $10.00 spend limit so far. Manage your spend limit in the Cursor dashboard.

Was this report helpful? Give feedback by reacting with 👍 or 👎

Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
Copy link
Member

@zhangjinpeng87 zhangjinpeng87 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jul 3, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hbisheng, LykxSassinator, zhangjinpeng87

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 added the approved label Jul 3, 2025
@ti-chi-bot ti-chi-bot bot merged commit 84610a2 into tikv:release-8.5 Jul 3, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved cherry-pick-approved Cherry pick PR approved by release team. dco-signoff: yes Indicates the PR's author has signed the dco. lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants