Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-20939

Race condition between mysqldump import and InnoDB persistent statistics calculation

    XMLWordPrintable

Details

    Description

      mysqldump ignores some internal tables by default, such as:

      • mysql.apply_status
      • mysql.schema
      • mysql.general_log
      • mysql.slow_log
      • mysql.transaction_registry

      See here:

      https://github.com/MariaDB/server/blob/mariadb-10.4.8/client/mysqldump.c#L1001

      I think the following tables should also be ignored by default:

      • mysql.innodb_index_stats
      • mysql.innodb_table_stats

      The reason is that if someone tries to import a dump created by mysqldump, then a race condition between the import and the InnoDB persistent statistics calculation exists, and the user can see errors like this:

      Duplicate 'PRIMARY-n_diff_pfx01' for key 'primary' for database 'xxxx98'.
      

      This was reported long ago in the following upstream bug report:

      https://bugs.mysql.com/bug.php?id=71814

      The workaround mentioned in that bug report is to disable InnoDB persistent statistics prior to the import:

      SET GLOBAL innodb_stats_auto_recalc=0;
      SET GLOBAL innodb_stats_persistent=0;
      

      However, it would be more ideal to make this workaround unnecessary by fixing the problem.

      Attachments

        Issue Links

          Activity

            People

              rucha174 Rucha Deodhar
              GeoffMontee Geoff Montee (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.