ANALYZE TABLE is not replicated

Bug #1375234 reported by Philip Stoev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL patches by Codership
Status tracked in 5.6
5.6
Confirmed
Undecided
Unassigned

Bug Description

ANALYZE TABLE is not replicated, as it would be in MySQL replication. MySQL defines ANALYZE TABLE NO_WRITE_TO_BINLOG for situations where one would want to prevent replication.

The wsrep_last_committed does not advance and the mysql.innodb_index_stats does not change.

Test case:

--source include/galera_cluster.inc
--source include/have_innodb.inc

--let $innodb_stats_auto_recalc_orig = `SELECT @@innodb_stats_auto_recalc`
SET GLOBAL innodb_stats_auto_recalc=0;

CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);

CREATE TABLE stat_t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER , KEY (f2)) ENGINE=InnoDB;

--connection node_2
# Access the table once so that the stat calculation on open is performed
SET GLOBAL innodb_stats_auto_recalc=0;
SELECT COUNT(*) = 0 FROM stat_t1;

--connection node_1
INSERT INTO stat_t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;

--connection node_2
# Empty stats expected
SELECT stat_value FROM mysql.innodb_index_stats WHERE table_name = 'stat_t1' AND index_name = 'f2' AND stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size');
SHOW STATUS LIKE 'wsrep_last_committed';

--connection node_1
ANALYZE TABLE stat_t1;
SELECT stat_value FROM mysql.innodb_index_stats WHERE table_name = 'stat_t1' AND index_name = 'f2' AND stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size');

--connection node_2
# Stats should now be populated
SHOW STATUS LIKE 'wsrep_last_committed';
SELECT stat_value FROM mysql.innodb_index_stats WHERE table_name = 'stat_t1' AND index_name = 'f2' AND stat_name IN ('n_diff_pfx01', 'n_diff_pfx02', 'n_leaf_pages', 'size');

--connection node_2
--eval SET GLOBAL innodb_stats_auto_recalc = $innodb_stats_auto_recalc_orig;

--connection node_1
--eval SET GLOBAL innodb_stats_auto_recalc = $innodb_stats_auto_recalc_orig;
DROP TABLE stat_t2;
DROP TABLE stat_t1;
DROP TABLE ten;

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.