rm -rf 88633 bin/mysqld --initialize-insecure --basedir=$PWD --datadir=$PWD/88633 bin/mysqld --no-defaults --auto_increment_increment=10 --auto_increment_offset=1 --innodb_autoinc_lock_mode=2 --basedir=$PWD --datadir=$PWD/88633 --core-file --socket=/tmp/mysql_ushastry.sock --port=3307 --log-error=$PWD/88633/log.err 2>&1 & ## Session 1 rm -rf 88633 scripts/mysql_install_db --basedir=$PWD --datadir=$PWD/88633 bin/mysqld --no-defaults --auto_increment_increment=10 --auto_increment_offset=1 --innodb_autoinc_lock_mode=2 --basedir=$PWD --datadir=$PWD/88633 --core-file --socket=/tmp/mysql_ushastry.sock --port=3307 --log-error=$PWD/88633/log.err 2>&1 & [umshastr@hod03]/export/umesh/server/binaries/GABuilds/mysql-5.7.20: bin/mysql -uroot -S /tmp/mysql_ushastry.sock Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.20 MySQL Community Server (GPL) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> SHOW VARIABLES LIKE 'auto_inc%'; +--------------------------+-------+ | Variable_name | Value | +--------------------------+-------+ | auto_increment_increment | 10 | | auto_increment_offset | 1 | +--------------------------+-------+ 2 rows in set (0.01 sec) mysql> create database test; Query OK, 1 row affected (0.00 sec) mysql> use test Database changed mysql> CREATE TABLE `foo` ( -> `id` int(11) NOT NULL AUTO_INCREMENT, -> `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -> PRIMARY KEY (`id`) -> ) ENGINE=InnoDB; Query OK, 0 rows affected (0.00 sec) ## Initiate insert in Session 2, then continue running SET...in session 1 mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) ## Session 2 [umshastr@hod03]/export/umesh/server/binaries/GABuilds/mysql-5.7.20: while true; do bin/mysql -uroot -S /tmp/mysql_ushastry.sock -e "insert into test.foo values ()"; sleep 1; done ERROR 1062 (23000) at line 1: Duplicate entry '40' for key 'PRIMARY' ERROR 1062 (23000) at line 1: Duplicate entry '41' for key 'PRIMARY' ERROR 1062 (23000) at line 1: Duplicate entry '48' for key 'PRIMARY' ERROR 1062 (23000) at line 1: Duplicate entry '51' for key 'PRIMARY' ERROR 1062 (23000) at line 1: Duplicate entry '56' for key 'PRIMARY' ERROR 1062 (23000) at line 1: Duplicate entry '61' for key 'PRIMARY' ERROR 1062 (23000) at line 1: Duplicate entry '64' for key 'PRIMARY' ERROR 1062 (23000) at line 1: Duplicate entry '71' for key 'PRIMARY' ERROR 1062 (23000) at line 1: Duplicate entry '72' for key 'PRIMARY' ^C ########## With same steps, even after running long enough I'm not seeing the issue on 5.6.38 which was easier to hit on 5.7.20 umshastr@hod03]/export/umesh/server/binaries/GABuilds/mysql-5.6.38: bin/mysql -uroot -S /tmp/mysql_ushastry.sock Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.6.38 MySQL Community Server (GPL) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> use test Database changed mysql> CREATE TABLE `foo` ( -> `id` int(11) NOT NULL AUTO_INCREMENT, -> `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -> PRIMARY KEY (`id`) -> ) ENGINE=InnoDB; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> select max(id) from test.foo; +---------+ | max(id) | +---------+ | 343 | +---------+ 1 row in set (0.00 sec) mysql> select max(id) from test.foo; +---------+ | max(id) | +---------+ | 345 | +---------+ 1 row in set (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> select max(id) from test.foo; +---------+ | max(id) | +---------+ | 367 | +---------+ 1 row in set (0.00 sec) mysql> select max(id) from test.foo; +---------+ | max(id) | +---------+ | 397 | +---------+ 1 row in set (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.01 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql> set global auto_increment_increment=1; Query OK, 0 rows affected (0.00 sec) mysql>