Open wjhuang2016 opened 2 weeks ago
In the full load, the value get from tikv is 0, while it should be 5000 Something must be wrong, maybe the value is not sync to tikv, or changed/removed later, I'll still not sure
Related to https://github.com/pingcap/tidb/issues/46904
This is caused by https://github.com/pingcap/tidb/pull/47892, after this commit, we keep using the old allocator after the rename operation.
tk.MustExec("create database rename1") // DB ID = 104
tk.MustExec("create database rename2") // DB ID = 106
tk.MustExec("create database rename3")
tk.MustExec("create table rename1.t (a int primary key auto_increment)") // table ID = 110
// Before this operation, rename1.t is dbID=104, tableID = 110
tk.MustExec("rename table rename1.t to rename2.t")
// After this operation, table info become dbID=106, tableID = 110
// **But the allocator is still dbID=104, tableID=110**
tk.MustExec("drop database rename1") // clear all data for dbID=104
tk.MustExec("insert rename2.t values ()") // id allocator is dbID=104, tableID=110, and the meta data for dbID=104 is clear
This is a 'rename table & autoid' compatibility issue.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
Create a function to force full load:
Then add these code to TestRenameTable
before
Then enable info schema cache by set
DefTiDBSchemaCacheSize
to 1002. What did you expect to see? (Required)
Test pass
3. What did you see instead (Required)
Duplicate entry '1' for key 't.PRIMARY' reported by
insert rename2.t values ()
4. What is your TiDB version? (Required)
master