-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
sessionctx,store,kv: add a session variable to export last txn info (#19949) #20696
sessionctx,store,kv: add a session variable to export last txn info (#19949) #20696
Conversation
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
/run-all-tests |
@zyguan please accept the invitation then you can push to the cherry-pick pull requests. |
Signed-off-by: zyguan <zhongyangguan@gmail.com>
LGTM |
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.
LGTM
@MyonKeminta, Thanks for your review. The bot only counts LGTMs from Reviewers and higher roles, but you're still welcome to leave your comments. See the corresponding SIG page for more information. Related SIG: execution(slack). |
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.
LGTM
@youjiali1995, Thanks for your review. The bot only counts LGTMs from Reviewers and higher roles, but you're still welcome to leave your comments. See the corresponding SIG page for more information. Related SIG: execution(slack). |
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.
LGTM
/merge |
Your auto merge job has been accepted, waiting for:
|
/run-all-tests |
cherry-pick #19949 to release-4.0
Signed-off-by: zyguan zhongyangguan@gmail.com
What problem does this PR solve?
Problem Summary: Currently we can get start ts from
@@tidb_current_ts
within a transaction, however there is no way to get commit ts. The testability can be improved a lot if we can access the commit ts (and may more info) of the last committed transaction.What is changed and how it works?
What's Changed: Add a session variable,
@@tidb_last_txn_info
, which export timestamps of the last committed transaction.How it Works: A new txn option
CommitHook
, which indicates a callback function with signature offunc(TxnInfo, error)
, is added and will be called right after a transaction gets committed. In this callback function, we attach txn info toSessionVars
and export ts fields as session variables.Related changes
pingcap/docs
/pingcap/docs-cn
:Check List
Tests
Side effects
Release note