-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate entry error with @@auto_increment_increment and @@auto_increment_offset when using AUTO_ID_CACHE=1 #52622
Comments
In MySQL, when the value of auto_increment_offset is greater than that of auto_increment_increment, the value of auto_increment_offset is ignored. Ref https://dev.mysql.com/doc/refman/8.0/en/replication-options-source.html |
So the expect result above is
|
Cannot reproduce this issue on v7.1.3. Is it OK to do more investigation on it? |
Change from major to moderate because not so many users change the default system variable. |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
tiup playground --mode tikv-slim
./bin/tidb-server -store=tikv -path=127.0.0.1
set @@global.auto_increment_increment = 66;
set @@global.auto_increment_offset = 9527;
(exit the mysql client and login again to make the global variable take effect)
create table t (id int primary key auto_increment, k int) auto_id_cache = 1;
insert into t (k) values (1),(2),(3);
mysql> select * from t;
+------+------+
| id | k |
+------+------+
| 9527 | 1 |
| 9593 | 2 |
| 9659 | 3 |
+------+------+
3 rows in set (0.00 sec)
restart tidb
show create table and insert data again
show create table t;
mysql> insert into t (k) values (4);
ERROR 1062 (23000): Duplicate entry '9527' for key 't.PRIMARY'
2. What did you expect to see? (Required)
No duplicate entry error
3. What did you see instead (Required)
Duplicate entry
4. What is your TiDB version? (Required)
master
The text was updated successfully, but these errors were encountered: