Add labels for the retry execution caused by pessimistic lock error
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Enhancement
TiDB writes the retry information caused by pessimistic lock error to slow log, such as below.
> '# Exec_retry_time: 0.001498023 Exec_retry_count: 1'
The pessimistic lock errors that allow to re-execute the current query contain `DeadLock`, `WriteConflict`. The `WriteConflict` error may be caused by `RCCheckTS`, `PessimisticRetry`. This issue aims to add the reasons of pessimistic retry to slow log and improves maintainability.
We will add a new field `Exec_retry_reason` to slow log and system table `slow_query`, which makes the format a little different from old veresion. The new slow log record of pessimistic retry is as below.
> '# Exec_retry_time: 0.001414129 Exec_retry_count: 1 Exec_retry_reason: [PessimisticRetry]'
> '# Exec_retry_time: 0.001414129 Exec_retry_count: 1 Exec_retry_reason: [RcCheckTS]'
> '# Exec_retry_time: 0.001414129 Exec_retry_count: 1 Exec_retry_reason: [PessimisticRetry, RcCheckTS]'
Contributor guide
Assessment
This issue has not been assessed yet.