Skip to content

fix: include namespace in API V3 physical routing - #567

Merged
disksing merged 3 commits into
apiv3from
fix/namespace-physical-prefix
Oct 8, 2026
Merged

disksing merged 3 commits into
apiv3from
fix/namespace-physical-prefix

Conversation

@disksing

@disksing disksing commented Oct 8, 2026 •

Copy link
Copy Markdown

API V3 keyspaces with the same local ID in different namespaces currently produce identical physical routing keys. Encode the routing prefix as mode + 32-bit namespace + 24-bit keyspace, including carry across the complete prefix for exclusive range bounds. RPC keys remain logical, and API V2 routing is unchanged.

Add TransactionClient::with_keyspace_identity to derive scoped clients while sharing the PD connection and region cache. Bound the shared V3 timestamp-oracle cache to 64 least-recently-used entries. In-flight requests retain their oracle until the response completes; evicted streams terminate when their final owner is released. Pending queues allocate on demand.

Restore compatibility with legacy PD metadata that omits the proto3 scalar keyspace ID zero, while continuing to distinguish explicit V3 identities. This fixes the existing DEFAULT-keyspace failure in the raw and transaction integration jobs against PD v8.5.5.

Validation: 143 client unit tests, including legacy wire decoding and oracle eviction/in-flight lifetime cases; Rust 1.93 format and all-target clippy with warnings denied; CSE integration using namespaces 7 and 19 with the same keyspace ID, covering bidirectional transactions, alternating cached reads, unbounded forward/reverse scans, pessimistic locks, and independent expired-lock resolution. The preceding legacy-compatibility commit also passed both GitHub integration jobs; CI is rerunning for the final oracle-lifetime change.

These protocol changes require coordinated PD/CSE/client rollout to a newly initialized V3 cluster; existing four-byte V3 data is not migrated by this PR.

Signed-off-by: disksing <i@disksing.com>
@ti-chi-bot ti-chi-bot Bot added the dco-signoff: yes Indicates the PR's author has signed the dco. label Oct 8, 2026
@ti-chi-bot

ti-chi-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign yiwu-arbug 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

@ti-chi-bot ti-chi-bot Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 8, 2026
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • release-*
  • tikv-*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2021baea-d8b0-44dc-b486-a97e6482d707

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Signed-off-by: disksing <i@disksing.com>
@ti-chi-bot ti-chi-bot Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 8, 2026
Signed-off-by: disksing <i@disksing.com>
@ti-chi-bot ti-chi-bot Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 8, 2026
@disksing
disksing merged commit 715d5de into apiv3 Oct 8, 2026
7 of 8 checks passed
@disksing
disksing deleted the fix/namespace-physical-prefix branch October 8, 2026 15:38
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. 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.

1 participant