Skip to content
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: add transaction start timestamp to the log when retrying #8091

Merged
merged 3 commits into from
Nov 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ func (s *session) retry(ctx context.Context, maxCnt uint) error {
nh := GetHistory(s)
var err error
var schemaVersion int64
orgStartTS := s.GetSessionVars().TxnCtx.StartTS
for {
s.PrepareTxnCtx(ctx)
s.sessionVars.RetryInfo.ResetOffset()
Expand Down Expand Up @@ -497,6 +498,8 @@ func (s *session) retry(ctx context.Context, maxCnt uint) error {
}
s.StmtCommit()
}
log.Warnf("con:%d retrying_txn_start_ts:%d original_txn_start_ts:(%d)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about combine retry_start_ts and origin_ts to L488 L490's log

Copy link
Member Author

@jackysp jackysp Nov 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried it. It makes them so annoying because of so many same info in these lines if the transaction is large. We could use the connection ID to find the previous log,

connID, s.GetSessionVars().TxnCtx.StartTS, orgStartTS)
if hook := ctx.Value("preCommitHook"); hook != nil {
// For testing purpose.
hook.(func())()
Expand Down