-
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: add transaction start timestamp to the log when retrying #8091
Conversation
session/session.go
Outdated
@@ -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) |
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.
s/txn(%d)
/txn:%d
?
I see other places use "txn:".
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.
@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"
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.
@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.
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've used the Unix naming method to keep it simple. PTAL @zimulala
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
PTAL @zimulala |
@@ -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)", |
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.
How about combine retry_start_ts
and origin_ts
to L488 L490's log
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'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,
PTAL @lysu |
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
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
…ngcap#8091) (cherry picked from commit 9fdc8eb)
What problem does this PR solve?
The retry log does not contain the current retrying transaction timestamp and also which transaction it was retried.
What is changed and how it works?
Add a log of transaction start timestamp when retrying.
Check List
Tests
The log will look like below:
PTAL @zimulala