Bug #37399 auto_increment value gets out of sync on master and slave

Submitted: 13 Jun 2008 16:07 Modified: 4 Mar 2009 8:06
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Row Based Replication ( RBR ) Severity:S3 (Non-critical)
Version:5.1.26, 6.0 OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[13 Jun 2008 16:07] Shane Bester
Description:
when inserting and deleting rows from an innodb table with auto_increment defined, the slave and master differ in what they believe the auto_increment value is in show table status.  after restarting the slave, the figure is correct, presumably because innodb recalculated it.

How to repeat:
have a running RBR replication with default options.
master:

mysqld --log-bin --binlog-format=row --server-id=1

make sure the slave is running and connected.

run this on master:

drop table if exists at;
create table at(a int not null auto_increment primary key,b text)engine=innodb;
insert into at (b) values ('a'),('b'),('c');
delete from at limit 1;
insert into at (b) values ('a'),('b'),('c');
show table status like 'at';

now compare 'show table status like 'at'; from master and slave and notice the value of column Auto_increment
[13 Jun 2008 16:08] Shane Bester
my (cutted) output:

on master i got:
mysql> show table status like 'at'\G
           Name: at
         Engine: InnoDB
           Rows: 5
 Auto_increment: 7  <--
1 row in set (0.02 sec)

on slave i got:

mysql> show table status like 'at'\G
           Name: at
         Engine: InnoDB
           Rows: 5
 Auto_increment: 4 <--
1 row in set (0.00 sec)
[16 Jun 2008 18:08] Sveta Smirnova
Thank you for the report.

Verified as described.
[16 Jun 2008 18:11] Sveta Smirnova
Workaround >1, because bug is not repeatable with mixed mode or MyISAM storage engine.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.060 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.