【TiDB 版本】
4.x
【问题描述】
在id bigint unique key、 AUTO_INCREMENT、SHARD_ROW_ID_BITS的情况下,指定了一个较大的值:1377167639356443234 ,报错 ERROR 1467 (HY000): Failed to read auto-increment value from storage engine
但1377167639356443234并未超过bigint的取值范围,并且此现象出现之后不可修复。
CREATE TABLE `t1` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
unique KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin SHARD_ROW_ID_BITS=4
MySQL [test]> insert into t1 values();
Query OK, 1 row affected (1.71 sec)
MySQL [test]> insert into t1 values();
Query OK, 1 row affected (0.33 sec)
MySQL [test]> select * from t1;
+----+
| id |
+----+
| 1 |
| 3 |
+----+
2 rows in set (0.00 sec)
MySQL [test]> insert into t1 values(1377167639356443234);
ERROR 1467 (HY000): Failed to read auto-increment value from storage engine
MySQL [test]> insert into t1 values();
ERROR 1467 (HY000): Failed to read auto-increment value from storage engine
MySQL [test]> show create table t1\G
*************************** 1. row ***************************
Table: t1
Create Table: CREATE TABLE `t1` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=1377167639356473235/*!90000 SHARD_ROW_ID_BITS=4 */