From 6f28f78429da8c63a47286e28fab9a613387497d Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 2 Jan 2018 20:43:29 +0200 Subject: [PATCH] More output in galera.query_cache.test This is to be able to better track where things goes wrong --- mysql-test/suite/galera/r/query_cache.result | 150 ++++++++++++++----- mysql-test/suite/galera/t/query_cache.test | 89 +++++++---- 2 files changed, 170 insertions(+), 69 deletions(-) diff --git a/mysql-test/suite/galera/r/query_cache.result b/mysql-test/suite/galera/r/query_cache.result index 4aaae2997f3..d497fc87544 100644 --- a/mysql-test/suite/galera/r/query_cache.result +++ b/mysql-test/suite/galera/r/query_cache.result @@ -820,6 +820,9 @@ Qcache_queries_in_cache 1 show status like "Qcache_hits"; Variable_name Value Qcache_hits 9 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 21 insert delayed into t1 values (4); select a from t1; a @@ -870,6 +873,9 @@ Qcache_queries_in_cache 0 show status like "Qcache_hits"; Variable_name Value Qcache_hits 9 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 22 # On node-2 connection node_2; show global variables like "query_cache_min_res_unit"; @@ -916,12 +922,15 @@ a 1 2 3 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 11 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 24 # On node-2 connection node_2; select * from t1; @@ -944,12 +953,12 @@ a 1 2 3 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 10 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 10 drop table t1; select a from t2; a @@ -961,12 +970,15 @@ a 1 2 3 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 11 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 18 set GLOBAL query_cache_min_res_unit=default; show global variables like "query_cache_min_res_unit"; Variable_name Value @@ -983,12 +995,15 @@ a 1 2 3 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 12 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 25 drop table t2; set GLOBAL query_cache_min_res_unit=default; show global variables like "query_cache_min_res_unit"; @@ -1010,6 +1025,9 @@ Qcache_queries_in_cache 2 show status like "Qcache_hits"; Variable_name Value Qcache_hits 12 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 27 # On node-2 connection node_2; select "aaa" from t1; @@ -1024,6 +1042,9 @@ Qcache_queries_in_cache 2 show status like "Qcache_hits"; Variable_name Value Qcache_hits 11 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 20 drop table t1; # On node-1 connection node_1; @@ -1322,6 +1343,9 @@ select count(*) from t1; count(*) 140 drop table t1; +# +# INTO OUTFILE/DUMPFILE test +# # On node-1 connection node_1; create table t1 (a int) engine=innodb; @@ -1342,7 +1366,13 @@ Qcache_queries_in_cache 0 show status like "Qcache_hits"; Variable_name Value Qcache_hits 12 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 36 drop table t1; +# +# Test of SQL_SELECT_LIMIT +# # On node-1 connection node_1; create table t1 (a int) engine=innodb; @@ -1367,6 +1397,9 @@ Qcache_queries_in_cache 2 show status like "Qcache_hits"; Variable_name Value Qcache_hits 12 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 38 SET SQL_SELECT_LIMIT=DEFAULT; # On node-2 connection node_2; @@ -1392,6 +1425,9 @@ Variable_name Value Qcache_hits 11 SET SQL_SELECT_LIMIT=DEFAULT; drop table t1; +# +# WRITE LOCK & QC +# # On node-1 connection node_1; create table t1 (a int not null) engine=innodb; @@ -1408,6 +1444,9 @@ Qcache_queries_in_cache 2 show status like "Qcache_hits"; Variable_name Value Qcache_hits 12 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 40 lock table t1 write, t2 read; show status like "Qcache_queries_in_cache"; Variable_name Value @@ -1431,6 +1470,9 @@ Qcache_queries_in_cache 2 show status like "Qcache_hits"; Variable_name Value Qcache_hits 12 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 41 unlock table; drop view v1; set query_cache_wlock_invalidate=default; @@ -1471,10 +1513,16 @@ Qcache_queries_in_cache 2 show status like "Qcache_hits"; Variable_name Value Qcache_hits 11 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 34 unlock table; drop view v1; set query_cache_wlock_invalidate=default; drop table t1,t2; +# +# Hiding real table stored in query cache by temporary table +# # On node-1 connection node_1; create table t1 (id int primary key) engine=innodb; @@ -1498,92 +1546,119 @@ SELECT a,'Â','â'='Â' FROM t1; a  'â'='Â' à  0 à  0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 1 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 12 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 43 set collation_connection=koi8r_bin; SELECT a,'Â','â'='Â' FROM t1; a  'â'='Â' à  0 à  0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 12 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 44 set character_set_client=cp1251; SELECT a,'Â','â'='Â' FROM t1; a ç? 'ç?'='ç?' à ç? 1 à ç? 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 3 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 12 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 45 set character_set_results=cp1251; SELECT a,'Â','â'='Â' FROM t1; a Ã? 'â'='Â' ö Ã? 1 ö Ã? 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 12 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 4 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 12 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 46 SET NAMES default; # On node-2 connection node_2; +# +# Run select +# SELECT a,'Â','â'='Â' FROM t1; a  'â'='Â' ?  0 ?  0 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 1 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 11 set collation_connection=koi8r_bin; SELECT a,'Â','â'='Â' FROM t1; a ?? 'â'='Â' ? ?? 1 ? ?? 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 11 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 36 set character_set_client=cp1251; SELECT a,'Â','â'='Â' FROM t1; a ?? '??'='?‚' ? ?? 1 ? ?? 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 3 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 11 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 37 set character_set_results=cp1251; SELECT a,'Â','â'='Â' FROM t1; a Ã? 'â'='Â' ö Ã? 1 ö Ã? 1 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 11 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 4 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 11 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 38 drop table t1; +# +# Comments before command +# # On node-1 connection node_1; create table t1 (a int) engine=innodb; @@ -1634,6 +1709,9 @@ show status like "Qcache_hits"; Variable_name Value Qcache_hits 12 drop table t1; +# +# Information schema & query cache test +# # On node-1 connection node_1; set session query_cache_type = 2; diff --git a/mysql-test/suite/galera/t/query_cache.test b/mysql-test/suite/galera/t/query_cache.test index e024b308fab..13b21eca6e7 100644 --- a/mysql-test/suite/galera/t/query_cache.test +++ b/mysql-test/suite/galera/t/query_cache.test @@ -448,6 +448,7 @@ select * from t1; select * from t1; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; +show status like "Qcache_inserts"; insert delayed into t1 values (4); --sleep 5 # Wait for insert delayed to be executed. select a from t1; @@ -474,6 +475,7 @@ show status like "Qcache_hits"; --connection node_1 show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; +show status like "Qcache_inserts"; # # Test of min result data unit size changing @@ -497,8 +499,9 @@ select * from t1; select * from t1; select * from t2; select * from t2; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_inserts"; --echo # On node-2 --connection node_2 @@ -506,13 +509,14 @@ select * from t1; select * from t1; select * from t2; select * from t2; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; drop table t1; select a from t2; select a from t2; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_inserts"; set GLOBAL query_cache_min_res_unit=default; show global variables like "query_cache_min_res_unit"; @@ -520,8 +524,9 @@ show global variables like "query_cache_min_res_unit"; --connection node_1 select a from t2; select a from t2; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_inserts"; drop table t2; set GLOBAL query_cache_min_res_unit=default; show global variables like "query_cache_min_res_unit"; @@ -537,6 +542,7 @@ select "aaa" from t1; select "AAA" from t1; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; +show status like "Qcache_inserts"; --echo # On node-2 --connection node_2 @@ -544,6 +550,7 @@ select "aaa" from t1; select "AAA" from t1; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; +show status like "Qcache_inserts"; drop table t1; # @@ -728,9 +735,9 @@ select count(*) from t1; drop table t1; -# -# INTO OUTFILE/DUMPFILE test -# +--echo # +--echo # INTO OUTFILE/DUMPFILE test +--echo # --echo # On node-1 --connection node_1 create table t1 (a int) engine=innodb; @@ -743,14 +750,15 @@ select * from t1 into outfile "query_cache.out.file"; select * from t1 limit 1 into dumpfile "query_cache.dump.file"; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; +show status like "Qcache_inserts"; drop table t1; let $datadir=`select @@datadir`; --remove_file $datadir/test/query_cache.dump.file --remove_file $datadir/test/query_cache.out.file -# -# Test of SQL_SELECT_LIMIT -# +--echo # +--echo # Test of SQL_SELECT_LIMIT +--echo # --echo # On node-1 --connection node_1 create table t1 (a int) engine=innodb; @@ -762,6 +770,7 @@ SET SQL_SELECT_LIMIT=1; select * from t1; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; +show status like "Qcache_inserts"; SET SQL_SELECT_LIMIT=DEFAULT; --echo # On node-2 @@ -777,9 +786,9 @@ SET SQL_SELECT_LIMIT=DEFAULT; drop table t1; -# -# WRITE LOCK & QC -# +--echo # +--echo # WRITE LOCK & QC +--echo # --echo # On node-1 --connection node_1 create table t1 (a int not null) engine=innodb; @@ -791,6 +800,7 @@ select * from t1; select * from t2; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; +show status like "Qcache_inserts"; lock table t1 write, t2 read; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; @@ -802,6 +812,7 @@ show status like "Qcache_hits"; lock table v1 write; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; +show status like "Qcache_inserts"; unlock table; drop view v1; set query_cache_wlock_invalidate=default; @@ -825,15 +836,16 @@ show status like "Qcache_hits"; lock table v1 write; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; +show status like "Qcache_inserts"; unlock table; drop view v1; set query_cache_wlock_invalidate=default; drop table t1,t2; -# -# Hiding real table stored in query cache by temporary table -# +--echo # +--echo # Hiding real table stored in query cache by temporary table +--echo # --echo # On node-1 --connection node_1 create table t1 (id int primary key) engine=innodb; @@ -866,66 +878,76 @@ INSERT INTO t1 VALUES (_koi8r 0xc3),(_koi8r 0xc3); # Run select # SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_inserts"; # # Change collation_connection and run the same query again # set collation_connection=koi8r_bin; SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_inserts"; # # Now change character_set_client and run the same query again # set character_set_client=cp1251; SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_inserts"; # # And finally change character_set_results and run the same query again # set character_set_results=cp1251; SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_inserts"; SET NAMES default; --echo # On node-2 --connection node_2 -# -# Run select -# + +--echo # +--echo # Run select +--echo # + SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; # # Change collation_connection and run the same query again # set collation_connection=koi8r_bin; SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_inserts"; # # Now change character_set_client and run the same query again # set character_set_client=cp1251; SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_inserts"; # # And finally change character_set_results and run the same query again # set character_set_results=cp1251; SELECT a,'Â','â'='Â' FROM t1; -show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; +show status like "Qcache_hits"; +show status like "Qcache_inserts"; drop table t1; -# -# Comments before command -# +--echo # +--echo # Comments before command +--echo # + --echo # On node-1 --connection node_1 create table t1 (a int) engine=innodb; @@ -951,9 +973,10 @@ show status like "Qcache_hits"; drop table t1; -# -# Information schema & query cache test -# +--echo # +--echo # Information schema & query cache test +--echo # + --echo # On node-1 --connection node_1 set session query_cache_type = 2;