I used percona server 5.7 as my database on AWS. The problem is there's sometimes rows disappear mysteriously without a clue. My Backend using Node.JS already got inserted id from auto increment but after that, that rows is disappear without a trace. This happened only sometimes but happened everyday. What should I do to start diagnosis the problems?
More info: There's sometimes my auto increment is skipped like from 1000 to 1004 without anyone delete it from phpmyadmin or in my script since it's "user" table. At time registered time between 1000 to 1004, there's no error log at all from mysql and nodejs. However at this time MySQL experience some table Locked issues for unknown reason and sometimes make insert statement to be queued event I do not make alter table or any table level change at all.
Did you use MySQL transaction,
AUTO_INCREMENT
, and InnoDB/XtraDB?Did your Node.js MySQL driver uses implicit transaction?
If so, you probably got hit by InnoDB
AUTO_INCREMENT
sequence gap. You can see the docs here, but in short,If you're that paranoid about deleted rows, use
general_log
MySQL config parameter to generate query logs, and then check your query log against your missing rows. Note that query logs could be huge, and there will be performance impact.