Bug #71814 | persistent stats activity conflicts with mysqldump import of same info. | ||
---|---|---|---|
Submitted: | 24 Feb 2014 7:18 | Modified: | 2 Mar 2016 3:45 |
Reporter: | Ramiro Cavalcanti | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: mysqldump Command-line Client | Severity: | S3 (Non-critical) |
Version: | 5.6.10, 5.6.16 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[24 Feb 2014 7:18]
Ramiro Cavalcanti
[24 Feb 2014 7:29]
Ramiro Cavalcanti
mysql -u root -S /tmp/mysql_agoraos.sock < all_novo.sql ERROR 1062 (23000) at line 2870584: Duplicate entry 'agoraosdb_db98-equipamento-PRIMARY-n_diff_pfx01' for key 'PRIMARY'
[24 Feb 2014 7:43]
Ramiro Cavalcanti
Another thing is. Everytime i run this dump, it shows the same error for this database number 98, but in a different table of it. Line 2870584 is: INSERT INTO `innodb_index_stats` VALUES ('agoraosdb_db89','finan_classificacao','PRIMARY','2013-05-06 00:47:13','n_diff_pfx01',4,1,'id'),('agoraosdb_db89','finan_classificacao','PRIMARY','2013-05-06 00:47:13','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),('agoraosdb_db89','finan_classificacao','PRIMARY','2013-05-06 00:47:13','size',1,NULL,'Number of pages in the index'),('agoraosdb_db89','finan_classificacao','thread_class_gerencial','2013-05-06 00:47:13','n_diff_pfx01',1,1,'thread_class_gerencial'),('agoraosdb_db89','finan_classificacao','thread_class_gerencial','2013-05-06 00:47:13','n_diff_pfx02',4,1,'thread_class_gerencial,id'),('agoraosdb_db89','finan_classificacao','thread_class_gerencial','2013-05-06 00:47:13','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),('agoraosdb_db89','finan_classificacao','thread_class_gerencial','2013-05-06 00:47:13','size',1,NULL,'Number of pages in the index'),('agoraosdb_db89','finan_classificacao','thread_grupo_finan','2013-05-06 00:47:13','n_diff_pfx01',2,1,'thread_grupo_finan')... and it goes.
[24 Feb 2014 18:46]
Ramiro Cavalcanti
I have DROPped database 'agoraosdb_db98' from Master. Then, made mysqldump again and tried to import. And, guess what. Warning: Using a password on the command line interface can be insecure. ERROR 1062 (23000) at line 12449729: Duplicate entry 'agoraosdb_db93-usuario_email-PRIMARY-n_diff_pfx01' for key 'PRIMARY' Now it shows error at 'agoraosdb_db93', that was fine before. Im getting crazy with this.
[24 Feb 2014 23:29]
Ramiro Cavalcanti
Another news. I get the dump that mysql says that has erros and made this and split it in 3 different files. Each file with it's own headers and bottom (to disable foregin, etc... from the original dump). 3 Files: 1. Has all my databases, with routines and events (363 total) 2. Has all views for my databases (363 total * 3 views) 3. Has 'mysql' database. --- Im imported following the sequence above. 1. No errors reported (all my databases were imported) 2. No errors reported (all my views were imported) 3. No errors reported ('mysql' database, users permissons, etc were imported). So, can anyone explain me why is this happing? If i try to import all this 3 steps together, step 3 fails (the original dump file).
[22 Jul 2014 22:08]
Sveta Smirnova
Thank you for the report. Most likely this is not a bug, but either issue with network connection to EC machine (if you run client locally) or small (for your data) max_allowed_packet. To consider this as a bug in MySQL code we need repeatable test case: dump which causes wrong behavior and MySQL server options from the EC machine.
[25 Jul 2014 10:48]
MySQL Verification Team
I will verify this. The problem happens in this scenario for me: Persistent innodb statistics are on, and the autorecalc thread available (by default) o) there is existing select workload running on server. o) i'm importing a mysqldump of all databases. The problem is a "race condition" between the importing of mysql database and the background innodb stats thread. Dumpfile has : DROP TABLE IF EXISTS `innodb_index_stats`; .. CREATE TABLE `innodb_index_stats` ( ... LOCK TABLES `innodb_index_stats` WRITE; ... INSERT INTO `innodb_index_stats` VALUES ( On a busy server, persistent or background stats thread can insert rows between the CREATE and LOCK TABLE of the dump!! Another likely way to hit this is if user did mysqldump with --skip-lock-tables. As a workaround, you can first disable this stats before importing: SET GLOBAL innodb_stats_auto_recalc=0; SET GLOBAL innodb_stats_persistent=0; Personally, I don't like that mysqldump dumps the content of these tables that should be auto-generated.
[25 Jul 2014 10:53]
MySQL Verification Team
.
Attachment: bug71814_some_infos.txt (text/plain), 1.69 KiB.
[2 Mar 2016 3:45]
Ramiro Cavalcanti
Hi Shane Bester, you were correct. I've made the workaround you suggested and it worked. Since the report on 2014, i've doing mysqldump for all databases and individual dumps also. Now i know how to restore the all databases dump when this erro occurs. Thanks!