mysql restart the service, an auto-increment id is auto_increment column will be reset to the current maximum value plus 1

Production events: real-time data to migrate historical data appear abnormal repeat increment primary keys

The reason: real-time service part have to delete the recording operation, subsequent batches will run real-time data to migrate historical database table, because the abnormal mysql service is down, restart mysql service, due to auto-increment auto_increment column will be reset to the current maximum value plus 1 , just have business operations delete and delete the migration of things terminal causing loss of records, and then create a primary key repeat

Note: Migrating to the case history database, machine downtime and service outages caused by auto-increment primary keys to reset to consider

Guess you like

Origin blog.csdn.net/u010720408/article/details/93847569