1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +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

@ -985,7 +985,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
}
case ADMIN_FLUSH_STATUS:
{
if (flush(mysql, "status"))
if (flush(mysql, "/*!110500 global */ status"))
return -1;
break;
}
@ -1034,8 +1034,9 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
}
case ADMIN_FLUSH_ALL_STATUS:
{
if (flush(mysql, "status,table_statistics,index_statistics,"
"user_statistics,client_statistics"))
if (flush(mysql,
"/*!110500 global */ status,table_statistics,"
"index_statistics, user_statistics,client_statistics"))
return -1;
break;
}

View File

@ -194,10 +194,11 @@ enum enum_indicator_type
#define REFRESH_LOG (1ULL << 1) /* Start on new log file */
#define REFRESH_TABLES (1ULL << 2) /* close all tables */
#define REFRESH_HOSTS (1ULL << 3) /* Flush host cache */
#define REFRESH_STATUS (1ULL << 4) /* Flush status variables */
#define REFRESH_SESSION_STATUS (1ULL << 4) /* Flush status variables */
#define REFRESH_STATUS REFRESH_SESSION_STATUS
#define REFRESH_THREADS (1ULL << 5) /* Flush thread cache */
#define REFRESH_SLAVE (1ULL << 6) /* Reset master info and restart slave
thread */
#define REFRESH_SLAVE (1ULL << 6) /* Reset master info and restart
slave thread */
#define REFRESH_MASTER (1ULL << 7) /* Remove all bin logs in the index
and truncate the index */
@ -218,6 +219,7 @@ enum enum_indicator_type
#define REFRESH_USER_RESOURCES (1ULL << 19)
#define REFRESH_FOR_EXPORT (1ULL << 20) /* FLUSH TABLES ... FOR EXPORT */
#define REFRESH_SSL (1ULL << 21)
#define REFRESH_GLOBAL_STATUS (1ULL << 22) /* Flush global status */
#define REFRESH_GENERIC (1ULL << 30)
#define REFRESH_FAST (1ULL << 31) /* Intern flag */

View File

@ -2,5 +2,5 @@
let $key_reads= query_get_value(SHOW STATUS LIKE 'key_reads',Value,1);
--disable_query_log
eval SELECT IF($key_reads = 0, "Yes!", "No!") as 'Zero key reads?';
FLUSH STATUS;
FLUSH GLOBAL STATUS;
--enable_query_log

View File

@ -31,7 +31,7 @@ set GLOBAL query_cache_size = 1355776;
#
# Without auto_commit.
#
flush status;
flush global status;
set autocommit=0;
eval create table t1 (a int not null)$partitions_a;
insert into t1 values (1),(2),(3);
@ -129,7 +129,7 @@ connection default;
SHOW VARIABLES LIKE 'have_query_cache';
SET GLOBAL query_cache_size = 204800;
flush status;
flush global status;
SET @@autocommit=1;
eval SET SESSION DEFAULT_STORAGE_ENGINE = $engine_type;
eval CREATE TABLE t2 (s1 int, s2 varchar(1000), key(s1))$partitions_s1;

View File

@ -40,7 +40,7 @@ show create table t1;
INSERT INTO t1 VALUES (1, now(), 0);
flush status;
flush global status;
show status like "Qcache_queries_in_cache";
show status like "Qcache_hits";
@ -76,7 +76,7 @@ show create table t1;
INSERT INTO t1 VALUES (1, now(), 0);
flush status;
flush global status;
show status like "Qcache_queries_in_cache";
show status like "Qcache_hits";
@ -97,7 +97,7 @@ drop table t1;
--echo #
flush query cache;
flush status;
flush global status;
SET GLOBAL query_cache_size=1024*1024*512;
CREATE TABLE `t1` (

View File

@ -30,7 +30,7 @@ connection default;
set @initial_query_cache_size = @@global.query_cache_size;
set @@global.query_cache_size=102400;
flush status;
flush global status;
--disable_warnings
drop table if exists t1;
--enable_warnings
@ -485,7 +485,7 @@ drop table if exists t1;
--enable_warnings
create table t1 (a varchar(255));
insert into t1 (a) values ("Pack my box with five dozen liquor jugs.");
flush status;
flush global status;
prepare stmt from "select a from t1";
execute stmt;
set @@global.query_cache_size=0;

View File

@ -4,7 +4,7 @@ SET SESSION DEFAULT_STORAGE_ENGINE = InnoDB;
drop table if exists t1,t2,t3;
set @save_query_cache_size = @@global.query_cache_size;
set GLOBAL query_cache_size = 1355776;
flush status;
flush global status;
set autocommit=0;
create table t1 (a int not null);
insert into t1 values (1),(2),(3);
@ -139,7 +139,7 @@ SHOW VARIABLES LIKE 'have_query_cache';
Variable_name Value
have_query_cache YES
SET GLOBAL query_cache_size = 204800;
flush status;
flush global status;
SET @@autocommit=1;
SET SESSION DEFAULT_STORAGE_ENGINE = InnoDB;
CREATE TABLE t2 (s1 int, s2 varchar(1000), key(s1));

View File

@ -285,7 +285,7 @@ DROP USER mysqltest_u1@localhost;
# -- Bug#35074: max_used_connections is not correct.
FLUSH STATUS;
FLUSH GLOBAL STATUS;
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
@ -422,7 +422,7 @@ Warning 1287 '@@secure_auth' is deprecated and will be removed in a future relea
# MDEV-19277: Add status variable that gets incremented if
# connection is aborted prior to authentication
#
flush status;
flush global status;
SHOW GLOBAL STATUS LIKE 'Aborted_connects%';
Variable_name Value
Aborted_connects 0

View File

@ -267,7 +267,7 @@ DROP USER mysqltest_u1@localhost;
--echo # -- Bug#35074: max_used_connections is not correct.
--echo
FLUSH STATUS;
FLUSH GLOBAL STATUS;
--echo
SHOW STATUS LIKE 'max_used_connections';
@ -462,7 +462,7 @@ SET global secure_auth=default;
--echo # connection is aborted prior to authentication
--echo #
flush status;
flush global status;
SHOW GLOBAL STATUS LIKE 'Aborted_connects%';
SET GLOBAL log_warnings=2;

View File

@ -1,6 +1,6 @@
drop table if exists t1;
set sql_mode="";
flush status;
flush global status;
show status like "feature%";
Variable_name Value
Feature_application_time_periods 0

View File

@ -11,7 +11,7 @@ set sql_mode="";
--disable_ps2_protocol
flush status;
flush global status;
show status like "feature%";

View File

@ -67,3 +67,17 @@ DROP VIEW v0, v1, v2;
#
# End of 10.6 tests
#
#
# MDEV-33145 Add FLUSH GLOBAL STATUS
#
CREATE USER mysqltest@localhost;
GRANT USAGE ON *.* TO mysqltest@localhost;
connect con1, localhost, mysqltest;
FLUSH STATUS;
FLUSH SESSION STATUS;
FLUSH GLOBAL STATUS;
ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
disconnect con1;
connection default;
DROP USER mysqltest@localhost;
# End of 11.5 tests

View File

@ -65,3 +65,21 @@ DROP VIEW v0, v1, v2;
--echo #
--echo # End of 10.6 tests
--echo #
--echo #
--echo # MDEV-33145 Add FLUSH GLOBAL STATUS
--echo #
CREATE USER mysqltest@localhost;
GRANT USAGE ON *.* TO mysqltest@localhost;
connect(con1, localhost, mysqltest);
FLUSH STATUS;
FLUSH SESSION STATUS;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
FLUSH GLOBAL STATUS;
disconnect con1;
connection default;
DROP USER mysqltest@localhost;
--echo # End of 11.5 tests

View File

@ -551,7 +551,7 @@ KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_B
default 1 NULL 2097152 1024 4 # 0 21 0 26 6
small NULL NULL 1048576 1024 1 # 0 1 0 2 1
flush tables;
flush status;
flush global status;
select * from information_schema.key_caches where segment_number is null;
KEY_CACHE_NAME SEGMENTS SEGMENT_NUMBER FULL_SIZE BLOCK_SIZE USED_BLOCKS UNUSED_BLOCKS DIRTY_BLOCKS READ_REQUESTS READS WRITE_REQUESTS WRITES
default 1 NULL 2097152 1024 4 # 0 0 0 0 0
@ -632,7 +632,7 @@ Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
flush tables;
flush status;
flush global status;
update t1 set a='zzzz' where a='qqqq';
set statement optimizer_scan_setup_cost=0 for update t2 set i=1 where i=2;
select * from information_schema.key_caches where segment_number is null;

View File

@ -369,7 +369,7 @@ delete from t2;
--replace_column 7 #
select * from information_schema.key_caches where segment_number is null;
flush tables; flush status;
flush tables; flush global status;
--replace_column 7 #
select * from information_schema.key_caches where segment_number is null;
@ -423,7 +423,7 @@ select * from t2 where p between 1010 and 1020 ;
select * from information_schema.key_caches where segment_number is null;
analyze table t2;
flush tables; flush status;
flush tables; flush global status;
update t1 set a='zzzz' where a='qqqq';
set statement optimizer_scan_setup_cost=0 for update t2 set i=1 where i=2;
--replace_column 6 # 7 #

View File

@ -17,6 +17,34 @@ mysqld is alive
# Creating an empty file 'cnf_file'
# Using --defaults-extra-file option with 'cnf_file'.
mysqld is alive
#
# MDEV-33992 mariadb-admin flush-status command should do
# FLUSH GLOBAL STATUS
#
flush session status;
flush global status;
connect con1,localhost,root,;
connect con2,localhost,root,;
connect con3,localhost,root,;
disconnect con1;
disconnect con2;
disconnect con3;
connection default;
show status like 'Max_used_connections';
Variable_name Value
Max_used_connections 4
show global status like 'Max_used_connections';
Variable_name Value
Max_used_connections 4
#
# Running mariadb-admin flush-status
#
show status like 'Max_used_connections';
Variable_name Value
Max_used_connections 2
show global status like 'Max_used_connections';
Variable_name Value
Max_used_connections 2
# restart: --ssl-key=MYSQLTEST_VARDIR/tmp/ssl_key.pem --ssl-cert=MYSQLTEST_VARDIR/tmp/ssl_cert.pem
connect ssl_con,localhost,root,,,,,SSL;
SELECT VARIABLE_VALUE INTO @ssl_not_after FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_server_not_after';
@ -26,3 +54,4 @@ Result
OK
# Cleanup
# restart
# End of 11.5

View File

@ -52,6 +52,32 @@ EOF
--error 1
--exec $MYSQLADMIN -u root -p 2>&1 > /dev/null
--echo #
--echo # MDEV-33992 mariadb-admin flush-status command should do
--echo # FLUSH GLOBAL STATUS
--echo #
flush session status;
flush global status;
--connect (con1,localhost,root,)
--connect (con2,localhost,root,)
--connect (con3,localhost,root,)
--disconnect con1
--disconnect con2
--disconnect con3
--connection default
show status like 'Max_used_connections';
show global status like 'Max_used_connections';
--echo #
--echo # Running mariadb-admin flush-status
--echo #
--exec $MYSQLADMIN flush-status
show status like 'Max_used_connections';
show global status like 'Max_used_connections';
#
# MDEV-19168 Reload SSL certificate
# This test reloads server SSL certs ./mysqladmin flush-ssl, and checks that new SSL
@ -96,3 +122,5 @@ remove_file $ssl_key;
# restart with usual SSL
let $restart_parameters=;
--source include/restart_mysqld.inc
--echo # End of 11.5

View File

@ -4,7 +4,7 @@ SET SESSION DEFAULT_STORAGE_ENGINE = InnoDB;
drop table if exists t1,t2,t3;
set @save_query_cache_size = @@global.query_cache_size;
set GLOBAL query_cache_size = 1355776;
flush status;
flush global status;
set autocommit=0;
create table t1 (a int not null) PARTITION BY KEY (a) PARTITIONS 3;
insert into t1 values (1),(2),(3);
@ -121,7 +121,7 @@ SHOW VARIABLES LIKE 'have_query_cache';
Variable_name Value
have_query_cache YES
SET GLOBAL query_cache_size = 204800;
flush status;
flush global status;
SET @@autocommit=1;
SET SESSION DEFAULT_STORAGE_ENGINE = InnoDB;
CREATE TABLE t2 (s1 int, s2 varchar(1000), key(s1)) PARTITION BY KEY (s1) PARTITIONS 3;

View File

@ -28,7 +28,7 @@ t1 CREATE TABLE `t1` (
PARTITION `month_2010_5` VALUES LESS THAN (734289) ENGINE = InnoDB,
PARTITION `month_max` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
INSERT INTO t1 VALUES (1, now(), 0);
flush status;
flush global status;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
@ -79,7 +79,7 @@ SUBPARTITIONS 3
PARTITION `month_2010_5` VALUES LESS THAN (734289) ENGINE = InnoDB,
PARTITION `month_max` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
INSERT INTO t1 VALUES (1, now(), 0);
flush status;
flush global status;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
@ -107,7 +107,7 @@ drop table t1;
# from previous transaction
#
flush query cache;
flush status;
flush global status;
SET GLOBAL query_cache_size=1024*1024*512;
CREATE TABLE `t1` (
`id` int(11) NOT NULL ,

View File

@ -28,7 +28,7 @@ t1 CREATE TABLE `t1` (
PARTITION `month_2010_5` VALUES LESS THAN (734289) ENGINE = MyISAM,
PARTITION `month_max` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
INSERT INTO t1 VALUES (1, now(), 0);
flush status;
flush global status;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
@ -79,7 +79,7 @@ SUBPARTITIONS 3
PARTITION `month_2010_5` VALUES LESS THAN (734289) ENGINE = MyISAM,
PARTITION `month_max` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
INSERT INTO t1 VALUES (1, now(), 0);
flush status;
flush global status;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
@ -107,7 +107,7 @@ drop table t1;
# from previous transaction
#
flush query cache;
flush status;
flush global status;
SET GLOBAL query_cache_size=1024*1024*512;
CREATE TABLE `t1` (
`id` int(11) NOT NULL ,

View File

@ -25,7 +25,7 @@ c INT NOT NULL,
PRIMARY KEY (a),
KEY `inx_b` (b));
FLUSH TABLES;
FLUSH STATUS;
FLUSH GLOBAL STATUS;
SET @a:=1167602400;
CREATE VIEW v AS SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4;
CREATE VIEW x AS SELECT 1 FROM v,v a,v b;
@ -45,7 +45,7 @@ p1 sp3 2043
DROP VIEW x;
DROP VIEW v;
FLUSH TABLES;
FLUSH STATUS;
FLUSH GLOBAL STATUS;
SELECT COUNT(b) FROM t1 WHERE b >= 0;
COUNT(b)
2048
@ -56,7 +56,7 @@ reads vs requests
reads == requests
writes vs requests
writes == requests
FLUSH STATUS;
FLUSH GLOBAL STATUS;
SELECT COUNT(b) FROM t2 WHERE b >= 0;
COUNT(b)
2048
@ -65,7 +65,7 @@ Yes!
FLUSH TABLES;
# Setting the default key cache to 1M
SET GLOBAL key_buffer_size = 1024*1024;
FLUSH STATUS;
FLUSH GLOBAL STATUS;
# All these have to read the indexes
LOAD INDEX INTO CACHE t1 PARTITION (p1);
Table Op Msg_type Msg_text

View File

@ -31,7 +31,7 @@ CREATE TABLE t2 (
PRIMARY KEY (a),
KEY `inx_b` (b));
FLUSH TABLES;
FLUSH STATUS;
FLUSH GLOBAL STATUS;
# Genereate 4096 rows. Idea from:
# http://datacharmer.blogspot.com/2007/12/data-from-nothing-solution-to-pop-quiz.html
@ -46,7 +46,7 @@ CREATE VIEW x AS SELECT 1 FROM v,v a,v b;
# SELECT IF(VARIABLE_VALUE = 0,"Yes!","No!") as 'Was zero reads?'
# FROM INFORMATION_SCHEMA.SESSION_STATUS
# WHERE VARIABLE_NAME = 'KEY_READS';
# FLUSH STATUS;
# FLUSH GLOBAL STATUS;
#END|
#DELIMITER ;|
@ -58,18 +58,18 @@ SELECT PARTITION_NAME, SUBPARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PAR
DROP VIEW x;
DROP VIEW v;
FLUSH TABLES;
FLUSH STATUS;
FLUSH GLOBAL STATUS;
SELECT COUNT(b) FROM t1 WHERE b >= 0;
--source include/check_key_reads.inc
INSERT t2 SELECT a,b,c FROM t1;
--source include/check_key_req.inc
FLUSH STATUS;
FLUSH GLOBAL STATUS;
SELECT COUNT(b) FROM t2 WHERE b >= 0;
--source include/check_key_reads.inc
FLUSH TABLES;
--echo # Setting the default key cache to 1M
SET GLOBAL key_buffer_size = 1024*1024;
FLUSH STATUS;
FLUSH GLOBAL STATUS;
--echo # All these have to read the indexes
LOAD INDEX INTO CACHE t1 PARTITION (p1);
--source include/check_key_reads.inc

View File

@ -45,7 +45,7 @@ select count(*) from t2;
count(*)
20672
flush tables;
flush status;
flush global status;
show status like "key_read%";
Variable_name Value
Key_read_requests 0
@ -65,7 +65,7 @@ Variable_name Value
Key_read_requests 588
Key_reads 60
flush tables;
flush status;
flush global status;
select @@preload_buffer_size;
@@preload_buffer_size
32768
@ -84,7 +84,7 @@ Variable_name Value
Key_read_requests 1068
Key_reads 774
flush tables;
flush status;
flush global status;
show status like "key_read%";
Variable_name Value
Key_read_requests 0
@ -108,7 +108,7 @@ Variable_name Value
Key_read_requests 311
Key_reads 75
flush tables;
flush status;
flush global status;
show status like "key_read%";
Variable_name Value
Key_read_requests 0
@ -136,7 +136,7 @@ Variable_name Value
Key_read_requests 1266
Key_reads 821
flush tables;
flush status;
flush global status;
show status like "key_read%";
Variable_name Value
Key_read_requests 0
@ -151,7 +151,7 @@ Variable_name Value
Key_read_requests 478
Key_reads 478
flush tables;
flush status;
flush global status;
show status like "key_read%";
Variable_name Value
Key_read_requests 0

View File

@ -57,7 +57,7 @@ select count(*) from t1;
select count(*) from t2;
--disable_ps2_protocol
flush tables; flush status;
flush tables; flush global status;
show status like "key_read%";
select count(*) from t1 where b = 'test1';
@ -65,14 +65,14 @@ show status like "key_read%";
select count(*) from t1 where b = 'test1';
show status like "key_read%";
flush tables; flush status;
flush tables; flush global status;
select @@preload_buffer_size;
load index into cache t1;
show status like "key_read%";
select count(*) from t1 where b = 'test1';
show status like "key_read%";
flush tables; flush status;
flush tables; flush global status;
show status like "key_read%";
set session preload_buffer_size=256*1024;
select @@preload_buffer_size;
@ -81,7 +81,7 @@ show status like "key_read%";
select count(*) from t1 where b = 'test1';
show status like "key_read%";
flush tables; flush status;
flush tables; flush global status;
show status like "key_read%";
set session preload_buffer_size=1*1024;
select @@preload_buffer_size;
@ -91,12 +91,12 @@ select count(*) from t1 where b = 'test1';
select count(*) from t2 where b = 'test1';
show status like "key_read%";
flush tables; flush status;
flush tables; flush global status;
show status like "key_read%";
load index into cache t3, t2 key (primary,b) ;
show status like "key_read%";
flush tables; flush status;
flush tables; flush global status;
show status like "key_read%";
load index into cache t3 key (b), t2 key (c) ;
show status like "key_read%";

View File

@ -12,7 +12,7 @@ SET LOCAL query_cache_type= ON;
flush query cache;
flush query cache;
reset query cache;
flush status;
flush global status;
drop table if exists t1,t2,t3,t4,t11,t21,t1_1,t1_2,t9,t9_1,t9_2;
drop database if exists mysqltest;
drop table if exists ```a`;
@ -673,7 +673,7 @@ SET SQL_SELECT_LIMIT=DEFAULT;
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);
insert into t1 values (1),(2),(3);
@ -955,7 +955,7 @@ zyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazy
flush query cache;
drop table t1, t2;
set GLOBAL query_cache_size=1355776;
flush status;
flush global status;
CREATE TABLE t1 (
`date` datetime NOT NULL default '0000-00-00 00:00:00',
KEY `date` (`date`)
@ -990,7 +990,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;
a
1
@ -1040,7 +1040,7 @@ Variable_name Value
Qcache_hits 1
drop table t1;
create table t1 (a int);
flush status;
flush global status;
(select a from t1) union (select a from t1);
a
show status like "Qcache_queries_in_cache";
@ -1117,7 +1117,7 @@ drop function f1//
drop table t1//
flush query cache;
reset query cache;
flush status;
flush global status;
create table t1 (s1 int)//
create procedure f1 () begin
select sql_cache * from t1;
@ -1176,7 +1176,7 @@ s1
1
flush query cache;
reset query cache;
flush status;
flush global status;
select sql_cache * from t1;
s1
1
@ -1309,7 +1309,7 @@ Last_query_cost 0.000000
drop table t1;
SET GLOBAL query_cache_size=0;
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;
@ -1674,7 +1674,7 @@ set GLOBAL query_cache_size=@save_query_cache_size;
set local query_cache_type=default;
set GLOBAL query_cache_type=on;
set local query_cache_type=on;
FLUSH STATUS;
FLUSH GLOBAL STATUS;
SET GLOBAL query_cache_size=10*1024*1024;
SET @save_concurrent_insert= @@concurrent_insert;
SET GLOBAL concurrent_insert= 0;
@ -1701,7 +1701,7 @@ DROP TABLE t1;
SET GLOBAL concurrent_insert= @save_concurrent_insert;
SET GLOBAL query_cache_size= default;
DROP TABLE IF EXISTS t1;
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);
@ -1956,7 +1956,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);
select * from t1;
@ -1993,7 +1993,7 @@ Qcache_hits 2
drop table t1;
FLUSH USER_STATISTICS;
FLUSH CLIENT_STATISTICS;
flush status;
flush global status;
create table t1 (a int);
select * from t1;
a
@ -2025,7 +2025,7 @@ Variable_name Value
Qcache_hits 2
FLUSH USER_STATISTICS;
FLUSH CLIENT_STATISTICS;
flush status;
flush global status;
create procedure p1()
select * from t1;
call p1;
@ -2058,7 +2058,7 @@ Variable_name Value
Qcache_hits 2
FLUSH USER_STATISTICS;
FLUSH CLIENT_STATISTICS;
flush status;
flush global status;
SET GLOBAL query_cache_size= 0;
call p1;
a
@ -2122,7 +2122,7 @@ SET GLOBAL query_cache_size= @qc;
#
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';
@ -2154,7 +2154,7 @@ End of 10.0 tests
# MDEV-10766 Queries which start with WITH clause do not get
# inserted into query cache
#
flush status;
flush global status;
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 0
@ -2242,7 +2242,7 @@ SET GLOBAL query_cache_size= @qc;
#
create table t1 (a text);
insert into t1 values ('{"a":"foo"}');
flush status;
flush global status;
SHOW STATUS LIKE 'Qcache_inserts';
Variable_name Value
Qcache_inserts 0
@ -2272,7 +2272,7 @@ set global query_cache_type= 1;
set query_cache_type= 1;
create table t1 (a int);
insert into t1 values (1000);
flush status;
flush global status;
select * from information_schema.global_status where variable_name in ('Qcache_inserts','Qcache_hits') order by variable_name;
VARIABLE_NAME VARIABLE_VALUE
QCACHE_HITS 0

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;

View File

@ -111,7 +111,7 @@ disconnect root;
disconnect root2;
flush query cache;
reset query cache;
flush status;
flush global status;
create table t1 (s1 int)//
create procedure f1 () begin
select sql_cache * from t1;
@ -215,7 +215,7 @@ Variable_name Value
Qcache_hits 10
flush query cache;
reset query cache;
flush status;
flush global status;
select sql_cache * from t1;
s1
1
@ -374,7 +374,7 @@ connection default;
set GLOBAL query_cache_size=0;
SET @@global.log_bin_trust_function_creators = @old_log_bin_trust_function_creators;
DROP DATABASE IF EXISTS bug30269;
FLUSH STATUS;
FLUSH GLOBAL STATUS;
CREATE DATABASE bug30269;
USE bug30269;
CREATE TABLE test1 (id int, name varchar(23));
@ -427,7 +427,7 @@ end|
insert into t1 values ("x", 3), ("y", 5)|
set @x = @@query_cache_size|
set global query_cache_size = 10*1024*1024|
flush status|
flush global status|
flush query cache|
show status like 'Qcache_hits'|
Variable_name Value
@ -457,7 +457,7 @@ show status like 'Qcache_hits'|
Variable_name Value
Qcache_hits 2
set global query_cache_size = @x|
flush status|
flush global status|
flush query cache|
delete from t1|
drop procedure bug3583|

View File

@ -116,7 +116,7 @@ disconnect root2;
--disable_ps2_protocol
flush query cache;
reset query cache;
flush status;
flush global status;
delimiter //;
create table t1 (s1 int)//
create procedure f1 () begin
@ -167,7 +167,7 @@ show status like "Qcache_inserts";
show status like "Qcache_hits";
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();
@ -251,7 +251,7 @@ SET @@global.log_bin_trust_function_creators = @old_log_bin_trust_function_creat
--disable_warnings
DROP DATABASE IF EXISTS bug30269;
--enable_warnings
FLUSH STATUS;
FLUSH GLOBAL STATUS;
CREATE DATABASE bug30269;
USE bug30269;
CREATE TABLE test1 (id int, name varchar(23));
@ -310,7 +310,7 @@ insert into t1 values ("x", 3), ("y", 5)|
set @x = @@query_cache_size|
set global query_cache_size = 10*1024*1024|
flush status|
flush global status|
flush query cache|
show status like 'Qcache_hits'|
call bug3583()|
@ -320,7 +320,7 @@ call bug3583()|
show status like 'Qcache_hits'|
set global query_cache_size = @x|
flush status|
flush global status|
flush query cache|
delete from t1|
drop procedure bug3583|

View File

@ -4,7 +4,7 @@ connect con1,localhost,root,,test,$MASTER_MYPORT,;
connection default;
set @initial_query_cache_size = @@global.query_cache_size;
set @@global.query_cache_size=102400;
flush status;
flush global status;
drop table if exists t1;
create table t1(c1 int);
insert into t1 values(1),(10),(100);
@ -540,7 +540,7 @@ use test;
drop table if exists t1;
create table t1 (a varchar(255));
insert into t1 (a) values ("Pack my box with five dozen liquor jugs.");
flush status;
flush global status;
prepare stmt from "select a from t1";
execute stmt;
a

View File

@ -4,7 +4,7 @@ connect con1,localhost,root,,test,$MASTER_MYPORT,;
connection default;
set @initial_query_cache_size = @@global.query_cache_size;
set @@global.query_cache_size=102400;
flush status;
flush global status;
drop table if exists t1;
create table t1(c1 int);
insert into t1 values(1),(10),(100);
@ -540,7 +540,7 @@ use test;
drop table if exists t1;
create table t1 (a varchar(255));
insert into t1 (a) values ("Pack my box with five dozen liquor jugs.");
flush status;
flush global status;
prepare stmt from "select a from t1";
execute stmt;
a

View File

@ -5,7 +5,7 @@ set @save_query_cache_type=@@global.query_cache_type;
set GLOBAL query_cache_type=ON;
set LOCAL query_cache_type=ON;
set GLOBAL query_cache_size=1355776;
flush status;
flush global status;
create table t1 (a int, b int);
create view v1 (c,d) as select sql_no_cache a,b from t1;
create view v2 (c,d) as select a+rand(),b from t1;
@ -46,7 +46,7 @@ Variable_name Value
Qcache_hits 0
drop view v1,v2;
set query_cache_type=demand;
flush status;
flush global status;
create view v1 (c,d) as select sql_cache a,b from t1;
show status like "Qcache_queries_in_cache";
Variable_name Value
@ -136,7 +136,7 @@ unlock tables;
set query_cache_wlock_invalidate=default;
drop view v1;
drop table t1;
flush status;
flush global status;
create table t1 (a int, b int);
create algorithm=temptable view v1 as select * from t1;
select * from v1;

View File

@ -15,7 +15,7 @@ set LOCAL query_cache_type=ON;
set GLOBAL query_cache_size=1355776;
--disable_ps2_protocol
flush status;
flush global status;
create table t1 (a int, b int);
# queries with following views should not be in query cache
@ -41,7 +41,7 @@ drop view v1,v2;
# SQL_CACHE option
set query_cache_type=demand;
--disable_ps2_protocol
flush status;
flush global status;
# query with view will be cached, but direct acess to table will not
create view v1 (c,d) as select sql_cache a,b from t1;
show status like "Qcache_queries_in_cache";
@ -111,7 +111,7 @@ drop table t1;
# BUG#15119: returning temptable view from the query cache.
#
--disable_ps2_protocol
flush status;
flush global status;
create table t1 (a int, b int);
create algorithm=temptable view v1 as select * from t1;
select * from v1;

View File

@ -5,7 +5,7 @@ SET GLOBAL LOG_OUTPUT = 'FILE';
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection default;
flush status;
flush global status;
show status like 'Table_lock%';
Variable_name Value
Table_locks_immediate 0
@ -82,7 +82,7 @@ show status like 'last_query_cost';
Variable_name Value
Last_query_cost 0.000000
drop table t1;
FLUSH STATUS;
FLUSH GLOBAL STATUS;
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections 1
@ -101,7 +101,7 @@ Max_used_connections 3
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
VARIABLE_NAME VARIABLE_VALUE
MAX_USED_CONNECTIONS 3
FLUSH STATUS;
FLUSH GLOBAL STATUS;
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections 2
@ -450,7 +450,7 @@ SET GLOBAL log_output = @old_log_output;
#
# MDEV-30543 New status variable: Max_used_connections_time
#
FLUSH STATUS;
FLUSH GLOBAL STATUS;
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
@ -466,3 +466,21 @@ expect_1
disconnect con4;
disconnect con3;
disconnect con1;
connection default;
# Test Uptime_since_flush_status
# All results below should be 1
flush global status;
flush session status;
1
1
1
1
1
1
1
1
1
1
#
# end of 11.5 tests
#

View File

@ -25,7 +25,7 @@ connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection default;
flush status;
flush global status;
show status like 'Table_lock%';
select * from information_schema.session_status where variable_name like 'Table_lock%';
@ -121,7 +121,7 @@ drop table t1;
let $disconnect_timeout = 10;
# Wait for any previous disconnects to finish.
FLUSH STATUS;
FLUSH GLOBAL STATUS;
--disable_query_log
--disable_result_log
eval SET @wait_left = $disconnect_timeout;
@ -131,7 +131,7 @@ let $wait_more = `SELECT @max_used_connections != 1 && @wait_left > 0`;
while ($wait_more)
{
sleep 1;
FLUSH STATUS;
FLUSH GLOBAL STATUS;
SET @wait_left = @wait_left - 1;
let $max_used_connections = `SHOW STATUS LIKE 'max_used_connections'`;
eval SET @max_used_connections = SUBSTRING('$max_used_connections', 21)+0;
@ -160,7 +160,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_us
# Check that after flush max_used_connections equals to current number
# of connections. First wait for previous disconnect to finish.
FLUSH STATUS;
FLUSH GLOBAL STATUS;
--disable_query_log
--disable_result_log
eval SET @wait_left = $disconnect_timeout;
@ -170,7 +170,7 @@ let $wait_more = `SELECT @max_used_connections != 2 && @wait_left > 0`;
while ($wait_more)
{
sleep 1;
FLUSH STATUS;
FLUSH GLOBAL STATUS;
SET @wait_left = @wait_left - 1;
let $max_used_connections = `SHOW STATUS LIKE 'max_used_connections'`;
eval SET @max_used_connections = SUBSTRING('$max_used_connections', 21)+0;
@ -446,7 +446,7 @@ SET GLOBAL log_output = @old_log_output;
--echo # MDEV-30543 New status variable: Max_used_connections_time
--echo #
FLUSH STATUS;
FLUSH GLOBAL STATUS;
connect (con1,localhost,root,,);
--sleep 1
@ -472,4 +472,42 @@ eval SELECT '$time_1' < '$time_3' as expect_1;
disconnect con4;
disconnect con3;
disconnect con1;
connection default;
--echo # Test Uptime_since_flush_status
--echo # All results below should be 1
flush global status;
flush session status;
--sleep 1
let $global_flush_status= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'Uptime_since_flush_status'`;
let $local_flush_status= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'Uptime_since_flush_status'`;
--sleep 2
--disable_query_log
--eval select $global_flush_status >= $local_flush_status as "1"
flush session status;
let $new_global_flush_status= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'Uptime_since_flush_status'`;
let $new_local_flush_status= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'Uptime_since_flush_status'`;
--eval select $new_global_flush_status >= $global_flush_status as "1"
--eval select $new_local_flush_status < $global_flush_status as "1"
--sleep 2
flush global status;
let $local_flush_status=$new_local_flush_status;
let $new_global_flush_status= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'Uptime_since_flush_status'`;
let $new_local_flush_status= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'Uptime_since_flush_status'`;
--eval select $new_local_flush_status >= $local_flush_status as "1"
--eval select $new_global_flush_status < $new_local_flush_status as "1"
--enable_query_log
--echo #
--echo # end of 11.5 tests
--echo #

View File

@ -7007,6 +7007,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
flush global status;
SELECT
(SELECT MIN(b) FROM t1, t2
WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
@ -7049,6 +7050,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
flush global status;
SELECT
(SELECT MIN(b) FROM t1, t2
WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m

View File

@ -5868,6 +5868,7 @@ FROM t2 alias1, t1 alias2, t1 alias3;
--disable_ps2_protocol
flush status;
flush global status;
SELECT
(SELECT MIN(b) FROM t1, t2
@ -5886,6 +5887,7 @@ SELECT
FROM t2 alias1, t1 alias2, t1 alias3;
flush status;
flush global status;
SELECT
(SELECT MIN(b) FROM t1, t2

View File

@ -12,6 +12,7 @@ insert into t2 values (2,3),(3,4),(5,6),(4,1);
* Test subquery as top item in different clauses
*
#single value subquery test (SELECT list)
flush global status;
flush status;
select a, (select d from t2 where b=c) from t1;
a (select d from t2 where b=c)
@ -359,6 +360,7 @@ EXPLAIN
}
}
set optimizer_switch='subquery_cache=off';
flush global status;
flush status;
select a, (select d from t2 where b=c) from t1;
a (select d from t2 where b=c)
@ -389,6 +391,7 @@ Handler_read_rnd_deleted 0
Handler_read_rnd_next 61
set optimizer_switch='subquery_cache=on';
#single value subquery test (where)
flush global status;
flush status;
select a from t1 where (select d from t2 where b=c);
a
@ -416,6 +419,7 @@ Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 31
set optimizer_switch='subquery_cache=off';
flush global status;
flush status;
select a from t1 where (select d from t2 where b=c);
a
@ -444,6 +448,7 @@ Handler_read_rnd_deleted 0
Handler_read_rnd_next 61
set optimizer_switch='subquery_cache=on';
#single value subquery test (having)
flush global status;
flush status;
select a from t1 where a > 0 having (select d from t2 where b=c);
a
@ -471,6 +476,7 @@ Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 31
set optimizer_switch='subquery_cache=off';
flush global status;
flush status;
select a from t1 where a > 0 having (select d from t2 where b=c);
a
@ -499,6 +505,7 @@ Handler_read_rnd_deleted 0
Handler_read_rnd_next 61
set optimizer_switch='subquery_cache=on';
#single value subquery test (OUTER JOIN ON)
flush global status;
flush status;
select ta.a, tb.a from t1 ta join t1 tb on (select d from t2 where tb.b=c);
a a
@ -598,6 +605,7 @@ Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 442
set optimizer_switch='subquery_cache=off';
flush global status;
flush status;
select ta.a, tb.a from t1 ta join t1 tb on (select d from t2 where tb.b=c);
a a
@ -698,6 +706,7 @@ Handler_read_rnd_deleted 0
Handler_read_rnd_next 472
set optimizer_switch='subquery_cache=on';
#single value subquery test (GROUP BY)
flush global status;
flush status;
select max(a) from t1 GROUP BY (select d from t2 where b=c);
max(a)
@ -721,6 +730,7 @@ Handler_read_rnd 4
Handler_read_rnd_deleted 0
Handler_read_rnd_next 36
set optimizer_switch='subquery_cache=off';
flush global status;
flush status;
select max(a) from t1 GROUP BY (select d from t2 where b=c);
max(a)
@ -745,6 +755,7 @@ Handler_read_rnd_deleted 0
Handler_read_rnd_next 86
set optimizer_switch='subquery_cache=on';
#single value subquery test (distinct GROUP BY)
flush global status;
flush status;
select distinct max(a) from t1 GROUP BY (select d from t2 where b=c);
max(a)
@ -768,6 +779,7 @@ Handler_read_rnd 4
Handler_read_rnd_deleted 0
Handler_read_rnd_next 41
set optimizer_switch='subquery_cache=off';
flush global status;
flush status;
select distinct max(a) from t1 GROUP BY (select d from t2 where b=c);
max(a)
@ -792,6 +804,7 @@ Handler_read_rnd_deleted 0
Handler_read_rnd_next 91
set optimizer_switch='subquery_cache=on';
#single value subquery test (ORDER BY)
flush global status;
flush status;
select a from t1 ORDER BY (select d from t2 where b=c);
a
@ -821,6 +834,7 @@ Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 31
set optimizer_switch='subquery_cache=off';
flush global status;
flush status;
select a from t1 ORDER BY (select d from t2 where b=c);
a
@ -851,6 +865,7 @@ Handler_read_rnd_deleted 0
Handler_read_rnd_next 61
set optimizer_switch='subquery_cache=on';
#single value subquery test (distinct ORDER BY)
flush global status;
flush status;
select distinct a from t1 ORDER BY (select d from t2 where b=c);
a
@ -874,6 +889,7 @@ Handler_read_rnd 4
Handler_read_rnd_deleted 1
Handler_read_rnd_next 36
set optimizer_switch='subquery_cache=off';
flush global status;
flush status;
select distinct a from t1 ORDER BY (select d from t2 where b=c);
a
@ -898,6 +914,7 @@ Handler_read_rnd_deleted 1
Handler_read_rnd_next 66
set optimizer_switch='subquery_cache=on';
#single value subquery test (LEFT JOIN ON)
flush global status;
flush status;
select ta.a, tb.a from t1 ta left join t1 tb on (select d from t2 where tb.b=c);
a a
@ -997,6 +1014,7 @@ Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 141
set optimizer_switch='subquery_cache=off';
flush global status;
flush status;
select ta.a, tb.a from t1 ta left join t1 tb on (select d from t2 where tb.b=c);
a a
@ -1159,6 +1177,7 @@ a (select d from t2 where b=c) + 1
4 7
drop procedure p1;
#IN subquery test
flush global status;
flush status;
show status like "subquery_cache%";
Variable_name Value
@ -1219,6 +1238,7 @@ Variable_name Value
Subquery_cache_hit 18
Subquery_cache_miss 16
# multicolumn NOT IN with NULLs
flush global status;
flush status;
set optimizer_switch='subquery_cache=off';
select a, b, (b, a) not in (select d, c from t2) as SUBS from t1;
@ -1259,6 +1279,7 @@ Variable_name Value
Subquery_cache_hit 6
Subquery_cache_miss 6
# multicolumn NOT IN with NULLs (other order)
flush global status;
flush status;
set optimizer_switch='subquery_cache=off';
select a, b, (a, b) not in (select d, c from t2) as SUBS from t1;
@ -1299,6 +1320,7 @@ Variable_name Value
Subquery_cache_hit 6
Subquery_cache_miss 6
# multicolumn IN with NULLs
flush global status;
flush status;
set optimizer_switch='subquery_cache=off';
select a, b, (b, a) in (select d, c from t2) as SUBS from t1;
@ -1339,6 +1361,7 @@ Variable_name Value
Subquery_cache_hit 6
Subquery_cache_miss 6
# multicolumn IN with NULLs (other order)
flush global status;
flush status;
set optimizer_switch='subquery_cache=off';
select a, b, (a, b) in (select d, c from t2) as SUBS from t1;
@ -1691,6 +1714,7 @@ a b SUBS
drop procedure p1;
#several subqueries
set optimizer_switch='subquery_cache=off';
flush global status;
flush status;
select a, b , exists (select * from t2 where b=d) as SUBSE, b in (select d from t2) as SUBSI, (select d from t2 where b=c) SUBSR from t1;
a b SUBSE SUBSI SUBSR
@ -1722,6 +1746,7 @@ Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 145
set optimizer_switch='subquery_cache=on';
flush global status;
flush status;
select a, b , exists (select * from t2 where b=d) as SUBSE, b in (select d from t2) as SUBSI, (select d from t2 where b=c) SUBSR from t1;
a b SUBSE SUBSI SUBSR
@ -1754,8 +1779,10 @@ Handler_read_rnd_deleted 0
Handler_read_rnd_next 84
#several subqueries (several levels)
set optimizer_switch='subquery_cache=off';
flush global status;
flush status;
set optimizer_switch='subquery_cache=off';
flush global status;
flush status;
select a, b, (select exists (select * from t2 where b=d) from t2 where b=c) as SUNS1 from t1;
a b SUNS1
@ -1787,6 +1814,7 @@ Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 127
set optimizer_switch='subquery_cache=on';
flush global status;
flush status;
select a, b, (select exists (select * from t2 where b=d) from t2 where b=c) as SUNS1 from t1;
a b SUNS1
@ -1917,6 +1945,7 @@ POINT(1 1)
POINT(3 3)
DROP TABLE t1;
#uncacheable queries test (random and side effect)
flush global status;
flush status;
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (2), (4), (1), (3);
@ -1983,6 +2012,7 @@ insert into t1 values (2,1), (3,1), (2,4), (3,4), (10,2), (20,2), (2,5),
insert into t2 values (1,1),(3,3),(20,20);
aggregate function as parameter of subquery
set optimizer_switch='subquery_cache=off';
flush global status;
flush status;
select max(a), (select max(a) from t2 where max(a)=c) from t1 group by b;
max(a) (select max(a) from t2 where max(a)=c)
@ -2010,6 +2040,7 @@ Handler_read_rnd 8
Handler_read_rnd_deleted 0
Handler_read_rnd_next 57
set optimizer_switch='subquery_cache=on';
flush global status;
flush status;
select max(a), (select max(a) from t2 where max(a)=c) from t1 group by b;
max(a) (select max(a) from t2 where max(a)=c)
@ -2038,6 +2069,7 @@ Handler_read_rnd_deleted 0
Handler_read_rnd_next 37
argument of aggregate function as parameter of subquery (illegal use)
set optimizer_switch='subquery_cache=off';
flush global status;
flush status;
select max(a), (select a from t2 where a=c) from t1 group by b;
max(a) (select a from t2 where a=c)
@ -2065,6 +2097,7 @@ Handler_read_rnd 8
Handler_read_rnd_deleted 0
Handler_read_rnd_next 57
set optimizer_switch='subquery_cache=on';
flush global status;
flush status;
select max(a), (select a from t2 where a=c) from t1 group by b;
max(a) (select a from t2 where a=c)
@ -2101,6 +2134,7 @@ insert into t1 values
create table t2 (pk int, a int, primary key(pk));
insert into t2 select a,a from t0;
set optimizer_switch='default,semijoin=on,materialization=on,subquery_cache=on';
flush global status;
flush status;
select * from t1 where a in (select pk from t2);
a b
@ -2140,6 +2174,7 @@ explain select * from t1 where a in (select pk from t2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 15 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 10 Using where
flush global status;
flush status;
select * from t1 where a in (select pk from t2);
a b
@ -2178,6 +2213,7 @@ explain select * from t1 where a in (select pk from t2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 15 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 10 Using where
flush global status;
flush status;
select * from t1 where a in (select pk from t2);
a b
@ -2216,6 +2252,7 @@ explain select * from t1 where a in (select pk from t2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 15 Using where
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 10
flush global status;
flush status;
select * from t1 where a in (select pk from t2);
a b

View File

@ -23,7 +23,7 @@ insert into t2 values (2,3),(3,4),(5,6),(4,1);
--echo *
--echo #single value subquery test (SELECT list)
--disable_ps2_protocol
flush status;
flush global status; flush status;
select a, (select d from t2 where b=c) from t1;
show status like "subquery_cache%";
@ -42,7 +42,7 @@ select a, (select d from t2 where b=c) from t1;
explain format=json
select a, (select d from t2 where b=c), (select d from t2 where b=c union select 1 order by 1 limit 1) from t1;
set optimizer_switch='subquery_cache=off';
flush status;
flush global status; flush status;
select a, (select d from t2 where b=c) from t1;
@ -52,14 +52,14 @@ set optimizer_switch='subquery_cache=on';
--echo #single value subquery test (where)
flush status;
flush global status; flush status;
select a from t1 where (select d from t2 where b=c);
show status like "subquery_cache%";
show status like '%Handler_read%';
set optimizer_switch='subquery_cache=off';
flush status;
flush global status; flush status;
select a from t1 where (select d from t2 where b=c);
@ -68,14 +68,14 @@ show status like '%Handler_read%';
set optimizer_switch='subquery_cache=on';
--echo #single value subquery test (having)
flush status;
flush global status; flush status;
select a from t1 where a > 0 having (select d from t2 where b=c);
show status like "subquery_cache%";
show status like '%Handler_read%';
set optimizer_switch='subquery_cache=off';
flush status;
flush global status; flush status;
select a from t1 where a > 0 having (select d from t2 where b=c);
@ -84,14 +84,14 @@ show status like '%Handler_read%';
set optimizer_switch='subquery_cache=on';
--echo #single value subquery test (OUTER JOIN ON)
flush status;
flush global status; flush status;
select ta.a, tb.a from t1 ta join t1 tb on (select d from t2 where tb.b=c);
show status like "subquery_cache%";
show status like '%Handler_read%';
set optimizer_switch='subquery_cache=off';
flush status;
flush global status; flush status;
select ta.a, tb.a from t1 ta join t1 tb on (select d from t2 where tb.b=c);
@ -100,14 +100,14 @@ show status like '%Handler_read%';
set optimizer_switch='subquery_cache=on';
--echo #single value subquery test (GROUP BY)
flush status;
flush global status; flush status;
select max(a) from t1 GROUP BY (select d from t2 where b=c);
show status like "subquery_cache%";
show status like '%Handler_read%';
set optimizer_switch='subquery_cache=off';
flush status;
flush global status; flush status;
select max(a) from t1 GROUP BY (select d from t2 where b=c);
show status like "subquery_cache%";
@ -115,14 +115,14 @@ show status like '%Handler_read%';
set optimizer_switch='subquery_cache=on';
--echo #single value subquery test (distinct GROUP BY)
flush status;
flush global status; flush status;
select distinct max(a) from t1 GROUP BY (select d from t2 where b=c);
show status like "subquery_cache%";
show status like '%Handler_read%';
set optimizer_switch='subquery_cache=off';
flush status;
flush global status; flush status;
select distinct max(a) from t1 GROUP BY (select d from t2 where b=c);
show status like "subquery_cache%";
@ -130,14 +130,14 @@ show status like '%Handler_read%';
set optimizer_switch='subquery_cache=on';
--echo #single value subquery test (ORDER BY)
flush status;
flush global status; flush status;
select a from t1 ORDER BY (select d from t2 where b=c);
show status like "subquery_cache%";
show status like '%Handler_read%';
set optimizer_switch='subquery_cache=off';
flush status;
flush global status; flush status;
select a from t1 ORDER BY (select d from t2 where b=c);
show status like "subquery_cache%";
@ -145,14 +145,14 @@ show status like '%Handler_read%';
set optimizer_switch='subquery_cache=on';
--echo #single value subquery test (distinct ORDER BY)
flush status;
flush global status; flush status;
select distinct a from t1 ORDER BY (select d from t2 where b=c);
show status like "subquery_cache%";
show status like '%Handler_read%';
set optimizer_switch='subquery_cache=off';
flush status;
flush global status; flush status;
select distinct a from t1 ORDER BY (select d from t2 where b=c);
show status like "subquery_cache%";
@ -160,14 +160,14 @@ show status like '%Handler_read%';
set optimizer_switch='subquery_cache=on';
--echo #single value subquery test (LEFT JOIN ON)
flush status;
flush global status; flush status;
select ta.a, tb.a from t1 ta left join t1 tb on (select d from t2 where tb.b=c);
show status like "subquery_cache%";
show status like '%Handler_read%';
set optimizer_switch='subquery_cache=off';
flush status;
flush global status; flush status;
select ta.a, tb.a from t1 ta left join t1 tb on (select d from t2 where tb.b=c);
@ -192,7 +192,7 @@ call p1;
drop procedure p1;
--echo #IN subquery test
flush status;
flush global status; flush status;
show status like "subquery_cache%";
select a, b , b in (select d from t2) as SUBS from t1;
@ -207,7 +207,7 @@ select a, b , b in (select d from t2) as SUBS from t1;
show status like "subquery_cache%";
--echo # multicolumn NOT IN with NULLs
flush status;
flush global status; flush status;
set optimizer_switch='subquery_cache=off';
select a, b, (b, a) not in (select d, c from t2) as SUBS from t1;
show status like "subquery_cache%";
@ -217,7 +217,7 @@ select a, b, (b, a) not in (select d, c from t2) as SUBS from t1;
show status like "subquery_cache%";
--echo # multicolumn NOT IN with NULLs (other order)
flush status;
flush global status; flush status;
set optimizer_switch='subquery_cache=off';
select a, b, (a, b) not in (select d, c from t2) as SUBS from t1;
show status like "subquery_cache%";
@ -227,7 +227,7 @@ select a, b, (a, b) not in (select d, c from t2) as SUBS from t1;
show status like "subquery_cache%";
--echo # multicolumn IN with NULLs
flush status;
flush global status; flush status;
set optimizer_switch='subquery_cache=off';
select a, b, (b, a) in (select d, c from t2) as SUBS from t1;
show status like "subquery_cache%";
@ -237,7 +237,7 @@ select a, b, (b, a) in (select d, c from t2) as SUBS from t1;
show status like "subquery_cache%";
--echo # multicolumn IN with NULLs (other order)
flush status;
flush global status; flush status;
set optimizer_switch='subquery_cache=off';
select a, b, (a, b) in (select d, c from t2) as SUBS from t1;
show status like "subquery_cache%";
@ -317,30 +317,30 @@ drop procedure p1;
--echo #several subqueries
set optimizer_switch='subquery_cache=off';
flush status;
flush global status; flush status;
select a, b , exists (select * from t2 where b=d) as SUBSE, b in (select d from t2) as SUBSI, (select d from t2 where b=c) SUBSR from t1;
show status like "subquery_cache%";
show status like '%Handler_read%';
set optimizer_switch='subquery_cache=on';
flush status;
flush global status; flush status;
select a, b , exists (select * from t2 where b=d) as SUBSE, b in (select d from t2) as SUBSI, (select d from t2 where b=c) SUBSR from t1;
show status like "subquery_cache%";
show status like '%Handler_read%';
--echo #several subqueries (several levels)
set optimizer_switch='subquery_cache=off';
flush status;
flush global status; flush status;
set optimizer_switch='subquery_cache=off';
flush status;
flush global status; flush status;
select a, b, (select exists (select * from t2 where b=d) from t2 where b=c) as SUNS1 from t1;
show status like "subquery_cache%";
show status like '%Handler_read%';
set optimizer_switch='subquery_cache=on';
flush status;
flush global status; flush status;
select a, b, (select exists (select * from t2 where b=d) from t2 where b=c) as SUNS1 from t1;
show status like "subquery_cache%";
show status like '%Handler_read%';
@ -425,7 +425,7 @@ DROP TABLE t1;
--echo #uncacheable queries test (random and side effect)
--disable_ps2_protocol
flush status;
flush global status; flush status;
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (2), (4), (1), (3);
select a, a in (select a from t1) from t1 as ext;
@ -464,25 +464,25 @@ insert into t2 values (1,1),(3,3),(20,20);
--disable_ps2_protocol
--echo aggregate function as parameter of subquery
set optimizer_switch='subquery_cache=off';
flush status;
flush global status; flush status;
select max(a), (select max(a) from t2 where max(a)=c) from t1 group by b;
show status like "subquery_cache%";
show status like '%Handler_read%';
set optimizer_switch='subquery_cache=on';
flush status;
flush global status; flush status;
select max(a), (select max(a) from t2 where max(a)=c) from t1 group by b;
show status like "subquery_cache%";
show status like '%Handler_read%';
--echo argument of aggregate function as parameter of subquery (illegal use)
set optimizer_switch='subquery_cache=off';
flush status;
flush global status; flush status;
select max(a), (select a from t2 where a=c) from t1 group by b;
show status like "subquery_cache%";
show status like '%Handler_read%';
set optimizer_switch='subquery_cache=on';
flush status;
flush global status; flush status;
select max(a), (select a from t2 where a=c) from t1 group by b;
show status like "subquery_cache%";
show status like '%Handler_read%';
@ -503,7 +503,7 @@ insert into t2 select a,a from t0;
--disable_ps2_protocol
set optimizer_switch='default,semijoin=on,materialization=on,subquery_cache=on';
flush status;
flush global status; flush status;
select * from t1 where a in (select pk from t2);
show status like "subquery_cache%";
show status like '%Handler_read%';
@ -512,7 +512,7 @@ alter table t2 drop primary key;
set optimizer_switch='default,semijoin=off,materialization=off,subquery_cache=off';
explain select * from t1 where a in (select pk from t2);
flush status;
flush global status; flush status;
select * from t1 where a in (select pk from t2);
show status like "subquery_cache%";
show status like '%Handler_read%';
@ -520,7 +520,7 @@ show status like '%Handler_read%';
set optimizer_switch='default,semijoin=off,materialization=off,subquery_cache=on';
explain select * from t1 where a in (select pk from t2);
flush status;
flush global status; flush status;
select * from t1 where a in (select pk from t2);
show status like "subquery_cache%";
show status like '%Handler_read%';
@ -529,7 +529,7 @@ show status like '%Handler_read%';
set optimizer_switch='default,semijoin=off,materialization=on,subquery_cache=on';
explain select * from t1 where a in (select pk from t2);
flush status;
flush global status; flush status;
select * from t1 where a in (select pk from t2);
show status like "subquery_cache%";
show status like '%Handler_read%';

View File

@ -7009,6 +7009,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
flush global status;
SELECT
(SELECT MIN(b) FROM t1, t2
WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
@ -7051,6 +7052,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
flush global status;
SELECT
(SELECT MIN(b) FROM t1, t2
WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m

View File

@ -7005,6 +7005,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
flush global status;
SELECT
(SELECT MIN(b) FROM t1, t2
WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
@ -7047,6 +7048,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
flush global status;
SELECT
(SELECT MIN(b) FROM t1, t2
WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m

View File

@ -7002,6 +7002,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
flush global status;
SELECT
(SELECT MIN(b) FROM t1, t2
WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
@ -7044,6 +7045,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
flush global status;
SELECT
(SELECT MIN(b) FROM t1, t2
WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m

View File

@ -7013,6 +7013,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
flush global status;
SELECT
(SELECT MIN(b) FROM t1, t2
WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
@ -7055,6 +7056,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
flush global status;
SELECT
(SELECT MIN(b) FROM t1, t2
WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m

View File

@ -7002,6 +7002,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
flush global status;
SELECT
(SELECT MIN(b) FROM t1, t2
WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
@ -7044,6 +7045,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
flush global status;
SELECT
(SELECT MIN(b) FROM t1, t2
WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m

View File

@ -2201,7 +2201,11 @@ create table t1 (s1 int);
create view abc as select * from t1 as abc;
drop table t1;
drop view abc;
#
# Bug#12993 View column rename broken in subselect
#
flush status;
flush global status;
create table t1(f1 char(1));
create view v1 as select * from t1;
select * from (select f1 as f2, f1 as f3 from v1) v where v.f2='a';

View File

@ -2040,12 +2040,12 @@ create view abc as select * from t1 as abc;
drop table t1;
drop view abc;
#
# Bug#12993 View column rename broken in subselect
#
--echo #
--echo # Bug#12993 View column rename broken in subselect
--echo #
flush status;
flush global status;
create table t1(f1 char(1));
create view v1 as select * from t1;
select * from (select f1 as f2, f1 as f3 from v1) v where v.f2='a';

View File

@ -87,7 +87,7 @@ reset master;
create table t1 (a int, b char(255)) engine=innodb;
flush status;
flush global status;
show status like "binlog_cache_use";
let $1=100;

View File

@ -25,7 +25,7 @@ set @@global.binlog_cache_size=32768;
--echo **** Preparing the enviroment to check commit and its effect on status variables.
--echo **** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
--echo **** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
flush status;
flush global status;
let $exp_cache= 0;
let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1);
let $exp_disk= 0;
@ -142,7 +142,7 @@ if (`SELECT $got_cache <> $exp_cache || $got_disk <> $exp_disk || $got_stmt_cach
--echo **** Preparing the enviroment to check abort and its effect on the status variables.
--echo **** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
--echo **** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
flush status;
flush global status;
let $exp_cache= 0;
let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1);
let $exp_disk= 0;

View File

@ -55,7 +55,7 @@ INSERT INTO t1 VALUES (303);
SET @gtid_pos= @@GLOBAL.gtid_binlog_pos;
INSERT INTO t1 VALUES (304);
INSERT INTO t1 VALUES (305);
FLUSH NO_WRITE_TO_BINLOG STATUS;
FLUSH NO_WRITE_TO_BINLOG GLOBAL STATUS;
+++ Initial status:
SHOW STATUS LIKE 'binlog_gtid_index_%';
Variable_name Value

View File

@ -121,7 +121,7 @@ master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Update_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
DROP TABLE t1;
flush status;
flush global status;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 0

View File

@ -8,7 +8,7 @@ set @@global.binlog_cache_size=32768;
**** Preparing the enviroment to check commit and its effect on status variables.
**** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
flush status;
flush global status;
**** Transactional changes which are long enough so they will be flushed to disk...
**** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
@ -37,7 +37,7 @@ commit;
**** Preparing the enviroment to check abort and its effect on the status variables.
**** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
flush status;
flush global status;
**** Transactional changes which are long enough so they will be flushed to disk...
**** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.

View File

@ -373,7 +373,7 @@ set @bcs = @@binlog_cache_size;
set global binlog_cache_size=4096;
reset master;
create table t1 (a int, b char(255)) engine=innodb;
flush status;
flush global status;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 0
@ -385,7 +385,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t1 (a int, b char(255)) engine=innodb
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; flush status
master-bin.000001 # Query # # use `test`; flush global status
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # insert into t1 values( 100, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
master-bin.000001 # Table_map # # table_id: # (test.t1)

View File

@ -8,7 +8,7 @@ set @@global.binlog_cache_size=32768;
**** Preparing the enviroment to check commit and its effect on status variables.
**** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
flush status;
flush global status;
**** Transactional changes which are long enough so they will be flushed to disk...
**** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
@ -37,7 +37,7 @@ commit;
**** Preparing the enviroment to check abort and its effect on the status variables.
**** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
flush status;
flush global status;
**** Transactional changes which are long enough so they will be flushed to disk...
**** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.

View File

@ -176,7 +176,7 @@ set @bcs = @@binlog_cache_size;
set global binlog_cache_size=4096;
reset master;
create table t1 (a int, b char(255)) engine=innodb;
flush status;
flush global status;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 0
@ -188,7 +188,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t1 (a int, b char(255)) engine=innodb
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; flush status
master-bin.000001 # Query # # use `test`; flush global status
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; insert into t1 values( 100, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
master-bin.000001 # Query # # use `test`; insert into t1 values( 99, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )

View File

@ -8,7 +8,7 @@ set @@global.binlog_cache_size=32768;
**** Preparing the enviroment to check commit and its effect on status variables.
**** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
flush status;
flush global status;
**** Transactional changes which are long enough so they will be flushed to disk...
**** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
@ -37,7 +37,7 @@ commit;
**** Preparing the enviroment to check abort and its effect on the status variables.
**** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
flush status;
flush global status;
**** Transactional changes which are long enough so they will be flushed to disk...
**** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1.
**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.

View File

@ -4,9 +4,9 @@ reset master;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # flush status
master-bin.000001 # Query # # flush /*!110500 global */ status
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # flush status
master-bin.000001 # Query # # flush /*!110500 global */ status
drop user adm@localhost;

View File

@ -87,7 +87,7 @@ INSERT INTO t1 VALUES (305);
# BINLOG_GTID_POS() has a side effect: it increments binlog_gtid_index_hit
--disable_ps2_protocol
FLUSH NO_WRITE_TO_BINLOG STATUS;
FLUSH NO_WRITE_TO_BINLOG GLOBAL STATUS;
--echo +++ Initial status:
SHOW STATUS LIKE 'binlog_gtid_index_%';
--echo +++ GTID Lookup in good index.

View File

@ -101,7 +101,7 @@ DROP TABLE t1;
# Actually this test has nothing to do with innodb per se, it just requires
# transactional table.
#
flush status;
flush global status;
show status like "binlog_cache_use";
show status like "binlog_cache_disk_use";

View File

@ -261,7 +261,7 @@ Rpl_semi_sync_master_no_tx 12
SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx';
Variable_name Value
Rpl_semi_sync_master_yes_tx 15
FLUSH NO_WRITE_TO_BINLOG STATUS;
FLUSH NO_WRITE_TO_BINLOG GLOBAL STATUS;
[ Semi-sync master status variables after FLUSH STATUS ]
SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx';
Variable_name Value

View File

@ -4,7 +4,7 @@ CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
RESET QUERY CACHE;
FLUSH STATUS;
FLUSH GLOBAL STATUS;
SELECT COUNT(*) FROM t1;
COUNT(*)
1
@ -20,7 +20,7 @@ VARIABLE_VALUE = 1
connection node_1;
INSERT INTO t1 VALUES (2);
connection node_2;
FLUSH STATUS;
FLUSH GLOBAL STATUS;
SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache';
VARIABLE_VALUE = 0
1
@ -42,7 +42,7 @@ VARIABLE_VALUE = 1
connection node_1;
ALTER TABLE t1 ADD COLUMN f2 INTEGER;
connection node_2;
FLUSH STATUS;
FLUSH GLOBAL STATUS;
SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache';
VARIABLE_VALUE = 0
1

View File

@ -17,7 +17,7 @@ INSERT INTO t1 VALUES (1);
--connection node_2
RESET QUERY CACHE;
FLUSH STATUS;
FLUSH GLOBAL STATUS;
#
# 1. Cache works
@ -37,7 +37,7 @@ SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_
INSERT INTO t1 VALUES (2);
--connection node_2
FLUSH STATUS;
FLUSH GLOBAL STATUS;
SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache';
SELECT COUNT(*) FROM t1;
@ -55,7 +55,7 @@ SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_
ALTER TABLE t1 ADD COLUMN f2 INTEGER;
--connection node_2
FLUSH STATUS;
FLUSH GLOBAL STATUS;
SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache';
SELECT COUNT(*) FROM t1;

View File

@ -75,7 +75,7 @@ truncate table performance_schema.hosts;
# Start from a known clean state, to avoid noise from previous tests
flush tables;
flush status;
flush global status;
--disable_warnings
drop procedure if exists dump_all;

View File

@ -145,7 +145,7 @@ update performance_schema.setup_instruments set enabled='YES', timed='YES'
# Start from a known clean state, to avoid noise from previous tests
flush tables;
flush status;
flush global status;
truncate performance_schema.events_waits_summary_by_thread_by_event_name;
truncate performance_schema.events_waits_summary_by_account_by_event_name;
truncate performance_schema.events_waits_summary_by_user_by_event_name;

View File

@ -2,7 +2,7 @@
# Set a known initial state for the test
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -106,7 +106,7 @@ update performance_schema.setup_instruments set enabled='YES', timed='YES'
# Start from a known clean state, to avoid noise from previous tests
flush tables;
flush status;
flush global status;
truncate performance_schema.memory_summary_by_thread_by_event_name;
truncate performance_schema.memory_summary_by_account_by_event_name;
truncate performance_schema.memory_summary_by_user_by_event_name;

View File

@ -69,7 +69,7 @@ update performance_schema.setup_instruments set enabled='YES', timed='YES';
# Start from a known clean state, to avoid noise from previous tests
flush tables;
flush status;
flush global status;
truncate performance_schema.events_stages_summary_by_thread_by_event_name;
truncate performance_schema.events_stages_summary_global_by_event_name;
truncate performance_schema.events_stages_history;

View File

@ -133,7 +133,7 @@ update performance_schema.setup_consumers set enabled='YES';
# Start from a known clean state, to avoid noise from previous tests
flush tables;
flush status;
flush global status;
create table test.t1(a int, b int, c int, d int default 0,
primary key(a),

View File

@ -4,7 +4,7 @@
update performance_schema.setup_consumers set enabled='NO';
truncate performance_schema.events_waits_history_long;
drop table test.marker;
flush status;
flush global status;
update performance_schema.setup_instruments set enabled='YES';
update performance_schema.setup_consumers set enabled='YES';

View File

@ -18,5 +18,5 @@ show global status like 'performance_schema_%';
# Cleanup
truncate performance_schema.events_waits_history_long;
flush status;
flush global status;

View File

@ -47,7 +47,7 @@ update performance_schema.setup_instruments set enabled='YES'
truncate table performance_schema.events_waits_history_long;
# Reset lost counters to a known state
flush status;
flush global status;
# Make sure there is room to instrument tables from this test.
flush tables;

View File

@ -5,7 +5,7 @@ update performance_schema.setup_instruments set enabled='NO';
update performance_schema.setup_instruments set enabled='YES'
where name like "wait/io/table/%";
truncate table performance_schema.events_waits_history_long;
flush status;
flush global status;
flush tables;
drop table if exists test.no_index_tab;
update performance_schema.setup_consumers set enabled='YES';
@ -136,10 +136,10 @@ Performance_schema_thread_classes_lost 0
Performance_schema_thread_instances_lost 0
Performance_schema_users_lost 0
truncate performance_schema.events_waits_history_long;
flush status;
flush global status;
update performance_schema.setup_consumers set enabled='NO';
truncate performance_schema.events_waits_history_long;
drop table test.marker;
flush status;
flush global status;
update performance_schema.setup_instruments set enabled='YES';
update performance_schema.setup_consumers set enabled='YES';

View File

@ -4,7 +4,7 @@ WHERE name LIKE 'wait/io/file/%';
update performance_schema.threads SET instrumented = 'YES'
WHERE PROCESSLIST_ID=connection_id();
truncate table performance_schema.events_statements_summary_by_digest;
flush status;
flush global status;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value')
ENGINE=MyISAM;

View File

@ -3,7 +3,7 @@ UPDATE performance_schema.setup_instruments SET enabled = 'YES'
WHERE name LIKE 'wait/synch/mutex/%'
OR name LIKE 'wait/synch/rwlock/%';
truncate table performance_schema.events_statements_summary_by_digest;
flush status;
flush global status;
select NAME from performance_schema.mutex_instances
where NAME = 'wait/synch/mutex/mysys/THR_LOCK::mutex' GROUP BY NAME;
NAME

View File

@ -1,5 +1,5 @@
call mtr.add_suppression("santa.claus.ipv4.example.com");
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,5 +1,5 @@
call mtr.add_suppression("santa.claus.ipv4.example.com");
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,5 +1,5 @@
call mtr.add_suppression("santa.claus.ipv4.example.com");
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,5 +1,5 @@
call mtr.add_suppression("santa.claus.ipv4.example.com");
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,5 +1,5 @@
call mtr.add_suppression("192.0.2.4");
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,5 +1,5 @@
call mtr.add_suppression("192.0.2.4");
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,5 +1,5 @@
call mtr.add_suppression("santa.claus.ipv4.example.com");
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,5 +1,5 @@
call mtr.add_suppression("santa.claus.ipv4.example.com");
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,5 +1,5 @@
install soname 'auth_ed25519';
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,4 +1,4 @@
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,4 +1,4 @@
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,5 +1,5 @@
call mtr.add_suppression("192.0.2.4");
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,4 +1,4 @@
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,5 +1,5 @@
call mtr.add_suppression("192.0.2.4");
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,5 +1,5 @@
call mtr.add_suppression("192.0.2.4");
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,5 +1,5 @@
call mtr.add_suppression("192.0.2.4");
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,5 +1,5 @@
call mtr.add_suppression("192.0.2.4");
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,4 +1,4 @@
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,4 +1,4 @@
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,5 +1,5 @@
call mtr.add_suppression("santa.claus.ipv6.example.com");
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,5 +1,5 @@
call mtr.add_suppression("santa.claus.ipv6.example.com");
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,5 +1,5 @@
call mtr.add_suppression("santa.claus.ipv6.example.com");
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,5 +1,5 @@
call mtr.add_suppression("santa.claus.ipv6.example.com");
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,5 +1,5 @@
call mtr.add_suppression("192.0.2.4");
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,4 +1,4 @@
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,5 +1,5 @@
call mtr.add_suppression("santa.claus.ipv6.example.com");
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,5 +1,5 @@
call mtr.add_suppression("santa.claus.ipv6.example.com");
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

View File

@ -1,4 +1,4 @@
flush status;
flush global status;
flush hosts;
flush user_resources;
flush privileges;

Some files were not shown because too many files have changed in this diff Show More