You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SELECTCOUNT(*) FROMinformation_schema.tikv_region_peers; -- 269
EXPLAIN FORMAT='brief'SELECT*FROMinformation_schema.tikv_region_peersWHERE region_id =-1; -- MemTableScan without Selection and without region_ids filterSELECTCOUNT(*) FROMinformation_schema.tikv_region_peersWHERE region_id =-1; -- 269SELECTCOUNT(*) FROMinformation_schema.tikv_region_peersWHERE CASE WHEN region_id =-1 THEN TRUE ELSE FALSE END; -- 0SELECT region_id, store_id, peer_id, region_id =-1AS predicate_value FROMinformation_schema.tikv_region_peersWHERE region_id =-1LIMIT5; -- predicate_value=0 on returned rowsSELECTCOUNT(*) FROMinformation_schema.tikv_region_peersWHERE store_id =-1; -- 269SELECTCOUNT(*) FROMinformation_schema.tikv_region_peersWHERE CASE WHEN store_id =-1 THEN TRUE ELSE FALSE END; -- 0
2. What did you expect to see? (Required)
A negative region_id/store_id predicate is unsatisfiable for TiKV peer metadata and should return an empty rowset. Invalid or out-of-domain extracted IDs must not bypass the SQL predicate; backend lookup errors for impossible filters should not replace SQL empty-row semantics.
3. What did you see instead? (Required)
The extractor removes the SQL predicate, fails to build a valid uint64 ID filter, and scans all peers. region_id=-1 and store_id=-1 return every row in information_schema.tikv_region_peers; rows visibly fail their own predicate. Non-numeric strings can additionally be coerced to region_ids:[0] and reported as a PD 400 error.
4. What is your TiDB version? (Required)
Confirmed on QA testbed 8192975. SELECT VERSION() returned 8.0.11-TiDB-v8.4.0-this-is-a-placeholder.
Likely root cause and fix direction
extractCol removes EQ/IN predicates once it recognizes region_id/store_id. TikvRegionPeersExtractor then calls parseUint64 on the extracted string set. parseUint64 silently ignores ParseUint failures such as "-1" and returns an empty slice, but the original predicate has already been dropped and SkipRequest is not set. The resulting MemTableScan has neither a Selection nor a region/store ID filter, so it returns all peers.
Bug Report
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
A negative region_id/store_id predicate is unsatisfiable for TiKV peer metadata and should return an empty rowset. Invalid or out-of-domain extracted IDs must not bypass the SQL predicate; backend lookup errors for impossible filters should not replace SQL empty-row semantics.
3. What did you see instead? (Required)
The extractor removes the SQL predicate, fails to build a valid uint64 ID filter, and scans all peers. region_id=-1 and store_id=-1 return every row in information_schema.tikv_region_peers; rows visibly fail their own predicate. Non-numeric strings can additionally be coerced to region_ids:[0] and reported as a PD 400 error.
4. What is your TiDB version? (Required)
Confirmed on QA testbed 8192975.
SELECT VERSION()returned8.0.11-TiDB-v8.4.0-this-is-a-placeholder.Likely root cause and fix direction
extractCol removes EQ/IN predicates once it recognizes region_id/store_id. TikvRegionPeersExtractor then calls parseUint64 on the extracted string set. parseUint64 silently ignores ParseUint failures such as "-1" and returns an empty slice, but the original predicate has already been dropped and SkipRequest is not set. The resulting MemTableScan has neither a Selection nor a region/store ID filter, so it returns all peers.