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 1 commit
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
2 changes: 2 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,7 @@ func (s *session) retry(ctx context.Context, maxCnt uint) error {
}
s.StmtCommit()
}
log.Warnf("con:%d txn(%d) has retried txn(%d)", connID, s.GetSessionVars().TxnCtx.StartTS, orgStartTS)
Copy link
Contributor

Choose a reason for hiding this comment

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

s/txn(%d)/txn:%d?
I see other places use "txn:".

Copy link
Member Author

Choose a reason for hiding this comment

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

@zimulala the other place is txn, this is txn start ts.
@lilin90 need help to translate like "transaction A which transaction start timestamp/transaction ID is xxx has finished (may be not success e.g. meets some errors) and it retried the statements which are from transaction B which transaction start timestamp/transaction ID is xxx"

Copy link
Member

Choose a reason for hiding this comment

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

@jackysp I think it's easier to understand this way:

Transaction A, with the transaction start timestamp (transaction ID) xxx, has finished retrying (might fail, such as meeting some errors) all the statements in transaction B, with the transaction start timestamp (transaction ID) yyy.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've used the Unix naming method to keep it simple. PTAL @zimulala

if hook := ctx.Value("preCommitHook"); hook != nil {
// For testing purpose.
hook.(func())()
Expand Down