Bypass locks invisible to read snapshot (#243)#244
Conversation
Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
|
Warning Review limit reached
Next review available in: 10 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesRead lock bypass
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Reader
participant LockResolver
participant TxnStatus
Reader->>LockResolver: resolveLocks(for_write=false)
LockResolver->>TxnStatus: evaluate transaction status
TxnStatus-->>LockResolver: return bypass eligibility
LockResolver-->>Reader: record txn_id in pushed
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gengliqi The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
|
/test pull-build-test |
|
@windtalker: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
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. |
|
/ok-to-test |
|
/test pull-build-test |
|
@windtalker: No presubmit jobs available for tikv/client-c@master DetailsIn response to this:
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. |
|
/retest |
| if (!for_write && canBypassLockForRead(status, caller_start_ts)) | ||
| { | ||
| pushed.push_back(lock->txn_id); | ||
| break; |
There was a problem hiding this comment.
The lock will not be resolved, so it must be put into resolved_locks to skip it in tikv. However the scanner doesn't use the returned pushed?
There was a problem hiding this comment.
In client-c, pushed will be treated as min_commit_ts_pushed in
client-c/src/coprocessor/Client.cc
Lines 723 to 727 in 6b91f49
And min_commit_ts_pushed wil be added to add_resolved_locks when constructing request
client-c/src/coprocessor/Client.cc
Lines 705 to 708 in 6b91f49
There was a problem hiding this comment.
I mean here
Lines 95 to 96 in 6b91f49
There was a problem hiding this comment.
Good catch. Scanner missed this path. Fixed it by adding returned pushed into snap.min_commit_ts_pushed after resolving scan response locks, and by adding snap.min_commit_ts_pushed to ScanRequest.context.resolved_locks on retry. Also added a scanner regression test for the committed-after-read case.
Test added |
Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
fe5182d to
d667e41
Compare
Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
|
/retest |
This pr cherry pick #243 to master branch
Summary by CodeRabbit