Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Cannot Reproduce
-
10.3.17
Description
After a direct upgrade from 10.1.40 to 10.3.17, SHOW CREATE TABLE output in mysqldump shows correct AUTO_INCREMENT counter values on the first two tables, but then flips to
Before the upgrade:
ENGINE=InnoDB AUTO_INCREMENT=2284
|
ENGINE=InnoDB AUTO_INCREMENT=4763
|
ENGINE=InnoDB AUTO_INCREMENT=1621982
|
ENGINE=InnoDB AUTO_INCREMENT=3
|
ENGINE=InnoDB AUTO_INCREMENT=1395246
|
ENGINE=InnoDB AUTO_INCREMENT=927
|
...
|
becomes this after upgrade:
ENGINE=InnoDB AUTO_INCREMENT=2284
|
ENGINE=InnoDB AUTO_INCREMENT=4763
|
ENGINE=InnoDB AUTO_INCREMENT=4784423209
|
ENGINE=InnoDB AUTO_INCREMENT=4784423220
|
ENGINE=InnoDB AUTO_INCREMENT=4784423231
|
ENGINE=InnoDB AUTO_INCREMENT=4784423242
|
...
|
Note how starting with the third auto-inrement table the counter becomes way higher then originally, and then gets incremented by 11 for each following table.
Attachments
Issue Links
- is part of
-
MDEV-22357 Clearing InnoDB autoincrement counter when upgrading from MariaDB < 10.2.4
-
- Open
-
- relates to
-
MDEV-6076 Persistent AUTO_INCREMENT for InnoDB
-
- Closed
-
-
MDEV-22167 auto_increment counters changed weirdly after direct 10.1 -> 10.3 upgrade
-
- Closed
-
hholzgra, I think that this should affect an upgrade to 10.2 already, due to
MDEV-6076.I think that the plausible explanation is that the PAGE_MAX_AUTOINC field in some clustered index root pages was not 0, but garbage, before the upgrade.
MDEV-6076repurposed the field PAGE_MAX_TRX_ID, which was previously only used on secondary index leaf pages. Before a bug fix in MySQL 5.1.48, InnoDB could write garbage to unused data fields; since then, such fields are always written as 0.It should be possible to reset the AUTO_INCREMENT value by a statement like this:
This should reset the counter to a value that is not smaller than the current maximum in the table.
I will try to double-check if the PAGE_MAX_TRX_ID was always zero-initialized. I seem to remember that I concluded during
MDEV-6076development that it is the case.