1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

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.
This commit is contained in:
Monty
2023-12-31 16:23:04 +02:00
committed by Sergei Golubchik
parent d2b39a2c82
commit 775cba4d0f
325 changed files with 787 additions and 525 deletions

View File

@ -24,7 +24,7 @@ SET LOCAL query_cache_type= ON;
flush query cache; # This crashed in some versions
flush query cache; # This crashed in some versions
reset query cache;
flush status;
flush global status;
--disable_warnings
drop table if exists t1,t2,t3,t4,t11,t21,t1_1,t1_2,t9,t9_1,t9_2;
drop database if exists mysqltest;
@ -465,7 +465,7 @@ drop table t1;
#
flush query cache;
reset query cache;
flush status;
flush global status;
set GLOBAL query_cache_size=1048576;
create table t1 (a int not null);
@ -732,7 +732,7 @@ set GLOBAL query_cache_size=1355776;
#
# Query with warning prohibited to query cache (BUG#9414)
#
flush status;
flush global status;
CREATE TABLE t1 (
`date` datetime NOT NULL default '0000-00-00 00:00:00',
KEY `date` (`date`)
@ -754,7 +754,7 @@ drop table t1;
create table t1 (a int);
insert into t1 values (1);
reset query cache;
flush status;
flush global status;
select * from (select * from t1) a;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
@ -777,7 +777,7 @@ drop table t1;
# BUG#14652: Queries with leading '(' characters.
#
create table t1 (a int);
flush status;
flush global status;
(select a from t1) union (select a from t1);
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
@ -845,7 +845,7 @@ delimiter ;//
#
flush query cache;
reset query cache;
flush status;
flush global status;
delimiter //;
create table t1 (s1 int)//
create procedure f1 () begin
@ -880,7 +880,7 @@ call f1();
select sql_cache * from t1;
flush query cache;
reset query cache;
flush status;
flush global status;
select sql_cache * from t1;
select sql_cache * from t1 where s1=1;
call f1();
@ -926,7 +926,7 @@ SET GLOBAL query_cache_size=0;
# Bug #20045: Server crash on INSERT ... SELECT ... FROM non-mergeable view
#
set global query_cache_size=1024*1024;
flush status;
flush global status;
create table t1 (a int);
insert into t1 (a) values (1), (2), (3);
select * from t1;
@ -1282,7 +1282,7 @@ set local query_cache_type=on;
#
# Bug#33756 - query cache with concurrent_insert=0 appears broken
#
FLUSH STATUS;
FLUSH GLOBAL STATUS;
SET GLOBAL query_cache_size=10*1024*1024;
SET @save_concurrent_insert= @@concurrent_insert;
SET GLOBAL concurrent_insert= 0;
@ -1306,7 +1306,7 @@ SET GLOBAL query_cache_size= default;
DROP TABLE IF EXISTS t1;
--enable_warnings
FLUSH STATUS;
FLUSH GLOBAL STATUS;
SET GLOBAL query_cache_size=1048576;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
@ -1645,7 +1645,7 @@ set GLOBAL query_cache_size=1355776;
FLUSH USER_STATISTICS;
FLUSH CLIENT_STATISTICS;
reset query cache;
flush status;
flush global status;
create table t1 (a int);
insert into t1 values (1);
@ -1666,7 +1666,7 @@ show status like "Qcache_hits";
drop table t1;
FLUSH USER_STATISTICS;
FLUSH CLIENT_STATISTICS;
flush status;
flush global status;
create table t1 (a int);
select * from t1;
@ -1685,7 +1685,7 @@ show status like "Qcache_hits";
FLUSH USER_STATISTICS;
FLUSH CLIENT_STATISTICS;
flush status;
flush global status;
create procedure p1()
select * from t1;
@ -1705,7 +1705,7 @@ show status like "Qcache_hits";
FLUSH USER_STATISTICS;
FLUSH CLIENT_STATISTICS;
flush status;
flush global status;
SET GLOBAL query_cache_size= 0;
call p1;
@ -1761,7 +1761,7 @@ SET GLOBAL query_cache_size= @qc;
--echo #
CREATE DATABASE `foo.bar`;
use `foo.bar`;
flush status;
flush global status;
CREATE TABLE moocow (a int);
INSERT INTO moocow VALUES (1), (2), (3);
SHOW STATUS LIKE 'Qcache_inserts';
@ -1779,7 +1779,7 @@ drop database `foo.bar`;
--echo # MDEV-10766 Queries which start with WITH clause do not get
--echo # inserted into query cache
--echo #
flush status;
flush global status;
show status like "Qcache_inserts";
create table t1 (i int);
with cte as (select * from t1) select * from cte;
@ -1859,7 +1859,7 @@ SET GLOBAL query_cache_size= @qc;
--echo #
create table t1 (a text);
insert into t1 values ('{"a":"foo"}');
flush status;
flush global status;
SHOW STATUS LIKE 'Qcache_inserts';
select * from t1, json_table(t1.a, '$' columns (f varchar(20) path '$.a')) as jt;
SHOW STATUS LIKE 'Qcache_inserts';
@ -1889,7 +1889,7 @@ set query_cache_type= 1;
create table t1 (a int);
insert into t1 values (1000);
flush status;
flush global status;
--let $v1 = `select hex(random_bytes(a)) from t1`
select * from information_schema.global_status where variable_name in ('Qcache_inserts','Qcache_hits') order by variable_name;