BR: checksum-pitr loadPitrIdMap swallows mysql.tidb_pitr_id_map query failures (checked error slot not used; silent skip with empty filter)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start in br/pkg/task/operator/checksum_table.go at loadPitrIdMap and trace the empty-filter path through RunPitrChecksumTable. Reproduce a failing mysql.tidb_pitr_id_map query with br pitr checksum table; done means the real query failure is reported and the check cannot silently succeed with an empty request list.
Written by the indexing model from the issue text.
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
- Prepare a TiDB cluster and a BR binary built from any version since #64383 (2025-12).
- Make the query to
mysql.tidb_pitr_id_mapfail — e.g. revoke the privilege needed for the restricted SQL on that table, or make PD/TiKV unavailable during the check. - Run
br pitr checksum tablewith a filter matching no table (empty-result path).
2. What did you expect to see? (Required)
The command fails with an error pointing at the real query failure.
3. What did you see instead (Required)
The failure is silently swallowed. loadPitrIdMap (br/pkg/task/operator/checksum_table.go) checks the fresh query error errSQL but returns errors.Annotate(err, ...) where err is a stale CreateSession error slot — provably nil at that point (the if err != nil return above already consumed it). errors.Annotate(nil, msg) returns nil, so a failed query returns (nil, nil):
- with a non-empty filter: a misleading
no db map found by db nameerror later (blames missing id-map data instead of the real failure); - with an empty filter:
RunPitrChecksumTablesees err==nil, the request list stays empty,runChecksumsucceeds — the PITR data-integrity check is skipped entirely with exit 0.
Root cause:
rows, _, errSQL := execCtx.ExecRestrictedSQL(...)
if errSQL != nil {
return nil, errors.Annotate(err, "failed to get pitr id map from mysql.tidb_pitr_id_map") // wraps stale `err` (nil)
}
Production reachability: medium — trigger is any failure of the mysql.tidb_pitr_id_map query during checksum-pitr (permissions drift, PD/TiKV unavailability, upgrade windows); the silent-skip branch additionally needs the filter to match no table. Consequence: silent skip of the PITR data-integrity check with exit 0.
4. What is your TiDB version? (Required)
Code-verified on pinned ca95cc55e1b and master 16c97eb67f9 (identical code); introduced by pingcap/tidb#64383 (2025-12-03); no upstream fix.
- Dominant language
- Go
- Stars
- 40.6k
- Forks
- 6.2k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 168
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pingcap/tidb
-
affects-9.0 found-by-ai may-affects-25.10 may-affects-26.3 may-affects-26.9 may-affects-7.5 may-affects-8.1 may-affects-8.5 severity/major sig/execution type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
affects-8.1 affects-8.5 component/statistics severity/moderate type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
affects-26.3 affects-9.0 component/ddl found-by-ai severity/major type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
contribution may-affects-25.10 may-affects-26.3 may-affects-26.9 may-affects-7.5 may-affects-8.1 may-affects-8.5 severity/major sig/execution type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
component/test severity/minor type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100