Skip to content

Commit 775cba4

Browse files
montywivuvova
authored andcommitted
MDEV-33145 Add FLUSH GLOBAL STATUS
- FLUSH GLOBAL STATUS now resets most global_status_vars. At this stage, this is mainly to be used for testing. - FLUSH SESSION STATUS added as an alias for FLUSH STATUS. - FLUSH STATUS does not require any privilege (before required RELOAD). - FLUSH GLOBAL STATUS requires RELOAD privilege. - All global status reset moved to FLUSH GLOBAL STATUS. - Replication semisync status variables are now reset by FLUSH GLOBAL STATUS. - In test cases, the only changes are: - Replace FLUSH STATUS with FLUSH GLOBAL STATUS - Replace FLUSH STATUS with FLUSH STATUS; FLUSH GLOBAL STATUS. This was only done in a few tests where the test was using SHOW STATUS for both local and global variables. - Uptime_since_flush_status is now always provided, independent if ENABLED_PROFILING is enabled when compiling MariaDB. - @@global.Uptime_since_flush_status is reset on FLUSH GLOBAL STATUS and @@session.Uptime_since_flush_status is reset on FLUSH SESSION STATUS. - When connected, @@session.Uptime_since_flush_status is set to 0.
1 parent d2b39a2 commit 775cba4

File tree

325 files changed

+787
-525
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

325 files changed

+787
-525
lines changed

client/mysqladmin.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
985985
}
986986
case ADMIN_FLUSH_STATUS:
987987
{
988-
if (flush(mysql, "status"))
988+
if (flush(mysql, "/*!110500 global */ status"))
989989
return -1;
990990
break;
991991
}
@@ -1034,8 +1034,9 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
10341034
}
10351035
case ADMIN_FLUSH_ALL_STATUS:
10361036
{
1037-
if (flush(mysql, "status,table_statistics,index_statistics,"
1038-
"user_statistics,client_statistics"))
1037+
if (flush(mysql,
1038+
"/*!110500 global */ status,table_statistics,"
1039+
"index_statistics, user_statistics,client_statistics"))
10391040
return -1;
10401041
break;
10411042
}

include/mysql_com.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,11 @@ enum enum_indicator_type
194194
#define REFRESH_LOG (1ULL << 1) /* Start on new log file */
195195
#define REFRESH_TABLES (1ULL << 2) /* close all tables */
196196
#define REFRESH_HOSTS (1ULL << 3) /* Flush host cache */
197-
#define REFRESH_STATUS (1ULL << 4) /* Flush status variables */
197+
#define REFRESH_SESSION_STATUS (1ULL << 4) /* Flush status variables */
198+
#define REFRESH_STATUS REFRESH_SESSION_STATUS
198199
#define REFRESH_THREADS (1ULL << 5) /* Flush thread cache */
199-
#define REFRESH_SLAVE (1ULL << 6) /* Reset master info and restart slave
200-
thread */
200+
#define REFRESH_SLAVE (1ULL << 6) /* Reset master info and restart
201+
slave thread */
201202
#define REFRESH_MASTER (1ULL << 7) /* Remove all bin logs in the index
202203
and truncate the index */
203204

@@ -218,6 +219,7 @@ enum enum_indicator_type
218219
#define REFRESH_USER_RESOURCES (1ULL << 19)
219220
#define REFRESH_FOR_EXPORT (1ULL << 20) /* FLUSH TABLES ... FOR EXPORT */
220221
#define REFRESH_SSL (1ULL << 21)
222+
#define REFRESH_GLOBAL_STATUS (1ULL << 22) /* Flush global status */
221223

222224
#define REFRESH_GENERIC (1ULL << 30)
223225
#define REFRESH_FAST (1ULL << 31) /* Intern flag */

mysql-test/include/check_key_reads.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
let $key_reads= query_get_value(SHOW STATUS LIKE 'key_reads',Value,1);
33
--disable_query_log
44
eval SELECT IF($key_reads = 0, "Yes!", "No!") as 'Zero key reads?';
5-
FLUSH STATUS;
5+
FLUSH GLOBAL STATUS;
66
--enable_query_log

mysql-test/include/query_cache.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ set GLOBAL query_cache_size = 1355776;
3131
#
3232
# Without auto_commit.
3333
#
34-
flush status;
34+
flush global status;
3535
set autocommit=0;
3636
eval create table t1 (a int not null)$partitions_a;
3737
insert into t1 values (1),(2),(3);
@@ -129,7 +129,7 @@ connection default;
129129
SHOW VARIABLES LIKE 'have_query_cache';
130130

131131
SET GLOBAL query_cache_size = 204800;
132-
flush status;
132+
flush global status;
133133
SET @@autocommit=1;
134134
eval SET SESSION DEFAULT_STORAGE_ENGINE = $engine_type;
135135
eval CREATE TABLE t2 (s1 int, s2 varchar(1000), key(s1))$partitions_s1;

mysql-test/include/query_cache_partitions.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ show create table t1;
4040

4141
INSERT INTO t1 VALUES (1, now(), 0);
4242

43-
flush status;
43+
flush global status;
4444
show status like "Qcache_queries_in_cache";
4545
show status like "Qcache_hits";
4646

@@ -76,7 +76,7 @@ show create table t1;
7676

7777
INSERT INTO t1 VALUES (1, now(), 0);
7878

79-
flush status;
79+
flush global status;
8080
show status like "Qcache_queries_in_cache";
8181
show status like "Qcache_hits";
8282

@@ -97,7 +97,7 @@ drop table t1;
9797
--echo #
9898

9999
flush query cache;
100-
flush status;
100+
flush global status;
101101

102102
SET GLOBAL query_cache_size=1024*1024*512;
103103
CREATE TABLE `t1` (

mysql-test/include/query_cache_sql_prepare.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ connection default;
3030

3131
set @initial_query_cache_size = @@global.query_cache_size;
3232
set @@global.query_cache_size=102400;
33-
flush status;
33+
flush global status;
3434
--disable_warnings
3535
drop table if exists t1;
3636
--enable_warnings
@@ -485,7 +485,7 @@ drop table if exists t1;
485485
--enable_warnings
486486
create table t1 (a varchar(255));
487487
insert into t1 (a) values ("Pack my box with five dozen liquor jugs.");
488-
flush status;
488+
flush global status;
489489
prepare stmt from "select a from t1";
490490
execute stmt;
491491
set @@global.query_cache_size=0;

mysql-test/main/cache_innodb.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ SET SESSION DEFAULT_STORAGE_ENGINE = InnoDB;
44
drop table if exists t1,t2,t3;
55
set @save_query_cache_size = @@global.query_cache_size;
66
set GLOBAL query_cache_size = 1355776;
7-
flush status;
7+
flush global status;
88
set autocommit=0;
99
create table t1 (a int not null);
1010
insert into t1 values (1),(2),(3);
@@ -139,7 +139,7 @@ SHOW VARIABLES LIKE 'have_query_cache';
139139
Variable_name Value
140140
have_query_cache YES
141141
SET GLOBAL query_cache_size = 204800;
142-
flush status;
142+
flush global status;
143143
SET @@autocommit=1;
144144
SET SESSION DEFAULT_STORAGE_ENGINE = InnoDB;
145145
CREATE TABLE t2 (s1 int, s2 varchar(1000), key(s1));

mysql-test/main/connect.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ DROP USER mysqltest_u1@localhost;
285285

286286
# -- Bug#35074: max_used_connections is not correct.
287287

288-
FLUSH STATUS;
288+
FLUSH GLOBAL STATUS;
289289

290290
SHOW STATUS LIKE 'max_used_connections';
291291
Variable_name Value
@@ -422,7 +422,7 @@ Warning 1287 '@@secure_auth' is deprecated and will be removed in a future relea
422422
# MDEV-19277: Add status variable that gets incremented if
423423
# connection is aborted prior to authentication
424424
#
425-
flush status;
425+
flush global status;
426426
SHOW GLOBAL STATUS LIKE 'Aborted_connects%';
427427
Variable_name Value
428428
Aborted_connects 0

mysql-test/main/connect.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ DROP USER mysqltest_u1@localhost;
267267
--echo # -- Bug#35074: max_used_connections is not correct.
268268
--echo
269269

270-
FLUSH STATUS;
270+
FLUSH GLOBAL STATUS;
271271

272272
--echo
273273
SHOW STATUS LIKE 'max_used_connections';
@@ -462,7 +462,7 @@ SET global secure_auth=default;
462462
--echo # connection is aborted prior to authentication
463463
--echo #
464464

465-
flush status;
465+
flush global status;
466466
SHOW GLOBAL STATUS LIKE 'Aborted_connects%';
467467

468468
SET GLOBAL log_warnings=2;

mysql-test/main/features.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
drop table if exists t1;
22
set sql_mode="";
3-
flush status;
3+
flush global status;
44
show status like "feature%";
55
Variable_name Value
66
Feature_application_time_periods 0

0 commit comments

Comments
 (0)