sessiontxn: deadlock retry log does not follow tidb_redact_log

Open Beginner friendly
#73,191 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go

Research direction

Start from the two named log sites in pkg/sessiontxn/isolation/repeatable_read.go and pkg/sessiontxn/isolation/readcommitted.go, where lockKey is logged with zap.Stringer. Read how the earlier redaction fixes in #71922 and #72544 apply the session's tidb_redact_log setting, then make both deadlock-retry log calls follow the same pattern. Done means the RR and RC retry logs redact lockKey when redaction is enabled, with matching tests or existing sessiontxn tests passing.

Written by the indexing model from the issue text.

Description

affects-8.5 component/session severity/moderate sig/transaction type/bug

Bug Report

1. Minimal reproduce step (Required)
  1. Set tidb_redact_log = ON for the session.
  2. Trigger a retryable single-statement deadlock in a pessimistic RR or RC transaction.
  3. Check the INFO log single statement deadlock, retry statement.

Reported on v8.5.8 and confirmed by source inspection. A standalone SQL reproducer is not attached.

2. What did you expect to see? (Required)

The lockKey field should follow the session's tidb_redact_log setting.

3. What did you see instead (Required)

lockKey still contains the original hexadecimal key. Both providers use zap.Stringer("lockKey", kv.Key(deadlock.LockKey)), which does not apply redaction.

Related: #59279. The fixes in #71922 and #72544 do not cover these two log sites.

4. What is your TiDB version? (Required)

v8.5.8 (8b857efa20363d50a8fa2ea7dd9809a85a61b115). Also present in checked release-8.5 (8a112b0a8bba) and master (095cb8b517b0).

Dominant language
Go
Stars
40.7k
Forks
6.3k
Avg merge
2d 20h
Merged PRs (30d)
291

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pingcap/tidb

All issues in pingcap/tidb

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.