Wrong value of auto_increment after pause and resume for a tidb cloud cluster #46305
Labels
affects-6.5
affects-7.1
affects-7.5
duplicate
Issues or pull requests already exists.
type/bug
The issue is confirmed as a bug.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
create a table with auto_increment pk
create table t (id int auto_increment primary key, txt varchar(25)) auto_id_cache=1;
insert into t(txt) values('aaa');
mysql> show table t next_row_id;
+---------+------------+-------------+--------------------+----------------+
| DB_NAME | TABLE_NAME | COLUMN_NAME | NEXT_GLOBAL_ROW_ID | ID_TYPE |
+---------+------------+-------------+--------------------+----------------+
| br_test | t | id | 1 | _TIDB_ROWID |
| br_test | t | id | 2 | AUTO_INCREMENT |
+---------+------------+-------------+--------------------+----------------+
2 rows in set (0.18 sec)
after pause& resume
mysql> show table t next_row_id;
+----------+---------------+-------------+--------------------+----------------+
| DB_NAME | TABLE_NAME | COLUMN_NAME | NEXT_GLOBAL_ROW_ID | ID_TYPE |
+----------+---------------+-------------+--------------------+----------------+
| br_test | t | _tidb_rowid | 1 | _TIDB_ROWID |
| br_test | t | _tidb_rowid | 1 | AUTO_INCREMENT |<< wrong value
+----------+---------------+-------------+--------------------+----------------+
2 rows in set (0.20 sec)
insert data
mysql> insert into t(txt) values('aaa');
Query OK, 1 row affected (0.19 sec)
mysql> show table t next_row_id;
+----------+---------------+-------------+--------------------+----------------+
| DB_NAME | TABLE_NAME | COLUMN_NAME | NEXT_GLOBAL_ROW_ID | ID_TYPE |
+----------+---------------+-------------+--------------------+----------------+
| br_test | t | _tidb_rowid | 1 | _TIDB_ROWID |
| br_test | t | _tidb_rowid | 3 | AUTO_INCREMENT |<< correct value
+----------+---------------+-------------+--------------------+----------------+
2 rows in set (0.17 sec)
2. What did you expect to see? (Required)
At step 2, show AUTO_INCREMENT as the correct value which is 2.
3. What did you see instead (Required)
1 was shown at step2.
4. What is your TiDB version? (Required)
v7.1.1
The text was updated successfully, but these errors were encountered: