-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
session: track LastCommitTS in SessionVars and check timestamps of later txns are larger #57305
base: master
Are you sure you want to change the base?
Conversation
Hi @b6g. Thanks for your PR. I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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/test-infra repository. |
[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.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @b6g. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. 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. |
pkg/session/session.go
Outdated
@@ -929,6 +929,21 @@ func (s *session) CommitTxn(ctx context.Context) error { | |||
s.sessionVars.StmtCtx.MergeExecDetails(nil, commitDetail) | |||
} | |||
|
|||
if err == nil { | |||
// save CommitTS in sessionVars for invariant check | |||
// TODO: enable LastCommitTS with a session variable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will add a session variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in a separate PR #57313, to make review easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per discussion in #57313 (comment), we don't need a session variable.
e8df58f
to
e053b6f
Compare
5cc54f3
to
8297ca5
Compare
/ok-to-test |
4e39c69
to
31193ac
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #57305 +/- ##
================================================
- Coverage 73.1843% 73.1517% -0.0327%
================================================
Files 1674 1674
Lines 461690 461717 +27
================================================
- Hits 337885 337754 -131
- Misses 103042 103208 +166
+ Partials 20763 20755 -8
Flags with carried forward coverage won't be shown. Click here to find out more.
|
fbfaf0f
to
3c7fb77
Compare
The client-go PR is merged and go.mod is updated. The PR is ready for review. PTAL Thanks! |
@@ -109,7 +109,7 @@ require ( | |||
github.com/tdakkota/asciicheck v0.2.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run the make bazel_preapre
and upload the dependencies.
Some tests failed with
Was it because the client-go PR was just merged and it takes time to create |
1af9227
to
ef63538
Compare
The error was,
|
/test build |
@b6g: The specified target(s) for
Use
In 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 |
How can I update the client-go version? I tried,
But these tests failed. |
/retest |
I has uploaded it. you can try the unit test again. |
BTW, Can you sync your code with master ? |
Will do. I am fixing the broken unittests. |
[FORMAT CHECKER NOTIFICATION] Notice: To remove the For example:
📖 For more info, you can check the "Contribute Code" section in the development guide. |
The unittests are fixed. PTAL |
ping |
What problem does this PR solve?
Issue Number: close #57165
Problem Summary:
This PR checks the invariant that timestamps of transactions in a session should increase monotonically.
It saves the timestamp of the last transaction in
SessionVars
, after the transaction is committed. The saved timestamp is compared with thestart_ts
and thecommit_ts
of the next transaction.This PR depends on the TiKV client-go PR, tikv/client-go#1489, which exports
commit_ts
of the transaction.What changed and how does it work?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.