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

ANALYZE TABLE is replicated without use_stat_tables

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.4(EOL), 10.5(EOL), 10.6, 10.11
    • None
    • Replication
    • None

    Description

      ANALYZE TABLE statement may or may not collect EITS statistics, depending
      on the use_stat_tables setting.

      It is replicated as statement, that is, the ANALYZE TABLE statement itself is written into the binary log.
      If ANALYZE TABLE makes changes to mysql.column|table|index_stat tables, these are not caught by RBR and are not written into the binary log.

      That is, we rely on ANALYZE TABLE to be executed on the slave in the same way as it was executed on the master.
      But the value of use_stat_tables is not captured and not logged, so ANALYZE TABLE on the slave might not collect EITS when the master did, and vice versa.

      Put the attached testcase into e.g. mysql-test/suite/rpl/t/rpl_a1.test and look into its output:

      # EITS STATS ON MASTER:
      select * from mysql.table_stats;
      db_name table_name      cardinality
      connection slave;
      

      no stats on master, but

      # EITS STATS ON SLAVE:
      select * from mysql.table_stats;
      db_name table_name      cardinality
      test    t1      3
      

      there are stats on the slave.
      One can construct cases where it's other way around, too.

      Attachments

        Activity

          People

            Unassigned Unassigned
            psergei Sergei Petrunia
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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