Closed ChenPeng2013 closed 1 year ago
@TonsnakeLin @zyguan It's a release test failure, please take a look if it's a correnctness issue.
we can simplify the reproducing as follow: use test; source test.txt set tidb_txn_assertion_level=strict; / test / / t04:047 / begin; / test / / t04:052 / delete t1, t2 from t1, t2 where t1.c_enum in ('blue', 'yellow', 'purple'); commit;
after sending pessimsitic lock request for delete operation, the mvcc data is bellow:
when committing the trans, the error happened.
Reproduce step:
source test.txt;
set tidb_txn_assertion_level=strict;
begin;
delete t1, t2 from t1, t2 where t1.c_enum in ('blue');
commit; // assertion failure, the to-be-deleted index key could not be found.
The error is reported because the to-be-delete index key is generated incorrectly for table t2
on the secondary index c_datetime
.
The row to be deleted is
c_int | c_str | c_datetime | c_timestamp | c_double | c_decimal | c_enum
12 | 0x6578636974696E6720626F7964 | NULL | 2020-03-29 02:27:23 | NULL | 9.249000 | blue
The value of c_datetime
is NULL
. However, the generated index key is
/mok 7480000000000000da5f6980000000000000040419a5a6aa7000000003800000000000000c016578636974696e67ff20626f7964000000fc
"7480000000000000da5f6980000000000000040419a5a6aa7000000003800000000000000c016578636974696e67ff20626f7964000000fc"
└─## decode hex key
└─"t\200\000\000\000\000\000\000\332_i\200\000\000\000\000\000\000\004\004\031\245\246\252p\000\000\000\003\200\000\000\000\000\000\000\014\001exciting\377 boyd\000\000\000\374"
├─## table prefix
│ └─table: 218
└─## table index key
├─table: 218
├─index: 4
└─"\004\031\245\246\252p\000\000\000\003\200\000\000\000\000\000\000\014\001exciting\377 boyd\000\000\000\374"
└─## decode index values
├─kind: Uint64, value: 1848066473059155968 // Incorrect value here.
├─kind: Int64, value: 12
└─kind: Bytes, value: exciting boyd
The incorrect value is wrongly referenced from the table t1
with handle value 18.
In deleteMultiTablesByChunk
the input value tblRowMap
for the removeRowsInTblRowMap
seems to have incorrect row values. After reverting the https://github.com/pingcap/tidb/pull/39489 change, the generated index key is correct and no assertion failure is reported.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
3. What did you see instead (Required)
4. What is your TiDB version? (Required)