diff --git a/br/pkg/lightning/restore/meta_manager.go b/br/pkg/lightning/restore/meta_manager.go index 659a33c579ef0..2d9875ad56960 100644 --- a/br/pkg/lightning/restore/meta_manager.go +++ b/br/pkg/lightning/restore/meta_manager.go @@ -1186,9 +1186,12 @@ func getGlobalAutoIDAlloc(store kv.Storage, dbID int64, tblInfo *model.TableInfo return nil, errors.New("internal error: dbID should not be 0") } - // We don't need the cache here because we allocate all IDs at once. - // The argument for CustomAutoIncCacheOption is the cache step. step 1 means no cache. - noCache := autoid.CustomAutoIncCacheOption(1) + // We don't need autoid cache here because we allocate all IDs at once. + // The argument for CustomAutoIncCacheOption is the cache step. Step 1 means no cache, + // but step 1 will enable an experimental feature, so we use step 2 here. + // + // See https://github.com/pingcap/tidb/issues/38442 for more details. + noCache := autoid.CustomAutoIncCacheOption(2) tblVer := autoid.AllocOptionTableInfoVersion(tblInfo.Version) hasRowID := common.TableHasAutoRowID(tblInfo) diff --git a/br/tests/lightning_exotic_filenames/data/xfn.etn-schema.sql b/br/tests/lightning_exotic_filenames/data/xfn.etn-schema.sql index e2d94bbdf8f32..d004fa92e0b64 100644 --- a/br/tests/lightning_exotic_filenames/data/xfn.etn-schema.sql +++ b/br/tests/lightning_exotic_filenames/data/xfn.etn-schema.sql @@ -1 +1 @@ -create table `exotic``table````name` (a varchar(6) primary key, b int unique auto_increment) auto_increment=80000; \ No newline at end of file +create table `exotic``table````name` (a varchar(6) primary key /*T![clustered_index] NONCLUSTERED */, b int unique auto_increment) auto_increment=80000; diff --git a/br/tests/lightning_exotic_filenames/data/zwk.zwb-schema.sql b/br/tests/lightning_exotic_filenames/data/zwk.zwb-schema.sql index 449584777c299..d9fae1aad0373 100644 --- a/br/tests/lightning_exotic_filenames/data/zwk.zwb-schema.sql +++ b/br/tests/lightning_exotic_filenames/data/zwk.zwb-schema.sql @@ -1 +1 @@ -create table 中文表(a int primary key); +create table 中文表(a int primary key /*T![clustered_index] NONCLUSTERED */); diff --git a/br/tests/lightning_shard_rowid/data/shard_rowid.shr-schema.sql b/br/tests/lightning_shard_rowid/data/shard_rowid.shr-schema.sql index 312b13c1c1118..d544b7fdb84c1 100644 --- a/br/tests/lightning_shard_rowid/data/shard_rowid.shr-schema.sql +++ b/br/tests/lightning_shard_rowid/data/shard_rowid.shr-schema.sql @@ -3,5 +3,5 @@ CREATE TABLE `test` ( `s1` char(10) NOT NULL, `s2` char(10) NOT NULL, `s3` char(10) DEFAULT NULL, - PRIMARY KEY (`s1`,`s2`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin/*!90000 SHARD_ROW_ID_BITS=3 PRE_SPLIT_REGIONS=3 */; \ No newline at end of file + PRIMARY KEY (`s1`,`s2`) /*T![clustered_index] NONCLUSTERED */ +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin/*!90000 SHARD_ROW_ID_BITS=3 PRE_SPLIT_REGIONS=3 */; diff --git a/br/tests/lightning_tidb_rowid/data/rowid.non_pk-schema.sql b/br/tests/lightning_tidb_rowid/data/rowid.non_pk-schema.sql index 5b5757644b6dd..52ee2729417a3 100644 --- a/br/tests/lightning_tidb_rowid/data/rowid.non_pk-schema.sql +++ b/br/tests/lightning_tidb_rowid/data/rowid.non_pk-schema.sql @@ -1 +1 @@ -create table non_pk (pk varchar(6) primary key); +create table non_pk (pk varchar(6) primary key /*T![clustered_index] NONCLUSTERED */); diff --git a/br/tests/lightning_tidb_rowid/data/rowid.non_pk_auto_inc-schema.sql b/br/tests/lightning_tidb_rowid/data/rowid.non_pk_auto_inc-schema.sql index a71be02c9e8f1..97aa81838b1bc 100644 --- a/br/tests/lightning_tidb_rowid/data/rowid.non_pk_auto_inc-schema.sql +++ b/br/tests/lightning_tidb_rowid/data/rowid.non_pk_auto_inc-schema.sql @@ -4,6 +4,6 @@ CREATE TABLE `non_pk_auto_inc` ( `pk` char(36) NOT NULL, `id` int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`pk`), + PRIMARY KEY (`pk`) /*T![clustered_index] NONCLUSTERED */, UNIQUE KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;