Skip to content

Commit 0ecc4fe

Browse files
ronin13Nirbhay Choubey
authored andcommitted
Bug#1421360: Add Percona Server specific FLUSH statements.
Added following: FLUSH CLIENT_STATISTICS FLUSH INDEX_STATISTICS FLUSH TABLE_STATISTICS FLUSH THREAD_STATISTICS FLUSH USER_STATISTICS pertaining to USER STATISTICS https://www.percona.com/doc/percona-server/5.6/diagnostics/user_stats.html FLUSH CHANGED_PAGE_BITMAPS pertaining to changed page tracking. https://www.percona.com/doc/percona-server/5.6/management/changed_page_tracking.html Also, added tests for them. (cherry picked from commit 7efe49010c7f217663f364657090812b4723f426) Conflicts: mysql-test/suite/galera/r/galera_flush.result mysql-test/suite/galera/r/galera_flush_gtid.result mysql-test/suite/galera/t/galera_flush.test sql/sql_parse.cc
1 parent 1077eef commit 0ecc4fe

File tree

3 files changed

+162
-6
lines changed

3 files changed

+162
-6
lines changed

mysql-test/suite/galera/r/galera_flush.result

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
DROP TABLE IF EXISTS t1, t2;
12
FLUSH DES_KEY_FILE;
23
wsrep_last_committed_diff
34
1
@@ -26,6 +27,37 @@ CREATE TABLE t2 (f1 INTEGER);
2627
FLUSH TABLES t2;
2728
wsrep_last_committed_diff
2829
1
30+
FLUSH ERROR LOGS;
31+
wsrep_last_committed_diff
32+
1
33+
FLUSH SLOW LOGS;
34+
wsrep_last_committed_diff
35+
1
36+
FLUSH GENERAL LOGS;
37+
wsrep_last_committed_diff
38+
1
39+
FLUSH ENGINE LOGS;
40+
wsrep_last_committed_diff
41+
1
42+
FLUSH RELAY LOGS;
43+
wsrep_last_committed_diff
44+
1
45+
SET @userstat_old= @@userstat;
46+
SET GLOBAL userstat=ON;
47+
FLUSH CLIENT_STATISTICS;
48+
FLUSH INDEX_STATISTICS;
49+
FLUSH TABLE_STATISTICS;
50+
FLUSH USER_STATISTICS;
51+
wsrep_last_committed_diff
52+
1
53+
SET @old_thread_statistics= @@global.thread_statistics;
54+
SET GLOBAL thread_statistics= ON;
55+
FLUSH THREAD_STATISTICS;
56+
wsrep_last_committed_diff
57+
1
58+
FLUSH CHANGED_PAGE_BITMAPS;
59+
wsrep_last_committed_diff
60+
1
2961
CREATE TABLE t1 (f1 INTEGER);
3062
FLUSH LOGS;
3163
FLUSH TABLES WITH READ LOCK;
@@ -52,3 +84,5 @@ wsrep_last_committed_diff
5284
1
5385
DROP TABLE t1;
5486
DROP TABLE t2;
87+
SET GLOBAL userstat= @userstat_old;
88+
SET GLOBAL thread_statistics= @old_thread_statistics;

mysql-test/suite/galera/t/galera_flush.test

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
--source include/have_perfschema.inc
88
--source include/have_query_cache.inc
99

10+
--disable_warnings
11+
DROP TABLE IF EXISTS t1, t2;
12+
--enable_warnings
1013
#
1114
# The following FLUSH statements should be replicated
1215
#
@@ -101,6 +104,101 @@ FLUSH TABLES t2;
101104
--enable_query_log
102105

103106

107+
--connection node_2
108+
--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
109+
--connection node_1
110+
FLUSH ERROR LOGS;
111+
--connection node_2
112+
--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
113+
--disable_query_log
114+
--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff;
115+
--enable_query_log
116+
117+
118+
--connection node_2
119+
--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
120+
--connection node_1
121+
FLUSH SLOW LOGS;
122+
--connection node_2
123+
--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
124+
--disable_query_log
125+
--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff;
126+
--enable_query_log
127+
128+
--connection node_2
129+
--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
130+
--connection node_1
131+
FLUSH GENERAL LOGS;
132+
--connection node_2
133+
--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
134+
--disable_query_log
135+
--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff;
136+
--enable_query_log
137+
138+
--connection node_2
139+
--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
140+
--connection node_1
141+
FLUSH ENGINE LOGS;
142+
--connection node_2
143+
--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
144+
--disable_query_log
145+
--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff;
146+
--enable_query_log
147+
148+
--connection node_2
149+
--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
150+
--connection node_1
151+
FLUSH RELAY LOGS;
152+
--connection node_2
153+
--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
154+
--disable_query_log
155+
--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff;
156+
--enable_query_log
157+
158+
--connection node_1
159+
SET @userstat_old= @@userstat;
160+
SET GLOBAL userstat=ON;
161+
162+
--connection node_2
163+
--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
164+
--connection node_1
165+
FLUSH CLIENT_STATISTICS;
166+
FLUSH INDEX_STATISTICS;
167+
FLUSH TABLE_STATISTICS;
168+
FLUSH USER_STATISTICS;
169+
--connection node_2
170+
--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
171+
--disable_query_log
172+
--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 4 AS wsrep_last_committed_diff;
173+
--enable_query_log
174+
175+
176+
--connection node_1
177+
SET @old_thread_statistics= @@global.thread_statistics;
178+
SET GLOBAL thread_statistics= ON;
179+
180+
--connection node_2
181+
--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
182+
--connection node_1
183+
FLUSH THREAD_STATISTICS;
184+
--connection node_2
185+
--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
186+
--disable_query_log
187+
--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff;
188+
--enable_query_log
189+
190+
191+
--connection node_2
192+
--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
193+
--connection node_1
194+
FLUSH CHANGED_PAGE_BITMAPS;
195+
--connection node_2
196+
--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
197+
--disable_query_log
198+
--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff;
199+
--enable_query_log
200+
201+
104202
#
105203
# The following statements should not be replicated: FLUSH LOGS, FLUSH TABLES WITH LOCKS
106204
#
@@ -171,3 +269,5 @@ FLUSH TABLES t1;
171269
--connection node_1
172270
DROP TABLE t1;
173271
DROP TABLE t2;
272+
SET GLOBAL userstat= @userstat_old;
273+
SET GLOBAL thread_statistics= @old_thread_statistics;

sql/sql_parse.cc

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4670,14 +4670,36 @@ case SQLCOM_PREPARE:
46704670

46714671
#ifdef WITH_WSREP
46724672
if (lex->type & (
4673-
REFRESH_GRANT |
4674-
REFRESH_HOSTS |
4675-
REFRESH_DES_KEY_FILE |
4673+
REFRESH_GRANT |
4674+
REFRESH_HOSTS |
4675+
#ifdef HAVE_OPENSSL
4676+
REFRESH_DES_KEY_FILE |
4677+
#endif
4678+
/*
4679+
Write all flush log statements except
4680+
FLUSH LOGS
4681+
FLUSH BINARY LOGS
4682+
Check reload_acl_and_cache for why.
4683+
*/
4684+
REFRESH_RELAY_LOG |
4685+
REFRESH_SLOW_LOG |
4686+
REFRESH_GENERAL_LOG |
4687+
REFRESH_ENGINE_LOG |
4688+
REFRESH_ERROR_LOG |
46764689
#ifdef HAVE_QUERY_CACHE
4677-
REFRESH_QUERY_CACHE_FREE |
4690+
REFRESH_QUERY_CACHE_FREE |
46784691
#endif /* HAVE_QUERY_CACHE */
4679-
REFRESH_STATUS |
4680-
REFRESH_USER_RESOURCES))
4692+
REFRESH_STATUS |
4693+
REFRESH_USER_RESOURCES |
4694+
/*
4695+
Percona Server specific
4696+
*/
4697+
REFRESH_FLUSH_PAGE_BITMAPS |
4698+
REFRESH_TABLE_STATS |
4699+
REFRESH_INDEX_STATS |
4700+
REFRESH_USER_STATS |
4701+
REFRESH_CLIENT_STATS |
4702+
REFRESH_THREAD_STATS))
46814703
{
46824704
WSREP_TO_ISOLATION_BEGIN_WRTCHK(WSREP_MYSQL_DB, NULL, NULL)
46834705
}

0 commit comments

Comments
 (0)