Skip to content

KVStore: neglect TransferLeader for nextgen compatibility#10737

Merged
ti-chi-bot[bot] merged 6 commits intopingcap:masterfrom
CalvinNeo:fix-kv
Mar 10, 2026
Merged

KVStore: neglect TransferLeader for nextgen compatibility#10737
ti-chi-bot[bot] merged 6 commits intopingcap:masterfrom
CalvinNeo:fix-kv

Conversation

@CalvinNeo
Copy link
Member

@CalvinNeo CalvinNeo commented Mar 10, 2026

What problem does this PR solve?

Issue Number: close #10734

Problem Summary:

neglect TransferLeader for next-gen compatibility. Also downgrade logging level about transfer leader from error to info

What is changed and how it works?


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

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

None

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of admin commands (including TransferLeader and peer update flows) to avoid unnecessary operations during leadership and peer transitions.
  • Tests

    • Added test coverage validating TransferLeader routing and adjusted test flow to reflect the new handling.

a
Signed-off-by: Calvin Neo <calvinneo1995@gmail.com>
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-triage-completed release-note-none Denotes a PR that doesn't merit a release note. labels Mar 10, 2026
@pantheon-ai
Copy link

pantheon-ai bot commented Mar 10, 2026

Failed to Create Project

We encountered an error while creating your project. Please try again or contact support if the issue persists.

@ti-chi-bot ti-chi-bot bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 10, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 10, 2026

📝 Walkthrough

Walkthrough

Routes the TransferLeader admin command into the existing no-op admin command path and updates unit tests to assert the no-op behavior; adjusts the subsequent CompactLog test index. Adds a comment clarifying proxy rewrite vs next-gen proxy dispatch behavior.

Changes

Cohort / File(s) Summary
Admin Command Handling
dbms/src/Storages/KVStore/MultiRaft/RaftCommandsKVS.cpp
Added a TransferLeader case to route the command to handleUselessAdminRaftCmd (treated as no-op) and included an explanatory comment about tiflash-proxy rewrites vs next-gen proxy dispatch.
Test Coverage
dbms/src/Storages/KVStore/tests/gtest_new_kvstore.cpp
Added a TransferLeader path to KVStoreAdminCommands test (expects EngineStoreApplyRes::None) and incremented the index used for the subsequent CompactLog test from 26 to 27.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

lgtm

Suggested reviewers

  • JinheLin
  • JaySon-Huang

Poem

🐰 I hopped through branches, light and fleet,
Found a leader switch and made it neat.
Routed gently to a harmless song,
Tests now nod and carry on. ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description includes the issue number, problem summary, and mentions related PRs, but lacks a detailed commit message explaining the implementation changes. Add a detailed commit message in the designated section explaining what was changed and how it solves the problem (e.g., routing TransferLeader through handleUselessAdminRaftCmd, logging level downgrade).
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'KVStore: neglect TransferLeader for nextgen compatibility' directly describes the main change: handling the unsupported TransferLeader admin command to prevent crashes.
Linked Issues check ✅ Passed The code changes route TransferLeader commands through handleUselessAdminRaftCmd, which prevents the fatal exception by treating them as unsupported but non-fatal, directly addressing issue #10734.
Out of Scope Changes check ✅ Passed All changes are directly related to handling TransferLeader commands; the test updates align with the implementation changes and no unrelated modifications are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

a
Signed-off-by: Calvin Neo <calvinneo1995@gmail.com>
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Mar 10, 2026
@CalvinNeo CalvinNeo changed the title Neglect TransferLeader for nextgen compatibility KVStore: neglect TransferLeader for nextgen compatibility Mar 10, 2026
a
Signed-off-by: Calvin Neo <calvinneo1995@gmail.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@dbms/src/Storages/KVStore/MultiRaft/RaftCommandsKVS.cpp`:
- Around line 186-189: Fix the typos in the comment above the switch cases for
raft_cmdpb::AdminCmdType::TransferLeader and
raft_cmdpb::AdminCmdType::UpdateGcPeer: change "Initialy" to "Initially" and
"rewrited" to "rewritten" so the comment reads correctly while leaving the
surrounding logic and case labels untouched.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1b740495-4d2d-4ad1-803a-1a420fc4b188

📥 Commits

Reviewing files that changed from the base of the PR and between f27e905 and 7e1aa7d.

📒 Files selected for processing (1)
  • dbms/src/Storages/KVStore/MultiRaft/RaftCommandsKVS.cpp

@CalvinNeo CalvinNeo requested a review from JaySon-Huang March 10, 2026 10:04
@JaySon-Huang
Copy link
Contributor

Wait for the proxy logging downgrade pr to be merged. In order to reduce the efforts to do when cherry-pick

Signed-off-by: JaySon-Huang <tshent@qq.com>
Signed-off-by: JaySon-Huang <tshent@qq.com>
@ti-chi-bot ti-chi-bot bot added the lgtm label Mar 10, 2026
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Mar 10, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JaySon-Huang, JinheLin

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:
  • OWNERS [JaySon-Huang,JinheLin]

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 removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Mar 10, 2026
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Mar 10, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-03-10 08:40:14.43915136 +0000 UTC m=+339445.951209011: ☑️ agreed by JinheLin.
  • 2026-03-10 13:34:19.707026684 +0000 UTC m=+357091.219084345: ☑️ agreed by JaySon-Huang.

@ti-chi-bot ti-chi-bot bot merged commit 94e0823 into pingcap:master Mar 10, 2026
8 checks passed
@JaySon-Huang
Copy link
Contributor

/cherry-pick release-nextgen-20251011

@ti-chi-bot
Copy link
Member

@JaySon-Huang: failed to apply #10737 on top of branch "release-nextgen-20251011":

[failed to git add conflicting files: exit status 128, failed to git commit: exit status 128]
Details

In response to this:

/cherry-pick release-nextgen-20251011

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 ti-community-infra/tichi repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm release-note-none Denotes a PR that doesn't merit a release note. 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.

[next gen] TiFlash crash for unsupported admin command type TransferLeader

4 participants