-
Notifications
You must be signed in to change notification settings - Fork 6.1k
planner: activate stale-read txn when autocommit=0 #65908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Skipping CI for Draft Pull Request. |
|
Skipping CI for Draft Pull Request. |
|
[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 |
2857898 to
da39e55
Compare
|
/test all |
|
/retest |
da39e55 to
ea4473c
Compare
|
/test all |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #65908 +/- ##
================================================
- Coverage 77.7756% 77.6133% -0.1623%
================================================
Files 2001 1923 -78
Lines 545524 533113 -12411
================================================
- Hits 424285 413767 -10518
+ Misses 119577 119340 -237
+ Partials 1662 6 -1656
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
When `autocommit=0` and stale read is enabled, the first SELECT now activates a proper stale-read transaction instead of just replacing the provider. This ensures: 1. `InTxn()` becomes true after the first SELECT 2. Subsequent reads reuse the same snapshot (StartTS) 3. Write statements are rejected (existing behavior) 4. COMMIT/ROLLBACK ends the transaction normally
ea4473c to
a487a74
Compare
|
/test all |
|
/retest |
|
@wfxr: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
Issue Number: close #64198
Problem Summary:
When
autocommit=0andtidb_read_stalenessis set, eachSELECTstatement recalculates its ownread_tsinstead of reusing the same snapshot. This causes inconsistent reads across multiple statements within what users expect to be a single transaction.What changed and how does it work?
Changed
EnterNewTxnWithReplaceProvidertoEnterNewTxnWithBeginStmtwhen!IsAutocommit()inupdateStateFromStaleReadProcessor(). This triggersactivateStaleTxn()inStalenessTxnContextProvider.This ensures:InTxn()becomes true after the firstSELECTStartTS)COMMIT/ROLLBACKends the transaction normallyCheck List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.