Skip to content

tso: Fix keyspace-group split causing keyspace to fallback to group 0#9823

Merged
ti-chi-bot[bot] merged 2 commits intotikv:masterfrom
ystaticy:fix_tso_group_split
Oct 14, 2025
Merged

tso: Fix keyspace-group split causing keyspace to fallback to group 0#9823
ti-chi-bot[bot] merged 2 commits intotikv:masterfrom
ystaticy:fix_tso_group_split

Conversation

@ystaticy
Copy link
Copy Markdown
Contributor

@ystaticy ystaticy commented Oct 13, 2025

What problem does this PR solve?

The keyspace tso group does not fall back to group 0 and is updated directly to the target group

Issue Number: Close #9822

What is changed and how does it work?

Save the split target keyspace group first, then save the split source keyspace group. The order matters: if we save splitSourceKg first (which removes some keyspaces from it), there will be a brief moment where those keyspaces don't belong to any group, causing them to fallback to group 0. By saving splitTargetKg first (which contains the split keyspaces), we ensure the keyspaces always belong to a valid group during the transition.

1.During the split process, save the target group first, then the source group. This avoids deleting the keyspace-to-group mapping from memory (caused by saving the source group first) and thus prevents falling back to group 0.
2. The watch process ensures order based on the revision, and the processing of putFn is also serial.
3. Updating the target group first does not trigger the issue of "premature" updates to the keyspace-group ID mapping. This is because during the split process, the client will keep retrying until the split is finally completed, after which the client can send requests normally.
4. The delayBeforeCheckingElectionMember failpoint is used to lengthen the split process, making it easier to reproduce the scenario where TSO requests are received between the two keyspace group save operations during the split.

Check List

Tests

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

Code changes

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Related changes

Release note

tso: Fix keyspace-group split operation fallback to group 0

Signed-off-by: ystaticy <y_static_y@sina.com>
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has signed the dco. contribution This PR is from a community contributor. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Oct 13, 2025
@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot bot commented Oct 13, 2025

Hi @ystaticy. Thanks for your PR.

I'm waiting for a tikv member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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 size/M Denotes a PR that changes 30-99 lines, ignoring generated files. do-not-merge/needs-triage-completed release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. labels Oct 13, 2025
@JmPotato
Copy link
Copy Markdown
Member

/ok-to-test

@ti-chi-bot ti-chi-bot bot added ok-to-test Indicates a PR is ready to be tested. and removed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Oct 13, 2025
@ystaticy ystaticy changed the title tso: Fix keyspace-group split operation fallback to group 0 tso: Fix keyspace-group split causing keyspace to fallback to group 0 Oct 13, 2025
@ystaticy
Copy link
Copy Markdown
Contributor Author

/test pull-unit-test-next-gen

Signed-off-by: ystaticy <y_static_y@sina.com>
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Oct 13, 2025
@rleungx
Copy link
Copy Markdown
Member

rleungx commented Oct 13, 2025

/retest

@ti-chi-bot ti-chi-bot bot added the approved label Oct 13, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 13, 2025

Codecov Report

❌ Patch coverage is 83.33333% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.97%. Comparing base (33d00c5) to head (9f088f1).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9823      +/-   ##
==========================================
+ Coverage   76.82%   76.97%   +0.14%     
==========================================
  Files         491      491              
  Lines       78440    78454      +14     
==========================================
+ Hits        60261    60389     +128     
+ Misses      14478    14388      -90     
+ Partials     3701     3677      -24     
Flag Coverage Δ
unittests 76.97% <83.33%> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ystaticy
Copy link
Copy Markdown
Contributor Author

/test pull-unit-test-next-gen

@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot bot commented Oct 13, 2025

@ystaticy: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
non-block/pull-unit-test-next-gen 9f088f1 link false /test pull-unit-test-next-gen

Full PR test history. Your PR dashboard.

Details

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. I understand the commands that are listed here.

@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot bot commented Oct 14, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JmPotato, rleungx

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 lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Oct 14, 2025
@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot bot commented Oct 14, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-10-13 10:25:04.740009694 +0000 UTC m=+89810.817262255: ☑️ agreed by rleungx.
  • 2025-10-14 03:01:16.03044973 +0000 UTC m=+149582.107702290: ☑️ agreed by JmPotato.

@ti-chi-bot ti-chi-bot bot merged commit 487492d into tikv:master Oct 14, 2025
37 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved contribution This PR is from a community contributor. dco-signoff: yes Indicates the PR's author has signed the dco. lgtm ok-to-test Indicates a PR is ready to be tested. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tso: keyspace group split operation fallback to group 0 issue

3 participants