Repository navigation
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe change adds transaction protocol version selection to unary and streaming region requests. It stores protocol ranges from store metadata, supports one compatibility resend after a qualifying rejection, and propagates incompatible-request and undetermined-result errors through client and lock-resolution paths. ChangesTransaction protocol and terminal errors
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~45 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant RegionClient
participant Cluster
participant RpcCall
participant TiKV
RegionClient->>Cluster: read request origin and protocol ceiling
RegionClient->>RpcCall: set context with selected protocol version
RpcCall->>TiKV: send request
TiKV-->>RegionClient: return incompatible-request response
RegionClient->>RegionClient: validate rejection and select compatible version
RegionClient->>RpcCall: set context for one compatibility resend
RpcCall->>TiKV: resend request
TiKV-->>RegionClient: return response
Merge Risk: ⚪ Minimal · up to No actionable issue is established for this change. It is ready for normal checks before merging. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 4.12% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 97 functions across 17 files. (1 skipped: 1 unsupported.)
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. Comment |
Signed-off-by: zyguan <zhongyangguan@gmail.com>
b9e325f to
d342ebe
Compare
Signed-off-by: zyguan <zhongyangguan@gmail.com>
|
@windtalker @gengliqi Could you PTAL? |
| } | ||
|
|
||
| template <typename REQ> | ||
| uint32_t requiredTxnProtocolVersion(const REQ & req) |
There was a problem hiding this comment.
why isProtectedTxnRequest handle much more request type than requiredTxnProtocolVersion?
There was a problem hiding this comment.
They serve different purposes. isProtectedTxnRequest identifies the RPC types covered by transaction protocol admission checks. requiredTxnProtocolVersion inspects the request payload to determine its minimum required version.
Most protected requests currently require version 0. Only shared-lock mutations in Prewrite and PessimisticLock require version 2, so those are currently the only payload-specific branches. The other protected RPCs still need admission checks and must handle incompatibilities detected by the server.
| // This client currently implements protocol semantics only through incompatible-error-handling. | ||
| // The configured ceiling must not advertise support for higher versions (e.g. shared locks) | ||
| // merely because their enum values are available in kvproto; their semantics must be implemented first. | ||
| if (config.default_txn_protocol_version > ::kvrpcpb::TXN_VER_SUPPORT_INCOMPATIBLE_ERROR_HANDLING) |
There was a problem hiding this comment.
It means even after this pr, client-c does not support shared locks?
There was a problem hiding this comment.
Correct. This PR adds compatibility protection, not shared-lock support. The default protocol ceiling is 1, which declares support for structured incompatibility handling, consistent with client-go's default.
Declaring version 2 requires complete shared-lock handling, including wrapper parsing and expansion, nested lock information preservation, and pagination and resolve semantics. Once all relevant caller paths support those semantics, the process should explicitly opt in to version 2.
Client-c does not implement those semantics yet, so this PR deliberately caps its configuration at 1. Enabling version 2 requires implementing that support first, then allowing the higher ceiling.
Ref: tikv/tikv#20085
Summary
Add transaction RPC compatibility protection for mixed-version TiKV clusters.
Testing
ci/build-test.shvialocal/tikv-client-c-builder:latestkv_client_testpassedbank_testpassedSummary by CodeRabbit
New Features
Bug Fixes
Tests