memdb: snapshot getter and iter returns latest data instead #54929
Labels
affects-4.0
This bug affects 4.0.x versions.
affects-5.0
This bug affects 5.0.x versions.
affects-5.1
This bug affects 5.1.x versions.
affects-5.2
This bug affects 5.2.x versions.
affects-5.3
This bug affects 5.3.x versions.
affects-5.4
This bug affects the 5.4.x(LTS) versions.
affects-6.0
affects-6.1
This bug affects the 6.1.x(LTS) versions.
affects-6.2
affects-6.3
affects-6.4
affects-6.5
This bug affects the 6.5.x(LTS) versions.
affects-6.6
affects-7.0
affects-7.1
This bug affects the 7.1.x(LTS) versions.
affects-7.2
affects-7.3
affects-7.4
affects-7.5
This bug affects the 7.5.x(LTS) versions.
affects-7.6
affects-8.0
affects-8.1
This bug affects the 8.1.x(LTS) versions.
affects-8.2
affects-8.3
severity/major
sig/transaction
SIG:Transaction
type/bug
The issue is confirmed as a bug.
Bug Report
Please answer these questions before submitting your issue. Thanks!
See also tikv/client-go#1394
The snapshot getter and iter of memdb should read bypass the staging data(like the written data from current statement, it's not released yet). But the current snapshot read the latest data instead, see the unit test in client-go's PR.
The affected code:
tidb/pkg/executor/union_scan.go
Line 113 in cdd7c9e
tidb/pkg/executor/mem_reader.go
Lines 578 to 582 in 7e73ddc
The actual impact on TiDB will be attached once there is a reproduce.
1. Minimal reproduce step (Required)
The insert on duplicate key statement will update it to (0, 100), (1, 99), ... (100, 0)
2. What did you expect to see? (Required)
Without
begin
andcommit
,select a, b from t where a + b != 100
returns empty result set.The above in-txn case should keep the same behavior.
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
The text was updated successfully, but these errors were encountered: