Print Txn ID and Query ID in log to trace the whole lifetime of a Txn / SQL #17845
Labels
feature/accepted
This feature request is accepted by product managers
sig/transaction
SIG:Transaction
type/feature-request
Categorizes issue or PR as related to a new feature.
Feature Request
Is your feature request related to a problem? Please describe:
TiDB now outputs TxnStartTs or ConnId in logs, which is not sufficient.
Cons of TxnStartTs:
Cons of ConnId:
Describe the feature you'd like:
For each transaction, assign a globally unique TxnId. The id can be generated by randomize in uint64.
For each query, assign a globally unique QueryId. The id can be generated by randomize in uint64.
Both TiDB and TiKV logs outputs the TxnId and QueryId, for example, in slow logs, conflict logs, back off logs, etc.
This simplifies the process to diagnose problems from logs: users should be able know everything (log) about a transaction by only
grep
the TxnId, and know everything (log) about a query by onlygrep
the QueryId.Describe alternatives you've considered:
TxnId and QueryId can be derived from a global Connection Id, in order to be able to associate Transaction / Query with Connection. However looks like it doesn't need to be this complicated, since we can print connection id in the log at the same time in the log together with TxnId and QueryId. In this way, user can know the connection id by simply
grep
either TxnId or QueryId.Teachability, Documentation, Adoption, Migration Strategy:
The text was updated successfully, but these errors were encountered: