Bug #108229 | Exists gaps when add a auto_increment column | ||
---|---|---|---|
Submitted: | 23 Aug 2022 3:41 | Modified: | 24 Aug 2022 1:45 |
Reporter: | Fengchun Hua | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Row Based Replication ( RBR ) | Severity: | S3 (Non-critical) |
Version: | 5.7.32 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[23 Aug 2022 3:41]
Fengchun Hua
[23 Aug 2022 12:53]
MySQL Verification Team
Hi Mr. Hua, Thank you for your bug report. However, it is not a bug. Let us quote our manual for 5.7: " In this mode, “bulk inserts” use the special AUTO-INC table-level lock and hold it until the end of the statement. This applies to all INSERT ... SELECT, REPLACE ... SELECT, and LOAD DATA statements. Only one statement holding the AUTO-INC lock can execute at a time. " Hence, if you load data with more then one statement in the dump file, then gaps are an expected behaviour. Not a bug.
[24 Aug 2022 1:45]
Fengchun Hua
Thanks for reply. But I'm not loading data from a dump file, but altering table to add a aaotu_increment column. This alter table is a single statement, gaps should not exists. Will mysql splite `alter tabel add column` to multi-statement?
[24 Aug 2022 11:37]
MySQL Verification Team
Hi Mr. Hua, What you describe is quite possible. Particularly if the ALTER operation was set to INSTANT with no locks. As our Reference Manual clearly states, for auto-increment keys it is best to use COPY algorithm.