diff --git a/mysql-test/suite/galera/r/galera_flush.result b/mysql-test/suite/galera/r/galera_flush.result index 5f15bee14a8..620ad1ccb67 100644 --- a/mysql-test/suite/galera/r/galera_flush.result +++ b/mysql-test/suite/galera/r/galera_flush.result @@ -1,3 +1,4 @@ +DROP TABLE IF EXISTS t1, t2; FLUSH DES_KEY_FILE; wsrep_last_committed_diff 1 @@ -26,6 +27,37 @@ CREATE TABLE t2 (f1 INTEGER); FLUSH TABLES t2; wsrep_last_committed_diff 1 +FLUSH ERROR LOGS; +wsrep_last_committed_diff +1 +FLUSH SLOW LOGS; +wsrep_last_committed_diff +1 +FLUSH GENERAL LOGS; +wsrep_last_committed_diff +1 +FLUSH ENGINE LOGS; +wsrep_last_committed_diff +1 +FLUSH RELAY LOGS; +wsrep_last_committed_diff +1 +SET @userstat_old= @@userstat; +SET GLOBAL userstat=ON; +FLUSH CLIENT_STATISTICS; +FLUSH INDEX_STATISTICS; +FLUSH TABLE_STATISTICS; +FLUSH USER_STATISTICS; +wsrep_last_committed_diff +1 +SET @old_thread_statistics= @@global.thread_statistics; +SET GLOBAL thread_statistics= ON; +FLUSH THREAD_STATISTICS; +wsrep_last_committed_diff +1 +FLUSH CHANGED_PAGE_BITMAPS; +wsrep_last_committed_diff +1 CREATE TABLE t1 (f1 INTEGER); FLUSH LOGS; FLUSH TABLES WITH READ LOCK; @@ -52,3 +84,5 @@ wsrep_last_committed_diff 1 DROP TABLE t1; DROP TABLE t2; +SET GLOBAL userstat= @userstat_old; +SET GLOBAL thread_statistics= @old_thread_statistics; diff --git a/mysql-test/suite/galera/t/galera_flush.test b/mysql-test/suite/galera/t/galera_flush.test index b773af03592..2a0fdc694fc 100644 --- a/mysql-test/suite/galera/t/galera_flush.test +++ b/mysql-test/suite/galera/t/galera_flush.test @@ -7,6 +7,9 @@ --source include/have_perfschema.inc --source include/have_query_cache.inc +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings # # The following FLUSH statements should be replicated # @@ -101,6 +104,101 @@ FLUSH TABLES t2; --enable_query_log +--connection node_2 +--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--connection node_1 +FLUSH ERROR LOGS; +--connection node_2 +--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--disable_query_log +--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff; +--enable_query_log + + +--connection node_2 +--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--connection node_1 +FLUSH SLOW LOGS; +--connection node_2 +--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--disable_query_log +--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff; +--enable_query_log + +--connection node_2 +--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--connection node_1 +FLUSH GENERAL LOGS; +--connection node_2 +--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--disable_query_log +--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff; +--enable_query_log + +--connection node_2 +--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--connection node_1 +FLUSH ENGINE LOGS; +--connection node_2 +--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--disable_query_log +--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff; +--enable_query_log + +--connection node_2 +--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--connection node_1 +FLUSH RELAY LOGS; +--connection node_2 +--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--disable_query_log +--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff; +--enable_query_log + +--connection node_1 +SET @userstat_old= @@userstat; +SET GLOBAL userstat=ON; + +--connection node_2 +--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--connection node_1 +FLUSH CLIENT_STATISTICS; +FLUSH INDEX_STATISTICS; +FLUSH TABLE_STATISTICS; +FLUSH USER_STATISTICS; +--connection node_2 +--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--disable_query_log +--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 4 AS wsrep_last_committed_diff; +--enable_query_log + + +--connection node_1 +SET @old_thread_statistics= @@global.thread_statistics; +SET GLOBAL thread_statistics= ON; + +--connection node_2 +--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--connection node_1 +FLUSH THREAD_STATISTICS; +--connection node_2 +--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--disable_query_log +--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff; +--enable_query_log + + +--connection node_2 +--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--connection node_1 +FLUSH CHANGED_PAGE_BITMAPS; +--connection node_2 +--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--disable_query_log +--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff; +--enable_query_log + + # # The following statements should not be replicated: FLUSH LOGS, FLUSH TABLES WITH LOCKS # @@ -171,3 +269,5 @@ FLUSH TABLES t1; --connection node_1 DROP TABLE t1; DROP TABLE t2; +SET GLOBAL userstat= @userstat_old; +SET GLOBAL thread_statistics= @old_thread_statistics; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 7faa319feb0..e8a64a59b2f 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4670,14 +4670,36 @@ end_with_restore_list: #ifdef WITH_WSREP if (lex->type & ( - REFRESH_GRANT | - REFRESH_HOSTS | - REFRESH_DES_KEY_FILE | + REFRESH_GRANT | + REFRESH_HOSTS | +#ifdef HAVE_OPENSSL + REFRESH_DES_KEY_FILE | +#endif + /* + Write all flush log statements except + FLUSH LOGS + FLUSH BINARY LOGS + Check reload_acl_and_cache for why. + */ + REFRESH_RELAY_LOG | + REFRESH_SLOW_LOG | + REFRESH_GENERAL_LOG | + REFRESH_ENGINE_LOG | + REFRESH_ERROR_LOG | #ifdef HAVE_QUERY_CACHE - REFRESH_QUERY_CACHE_FREE | + REFRESH_QUERY_CACHE_FREE | #endif /* HAVE_QUERY_CACHE */ - REFRESH_STATUS | - REFRESH_USER_RESOURCES)) + REFRESH_STATUS | + REFRESH_USER_RESOURCES | + /* + Percona Server specific + */ + REFRESH_FLUSH_PAGE_BITMAPS | + REFRESH_TABLE_STATS | + REFRESH_INDEX_STATS | + REFRESH_USER_STATS | + REFRESH_CLIENT_STATS | + REFRESH_THREAD_STATS)) { WSREP_TO_ISOLATION_BEGIN_WRTCHK(WSREP_MYSQL_DB, NULL, NULL) }