Repository navigation
Open
Description
Consolidated tracking scope
Preserve both the table-level AUTO_INCREMENT seed and the live next-value counter across DDL display and dump/restore. The linked reports are retained as separate reproductions where they exercise different code paths. Closing a linked issue is an administrative consolidation only; no fix is claimed here.
Acceptance criteria
- SHOW CREATE TABLE and mo-dump output include the effective AUTO_INCREMENT state when it exceeds the stored maximum ID.
- Cover both a seed declared at CREATE TABLE and a counter advanced with ALTER TABLE.
- After restore, the next generated ID matches the source allocation state and does not reuse reserved IDs.
Included reports
- #30556 — original report and discussion remain on that issue.
Original canonical report (preserved verbatim)
Is there an existing issue for the same bug?
- I have checked the existing issues.
Branch Name
main
Commit ID
b24d1b3 (2026-10-16)
Other Environment Information
- Hardware: macOS arm64 (Apple Silicon)
- Topology: single-node standalone
- OS: macOS
Actual Behavior
The table-level AUTO_INCREMENT = <N> seed is silently dropped from the persisted DDL: SHOW CREATE TABLE does not display it and mo-dump does not emit it, so a dump→restore round-trip silently loses the table's insert-id semantics (the restored table restarts numbering from 1 instead of after the seed/max).
Reproduced 3/3 on fresh databases:
create table sd.t (id int primary key auto_increment, v int) auto_increment=777;
insert into sd.t (v) values (1);
select * from sd.t; -- id = 777 (the seed WORKS at runtime)
show create table sd.t;
-- CREATE TABLE `t` (
-- `id` int NOT NULL AUTO_INCREMENT, <- column attribute kept
-- ...
-- ) <- NO table-level AUTO_INCREMENT=777- mo-dump output for the same table also contains
AUTO_INCREMENTonly as the column attribute; the table option is absent, so piping the dump into any target (rebuild/migration/DR) produces a table whose numbering starts at 1. - MySQL behavior for comparison:
SHOW CREATE TABLEdisplaysAUTO_INCREMENT=777as a table option (and updates it live to max+1), and mysqldump preserves it.
Expected Behavior
SHOW CREATE TABLEshould include the current table-level auto-increment position (at minimum the declared seed when untouched; MySQL additionally tracks the live counter).- mo-dump should preserve the seed in its CREATE TABLE output so that backup/restore/migration reproduces identical id allocation.
Steps to Reproduce
create database sdd; create table sdd.t (id int primary key auto_increment, v int) auto_increment=777;insert into sdd.t (v) values (1);→ row id = 777 (runtime honors seed)show create table sdd.t;→ noAUTO_INCREMENT=777table optionmo-dump ... -db sdd→ dump file's CREATE TABLE also lacks the seed- Restore the dump into a fresh database → first insert gets id 1, not 778
Additional information
- The runtime counter itself is correctly advanced by inserts (subsequent inserts continue from 777/778+), so the defect is specifically the DDL/catalog visibility of the seed value, which is what dump and SHOW rely on.
- This joins the mo-dump fidelity family: sequence DDL missing entirely ([Bug]: mo-dump full-database export must handle user sequences and built-in catalog relations #30577), and now auto-increment seed semantics; together they mean dump/restore cannot reproduce exact id-allocation behavior for any schema.
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't working
Activity
[-][Bug]: Table-level AUTO_INCREMENT=<seed> is silently dropped from SHOW CREATE TABLE and mo-dump output — dump/restore loses id-allocation semantics (restored tables restart from 1)[/-][+][Bug]: SHOW CREATE TABLE and mo-dump must preserve AUTO_INCREMENT allocation state[/+]