-- source include/have_query_cache.inc -- source include/long_test.inc -- source include/no_valgrind_without_big.inc -- source include/no_view_protocol.inc set @save_query_cache_size=@@query_cache_size; # # Tests with query cache # SET GLOBAL query_cache_type= Off; SET LOCAL query_cache_type= Off; SET LOCAL query_cache_type= 0; --error ER_QUERY_CACHE_IS_GLOBALY_DISABLED SET LOCAL query_cache_type= on; --error ER_QUERY_CACHE_IS_GLOBALY_DISABLED SET LOCAL query_cache_type= 1; set GLOBAL query_cache_size=1355776; SET GLOBAL query_cache_type= ON; SET LOCAL query_cache_type= ON; # Reset query cache variables. flush query cache; # This crashed in some versions flush query cache; # This crashed in some versions reset query cache; flush 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; # Fix possible left overs from other tests drop table if exists ```a`; drop view if exists v1; --enable_warnings # # First simple test # create table t1 (a int not null); insert into t1 values (1),(2),(3); select * from t1; select * from t1; select sql_no_cache * from t1; select length(now()) from t1; # Only check the variables that are independent of the machine and startup # options show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; drop table t1; show status like "Qcache_queries_in_cache"; # # MERGE TABLES with INSERT/UPDATE and DELETE # create table t1 (a int not null) ENGINE=MyISAM; insert into t1 values (1),(2),(3); create table t2 (a int not null) ENGINE=MyISAM; insert into t2 values (4),(5),(6); create table t3 (a int not null) engine=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST; # insert select * from t3; select * from t3; show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; insert into t2 values (7); show status like "Qcache_queries_in_cache"; select * from t1; select * from t1; show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; insert into t3 values (8); show status like "Qcache_queries_in_cache"; # update select * from t3; show status like "Qcache_queries_in_cache"; update t2 set a=9 where a=7; show status like "Qcache_queries_in_cache"; select * from t1; show status like "Qcache_queries_in_cache"; update t3 set a=10 where a=1; show status like "Qcache_queries_in_cache"; #delete select * from t3; show status like "Qcache_queries_in_cache"; delete from t2 where a=9; show status like "Qcache_queries_in_cache"; select * from t1; show status like "Qcache_queries_in_cache"; delete from t3 where a=10; show status like "Qcache_queries_in_cache"; drop table t1, t2, t3; # # SELECT SQL_CACHE ... # set query_cache_type=demand; create table t1 (a int not null); insert into t1 values (1),(2),(3); select * from t1; show status like "Qcache_queries_in_cache"; select sql_cache * from t1 union select * from t1; set query_cache_type=2; select sql_cache * from t1 union select * from t1; show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; set query_cache_type=on; # # RESET QUERY CACHE # reset query cache; show status like "Qcache_queries_in_cache"; # # SELECT SQL_NO_CACHE # select sql_no_cache * from t1; show status like "Qcache_queries_in_cache"; drop table t1; # # Check that queries that uses NOW(), LAST_INSERT_ID()... are not cached. # create table t1 (a text not null); select CONNECTION_ID() from t1; #GET_LOCK #RELEASE_LOCK #LOAD_FILE select FOUND_ROWS(); select NOW() from t1; select CURDATE() from t1; select CURTIME() from t1; select DATABASE() from t1; select ENCRYPT("test") from t1; select LAST_INSERT_ID() from t1; select RAND() from t1; select UNIX_TIMESTAMP() from t1; select USER() from t1; select CURRENT_USER() from t1; select benchmark(1,1) from t1; explain extended select benchmark(1,1) from t1; show status like "Qcache_queries_in_cache"; # # Tests when the cache is filled # create table t2 (a text not null); insert into t1 values("1111111111111111111111111111111111111111111111111111"); insert into t2 select * from t1; insert into t1 select * from t2; # 2 insert into t2 select * from t1; # 3 insert into t1 select * from t2; # 5 insert into t2 select * from t1; # 8 insert into t1 select * from t2; # 13 insert into t2 select * from t1; # 21 insert into t1 select * from t2; # 34 insert into t2 select * from t1; # 55 insert into t1 select * from t2; # 89 insert into t2 select * from t1; # 144 insert into t1 select * from t2; # 233 insert into t2 select * from t1; # 357 insert into t1 select * from t2; # 610 insert into t2 select * from t1; # 987 insert into t1 select * from t2; # 1597 insert into t2 select * from t1; # 2584 insert into t1 select * from t2; # 4181 show status like "Qcache_hits"; show status like "Qcache_lowmem_prunes"; disable_result_log; select a as a1, a as a2 from t1; select a as a2, a as a3 from t1; select a as a3, a as a4 from t1; # next query must be out of 1Mb cache select a as a1, a as a2 from t1; enable_result_log; show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; show status like "Qcache_lowmem_prunes"; reset query cache; # # Query bigger then query_cache_limit # insert into t2 select * from t1; insert into t1 select * from t2; insert into t2 select * from t1; insert into t1 select * from t2; insert into t2 select * from t1; insert into t1 select * from t2; insert into t2 select * from t1; insert into t1 select * from t2; insert into t2 select * from t1; insert into t1 select * from t2; disable_result_log; select * from t1; enable_result_log; show status like "Qcache_queries_in_cache"; drop table t1,t2; # # noncachable ODBC work around (and prepare cache for drop database) # create database mysqltest; create table mysqltest.t1 (i int not null auto_increment, a int, primary key (i)); insert into mysqltest.t1 (a) values (1); select * from mysqltest.t1 where i is null; # # drop db # create table t1(a int); select * from t1; show status like "Qcache_queries_in_cache"; select * from mysqltest.t1; show status like "Qcache_queries_in_cache"; drop database mysqltest; show status like "Qcache_queries_in_cache"; drop table t1; # # Charset conversion (cp1251_koi8 always present) # create table t1 (a char(1) not null collate koi8r_general_ci); insert into t1 values(_koi8r"á"); set CHARACTER SET koi8r; select * from t1; set CHARACTER SET cp1251_koi8; select * from t1; set CHARACTER SET DEFAULT; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; drop table t1; # The following tests can't be done as the values differen on 32 and 64 bit # machines :( #show variables like "query_cache_size"; #show status like "Qcache_free_memory"; # # same tables in different db # create database if not exists mysqltest; create table mysqltest.t1 (i int not null); create table t1 (i int not null); insert into mysqltest.t1 (i) values (1); insert into t1 (i) values (2); select * from t1; use mysqltest; select * from t1; select * from t1; use test; select * from t1; show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; drop database mysqltest; drop table t1; # # FOUND_ROWS() # create table t1 (i int not null); insert into t1 (i) values (1),(2),(3),(4); select SQL_CALC_FOUND_ROWS * from t1 limit 2; select FOUND_ROWS(); show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; select * from t1 where i=1; select FOUND_ROWS(); show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; select SQL_CALC_FOUND_ROWS * from t1 limit 2; select FOUND_ROWS(); show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; select * from t1 where i=1; select FOUND_ROWS(); show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; drop table t1; # # Test insert delayed # flush query cache; reset query cache; create table t1 (a int not null) ENGINE=MyISAM; insert into t1 values (1),(2),(3); select * from t1; select * from t1; show status like "Qcache_queries_in_cache"; insert delayed into t1 values (4); --sleep 5 # Wait for insert delayed to be executed. select a from t1; show status like "Qcache_queries_in_cache"; drop table t1; show status like "Qcache_queries_in_cache"; # # Test of min result data unit size changing # show global variables like "query_cache_min_res_unit"; set GLOBAL query_cache_min_res_unit=1001; show global variables like "query_cache_min_res_unit"; create table t1 (a int not null); insert into t1 values (1),(2),(3); create table t2 (a int not null); insert into t2 values (1),(2),(3); select * from t1; select * from t1; select * from t2; select * from t2; show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; drop table t1; select a from t2; select a from t2; show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; drop table t2; set GLOBAL query_cache_min_res_unit=default; show global variables like "query_cache_min_res_unit"; # # Case sensitive test # create table t1 (a int not null); insert into t1 values (1); select "aaa" from t1; select "AAA" from t1; drop table t1; # # Test of query cache resizing # create table t1 (a int); set GLOBAL query_cache_size=1000; show global variables like "query_cache_size"; select * from t1; set GLOBAL query_cache_size=1024; show global variables like "query_cache_size"; select * from t1; set GLOBAL query_cache_size=10240; show global variables like "query_cache_size"; select * from t1; set GLOBAL query_cache_size=20480; show global variables like "query_cache_size"; select * from t1; set GLOBAL query_cache_size=40960; show global variables like "query_cache_size"; select * from t1; set GLOBAL query_cache_size=51200; show global variables like "query_cache_size"; select * from t1; set GLOBAL query_cache_size=61440; show global variables like "query_cache_size"; select * from t1; set GLOBAL query_cache_size=81920; show global variables like "query_cache_size"; select * from t1; set GLOBAL query_cache_size=102400; show global variables like "query_cache_size"; select * from t1; drop table t1; # # Temporary tables # set GLOBAL query_cache_size=1048576; create table t1 (i int not null); create table t2 (i int not null); select * from t1; show status like "Qcache_queries_in_cache"; create temporary table t3 (i int not null); select * from t2; show status like "Qcache_queries_in_cache"; select * from t3; show status like "Qcache_queries_in_cache"; update t1 set i=(select distinct 1 from (select * from t2) a); drop table t1, t2, t3; # # system databse test # use mysql; disable_result_log; select * from db; enable_result_log; show status like "Qcache_queries_in_cache"; use test; disable_result_log; select * from mysql.db; enable_result_log; show status like "Qcache_queries_in_cache"; # # simple rename test # create table t1(id int auto_increment primary key); insert into t1 values (NULL), (NULL), (NULL); select * from t1 where id=2; alter table t1 rename to t2; --error ER_NO_SUCH_TABLE select * from t1 where id=2; drop table t2; --error ER_NO_SUCH_TABLE select * from t1 where id=2; # # Load data invalidation test # create table t1 (word char(20) not null); select * from t1; show status like "Qcache_queries_in_cache"; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval load data infile '$MYSQLTEST_VARDIR/std_data/words.dat' into table t1; show status like "Qcache_queries_in_cache"; select count(*) from t1; drop table t1; # # INTO OUTFILE/DUMPFILE test # create table t1 (a int); insert into t1 values (1),(2),(3); show status like "Qcache_queries_in_cache"; --enable_prepare_warnings select * from t1 into outfile "query_cache.out.file"; --error ER_FILE_EXISTS_ERROR select * from t1 into outfile "query_cache.out.file"; select * from t1 limit 1 into dumpfile "query_cache.dump.file"; --disable_prepare_warnings show status like "Qcache_queries_in_cache"; 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 # create table t1 (a int); insert into t1 values (1),(2); show status like "Qcache_queries_in_cache"; select * from t1; SET SQL_SELECT_LIMIT=1; select * from t1; show status like "Qcache_queries_in_cache"; SET SQL_SELECT_LIMIT=DEFAULT; drop table t1; # # query cache crash on using same table twice in one query test # flush query cache; reset query cache; flush status; set GLOBAL query_cache_size=1048576; create table t1 (a int not null); insert into t1 values (1),(2),(3); create table t2 (a text not null); create table t3 (a text not null); insert into t3 values("1111111111111111111111111111111111111111111111111111"); insert into t2 select * from t3; insert into t3 select * from t2; insert into t2 select * from t3; insert into t3 select * from t2; insert into t2 select * from t3; insert into t3 select * from t2; insert into t2 select * from t3; insert into t3 select * from t2; insert into t2 select * from t3; insert into t3 select * from t2; drop table t2; create table t2 (a int not null); insert into t2 values (1),(2),(3); create table t4 (a int not null); insert into t4 values (1),(2),(3); disable_result_log; select * from t4; select * from t2; select * from t1 as tt, t1 as ttt where tt.a=1 and ttt.a=2; select * from t2; select * from t4; select * from t1 as tt, t1 as ttt where tt.a=1 and ttt.a=2; select * from t2; select * from t4; select * from t1 as tt, t1 as ttt where tt.a=1 and ttt.a=2; delete from t2 where a=1; flush query cache; select * from t3; enable_result_log; delete from t4 where a=1; flush query cache; drop table t1,t2,t3,t4; # # WRITE LOCK & QC # set query_cache_wlock_invalidate=1; create table t1 (a int not null); create table t2 (a int not null); create view v1 as select * from t1; select * from t1; select * from t2; show status like "Qcache_queries_in_cache"; lock table t1 write, t2 read; show status like "Qcache_queries_in_cache"; unlock table; select * from t1; # Implicit locking of t1 does not invalidate QC show status like "Qcache_queries_in_cache"; lock table v1 write; show status like "Qcache_queries_in_cache"; unlock table; drop view v1; drop table t1,t2; set query_cache_wlock_invalidate=default; # # hiding real table stored in query cache by temporary table # CREATE TABLE t1 (id INT PRIMARY KEY); insert into t1 values (1),(2),(3); select * from t1; create temporary table t1 (a int not null auto_increment primary key); select * from t1; drop table t1; drop table t1; # # Test character set related variables: # character_set_result # character_set_client # charactet_set_connection/collation_connection # If at least one of the above variables has changed, # the cached query can't be reused. In the below test # absolutely the same query is used several times, # SELECT should fetch different results for every instance. # No hits should be produced. # New cache entry should appear for every SELECT. # SET NAMES koi8r; CREATE TABLE t1 (a char(1) character set koi8r); INSERT INTO t1 VALUES (_koi8r'á'),(_koi8r'Á'); # # Run select # SELECT a,'Â','â'='Â' FROM t1; show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; # # 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"; # # 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"; # # 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"; SET NAMES default; DROP TABLE t1; # # DROP current database test # CREATE TABLE t1 (a int(1)); CREATE DATABASE mysqltest; USE mysqltest; DROP DATABASE mysqltest; SELECT * FROM test.t1; USE test; DROP TABLE t1; # # charset with NULL # set character_set_results=null; select @@character_set_results; set character_set_results=default; # # query cache and environment variables # # max_sort_length set GLOBAL query_cache_size=1355776; create table t1 (id int auto_increment primary key, c char(65)); insert into t1 set c = repeat('x',24); insert into t1 set c = concat(repeat('x',64),'x'); insert into t1 set c = concat(repeat('x',64),'w'); insert into t1 set c = concat(repeat('x',64),'y'); set max_sort_length=200; select c from t1 order by c, id; reset query cache; set max_sort_length=64; select c from t1 order by c, id; set max_sort_length=200; select c from t1 order by c, id; set max_sort_length=default; # sql_mode select '1' || '3' from t1; set SQL_MODE=oracle; select '1' || '3' from t1; set SQL_MODE=default; drop table t1; # group_concat_max_len create table t1 (a varchar(20), b int); insert into t1 values ('12345678901234567890', 1); set group_concat_max_len=10; select group_concat(a) FROM t1 group by b; set group_concat_max_len=1024; select group_concat(a) FROM t1 group by b; set group_concat_max_len=default; drop table t1; # comments before command # create table t1 (a int); show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; /**/ select * from t1; /**/ select * from t1; show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; # # Keep things tidy # DROP TABLE t1; SET GLOBAL query_cache_size=0; # # Information schema & query cache test # SET SESSION query_cache_type = 2; create table t1(a int); select table_name from information_schema.tables where table_schema="test"; drop table t1; select table_name from information_schema.tables where table_schema="test"; # Bug #8480: REPAIR TABLE needs to flush the table from the query cache SET SESSION query_cache_type = 1; set global query_cache_size=1024*1024; flush query cache; create table t1 ( a int ); insert into t1 values (1); select a from t1; select a from t1; show status like 'qcache_queries_in_cache'; repair table t1; show status like 'qcache_queries_in_cache'; drop table t1; # # Bug #9549: Make sure cached queries that span more than one cache block # are handled properly in the embedded server. # # We just want a small query cache, so we can fragment it easily set GLOBAL query_cache_size=64*1024; # This actually gives us a usable cache size of about 48K # Each table is about 14K create table t1 (a text); insert into t1 values (repeat('abcdefghijklmnopqrstuvwxyz', 550)); create table t2 (a text); insert into t2 values (repeat('ijklmnopqrstuvwxyzabcdefgh', 550)); # Load a query from each table into the query cache --disable_result_log select a from t1; # Q1 select a from t2; # Q2 --enable_result_log show status like 'Qcache_%_blocks'; # Now the cache looks like (14K for Q1)(14K for Q2)(20K free) # Flush Q1 from the cache by adding an out-of-order chunk to t1 insert into t1 select reverse(a) from t1; show status like 'Qcache_%_blocks'; # Now the cache looks like (14K free)(14K for Q2)(20K free) # Load our new data into the query cache --disable_result_log select a from t1; # Q3 --enable_result_log show status like 'Qcache_%_blocks'; # Now the cache should be like (14K for Q3)(14K for Q2)(14K for Q3)(6K free) # Note that Q3 is split across two chunks! # Load Q3 from the cache, and actually pay attention to the results select a from t1; flush query cache; drop table t1, t2; set GLOBAL query_cache_size=1355776; # # Query with warning prohibited to query cache (BUG#9414) # flush status; CREATE TABLE t1 ( `date` datetime NOT NULL default '0000-00-00 00:00:00', KEY `date` (`date`) ) ENGINE=MyISAM; INSERT INTO t1 VALUES ('20050326'); INSERT INTO t1 VALUES ('20050325'); SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050327 invalid'; SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050328 invalid'; SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050327 invalid'; show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; drop table t1; # # queries with subquery in the FROM clause (BUG#11522) # create table t1 (a int); insert into t1 values (1); reset query cache; flush status; select * from (select * from t1) a; show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; select * from (select * from t1) a; show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; insert into t1 values (2); show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; select * from (select * from t1) a; show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; drop table t1; # # BUG#14652: Queries with leading '(' characters. # create table t1 (a int); flush status; (select a from t1) union (select a from t1); show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; (select a from t1) union (select a from t1); show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; set query_cache_strip_comments=1; (select a from t1) union (select a from t1); (select a from t1) /* */union (select a from t1); set query_cache_strip_comments=0; (select a from t1) union (select a from t1); show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; drop table t1; # # SP cursors and selects with query cache (BUG#9715) # create table t1 (a int); insert into t1 values (1),(2); --disable_warnings drop procedure if exists p1; --enable_warnings delimiter //; CREATE PROCEDURE `p1`() begin Declare c1 cursor for select a from t1; open c1; select * from t1; end// call p1()// drop procedure p1// --enable_prepare_warnings create function f1() returns int begin Declare var1 int; select max(a) from t1 into var1; return var1; end// --disable_prepare_warnings create procedure `p1`() begin select a, f1() from t1; end// SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators// SET GLOBAL log_bin_trust_function_creators = 1// call p1()// SET GLOBAL log_bin_trust_function_creators = @old_log_bin_trust_function_creators// drop procedure p1// drop function f1// drop table t1// delimiter ;// # # query in QC from normal execution and SP (BUG#6897) # improved to also test BUG#3583 and BUG#12990 # flush query cache; reset query cache; flush status; delimiter //; create table t1 (s1 int)// create procedure f1 () begin select sql_cache * from t1; select sql_cache * from t1; select sql_cache * from t1; end;// create procedure f2 () begin select sql_cache * from t1 where s1=1; select sql_cache * from t1; end;// create procedure f3 () begin select sql_cache * from t1; select sql_cache * from t1 where s1=1; end;// create procedure f4 () begin select sql_cache * from t1; select sql_cache * from t1 where s1=1; select sql_cache * from t1; select sql_cache * from t1 where s1=1; select sql_cache * from t1 where s1=1; end;// delimiter ;// call f1(); call f1(); call f1(); select sql_cache * from t1; insert into t1 values (1); select sql_cache * from t1; call f1(); call f1(); select sql_cache * from t1; flush query cache; reset query cache; flush status; select sql_cache * from t1; select sql_cache * from t1 where s1=1; call f1(); call f2(); call f3(); call f4(); call f4(); call f3(); call f2(); select sql_cache * from t1 where s1=1; insert into t1 values (2); call f1(); select sql_cache * from t1 where s1=1; select sql_cache * from t1; call f1(); call f3(); call f3(); call f1(); drop procedure f1; drop procedure f2; drop procedure f3; drop procedure f4; drop table t1; set GLOBAL query_cache_size=0; --echo End of 4.1 tests # # Bug #10303: problem with last_query_cost # SET GLOBAL query_cache_size=102400; create table t1(a int); insert into t1 values(0), (1), (4), (5); select * from t1 where a > 3; select * from t1 where a > 3; show status like 'last_query_cost'; drop table t1; 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; create table t1 (a int); insert into t1 (a) values (1), (2), (3); select * from t1; show status like 'Qcache_hits'; select * from t1; show status like 'Qcache_hits'; create table t2 like t1; select * from t1; show status like 'Qcache_hits'; insert into t2 select * from t1; select * from t1; show status like 'Qcache_hits'; drop table t1, t2; create table t1(c1 int); create table t2(c1 int); create table t3(c1 int); create view v1 as select t3.c1 as c1 from t3,t2 where t3.c1 = t2.c1; start transaction; insert into t1(c1) select c1 from v1; drop table t1, t2, t3; drop view v1; # # If running with --ps-protocol: # see if a query from the text protocol is served with results cached # from a query which used the binary (which would be wrong, results # are in different formats); if that happens, the results will # be incorrect and the test will fail. # create table t1(c1 int); insert into t1 values(1),(10),(100); select * from t1; -- disable_ps_protocol select * from t1; select * from t1; -- enable_ps_protocol select * from t1; drop table t1; set global query_cache_size=0; # # Query cache and changes to system variables # create table t1 (a int); insert into t1 values (1),(2),(3); set GLOBAL query_cache_type=1; set GLOBAL query_cache_limit=10240; set GLOBAL query_cache_min_res_unit=0; set GLOBAL query_cache_size= 102400; # default_week_format reset query cache; set LOCAL default_week_format = 0; select week('2007-01-04'); select week('2007-01-04') from t1; select extract(WEEK FROM '2007-01-04') from t1; set LOCAL default_week_format = 2; select week('2007-01-04'); select week('2007-01-04') from t1; select extract(WEEK FROM '2007-01-04') from t1; # div_precision_increment reset query cache; set LOCAL div_precision_increment=2; select 1/7; select 1/7 from t1; set LOCAL div_precision_increment=4; select 1/7; select 1/7 from t1; drop table t1; CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)); INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'), ('Full-text indexes', 'are called collections'), ('Only MyISAM tables','support collections'), ('Function MATCH ... AGAINST()','is used to do a search'), ('Full-text search in MySQL', 'implements vector space model'); set GLOBAL ft_boolean_syntax='+ -><()~*:""&|'; select *, MATCH(a,b) AGAINST("+called +collections" IN BOOLEAN MODE) as x from t1; # swap +/- set GLOBAL ft_boolean_syntax='- +><()~*:""&|'; select *, MATCH(a,b) AGAINST("+called +collections" IN BOOLEAN MODE) as x from t1; # If in the future we need to cache queries with functions # be sure not to cause dead lock if the query cache is flushed # while inserting a query in the query cache. delimiter |; create function change_global() returns integer deterministic begin set global ft_boolean_syntax='+ -><()~*:""&|'; return 1; end| delimiter ;| select *, change_global() from t1; drop function change_global; drop table t1; set GLOBAL query_cache_type=default; set GLOBAL query_cache_limit=default; set GLOBAL query_cache_min_res_unit=default; set GLOBAL query_cache_size= default; # # Bug#28897 UUID() returns non-unique values when query cache is enabled # set GLOBAL query_cache_size=1024000; create table t1 (a char); insert into t1 values ('c'); let $q1= `select UUID(), a from t1`; let $q2= `select UUID(), a from t1`; # disabling the logging of the query because the UUIDs are different each run. --disable_query_log eval select a from t1 where "$q1" = "$q2"; --enable_query_log drop table t1; set GLOBAL query_cache_size= default; # # Bug #29053 SQL_CACHE in UNION causes non-deterministic functions to be cached # # This syntax is no longer allowed, therefore the test case has been commented # out. # See test for Bug#35020 below. #set GLOBAL query_cache_size=1000000; # #create table t1 (a char); #insert into t1 values ('c'); # #let $q1= `select RAND() from t1 union select sql_cache 1 from t1;`; #let $q2= `select RAND() from t1 union select sql_cache 1 from t1;`; # # disabling the logging of the query because the times are different each run. #--disable_query_log #eval select a from t1 where "$q1" = "$q2"; #--enable_query_log # #drop table t1; # #set GLOBAL query_cache_size= default; # # Bug#29856: Insufficient buffer space led to a server crash. # SET GLOBAL query_cache_size=64*1024*1024; CREATE TABLE t1 (id INT); DELIMITER |; CREATE PROCEDURE proc29856(IN theUPC TEXT) BEGIN SET @stmtStr := ''; SELECT CONCAT("SELECT id FROM t1 WHERE id IN (",theUPC,")") INTO @stmtStr; PREPARE stmt FROM @stmtStr; EXECUTE stmt; END | DELIMITER ;| CALL proc29856('1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50, 51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76, 77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101, 102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120, 121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139, 140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158, 159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177, 178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196, 197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215, 216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234, 235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253, 254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272, 273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291, 292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310, 311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329, 330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348, 349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367, 368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386, 387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405, 406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424, 425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443, 444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462, 463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481, 482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500, 501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519, 520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538, 539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557, 558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576, 577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595, 596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614, 615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633, 634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652, 653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671, 672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690, 691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709, 710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728, 729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747, 748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766, 767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785, 786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804, 805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823, 824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842, 843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861, 862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880, 881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899, 900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918, 919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937, 938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956, 957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975, 976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994, 995,996,997,998,999,1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010, 1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023,1024,1025, 1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,1040, 1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055, 1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070, 1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085, 1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100, 1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115, 1116,1117,1118,1119,1120,1121,1122,1123,1124,1125,1126,1127,1128,1129,1130, 1131,1132,1133,1134,1135,1136,1137,1138,1139,1140,1141,1142,1143,1144,1145, 1146,1147,1148,1149,1150,1151,1152,1153,1154,1155,1156,1157,1158,1159,1160, 1161,1162,1163,1164,1165,1166,1167,1168,1169,1170,1171,1172,1173,1174,1175, 1176,1177,1178,1179,1180,1181,1182,1183,1184,1185,1186,1187,1188,1189,1190, 1191,1192,1193,1194,1195,1196,1197,1198,1199,1200,1201,1202,1203,1204,1205, 1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1219,1220, 1221,1222,1223,1224,1225,1226,1227,1228,1229,1230,1231,1232,1233,1234,1235, 1236,1237,1238,1239,1240,1241,1242,1243,1244,1245,1246,1247,1248,1249,1250, 1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265, 1266,1267,1268,1269,1270,1271,1272,1273,1274,1275,1276,1277,1278,1279,1280, 1281,1282,1283,1284,1285,1286,1287,1288,1289,1290,1291,1292,1293,1294,1295, 1296,1297,1298,1299,1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1310, 1311,1312,1313,1314,1315,1316,1317,1318,1319,1320,1321,1322,1323,1324,1325, 1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340, 1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355, 1356,1357,1358,1359,1360,1361,1362,1363,1364,1365,1366,1367,1368,1369,1370, 1371,1372,1373,1374,1375,1376,1377,1378,1379,1380,1381,1382,1383,1384,1385, 1386,1387,1388,1389,1390,1391,1392,1393,1394,1395,1396,1397,1398,1399,1400, 1401,1402,1403,1404,1405,1406,1407,1408,1409,1410,1411,1412,1413,1414,1415, 1416,1417,1418,1419,1420,1421,1422,1423,1424,1425,1426,1427,1428,1429,1430, 1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445, 1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460, 1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475, 1476,1477,1478,1479,1480,1481,1482,1483,1484,1485,1486,1487,1488,1489,1490, 1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505, 1506,1507,1508,1509,1510,1511,1512,1513,1514,1515,1516,1517,1518,1519,1520, 1521,1522,1523,1524,1525,1526,1527,1528,1529,1530,1531,1532,1533,1534,1535, 1536,1537,1538,1539,1540,1541,1542,1543,1544,1545,1546,1547,1548,1549,1550, 1551,1552,1553,1554,1555,1556,1557,1558,1559,1560,1561,1562,1563,1564,1565, 1566,1567,1568,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580, 1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,1595, 1596,1597,1598,1599,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610, 1611,1612,1613,1614,1615,1616,1617,1618,1619,1620,1621,1622,1623,1624,1625, 1626,1627,1628,1629,1630,1631,1632,1633,1634,1635,1636,1637,1638,1639,1640, 1641,1642,1643,1644,1645,1646,1647,1648,1649,1650,1651,1652,1653,1654,1655, 1656,1657,1658,1659,1660,1661,1662,1663,1664,1665,1666,1667,1668,1669,1670, 1671,1672,1673,1674,1675,1676,1677,1678,1679,1680,1681,1682,1683,1684,1685, 1686,1687,1688,1689,1690,1691,1692,1693,1694,1695,1696,1697,1698,1699,1700, 1701,1702,1703,1704,1705,1706,1707,1708,1709,1710,1711,1712,1713,1714,1715, 1716,1717,1718,1719,1720,1721,1722,1723,1724,1725,1726,1727,1728,1729,1730, 1731,1732,1733,1734,1735,1736,1737,1738,1739,1740,1741,1742,1743,1744,1745, 1746,1747,1748,1749,1750,1751,1752,1753,1754,1755,1756,1757,1758,1759,1760, 1761,1762,1763,1764,1765,1766,1767,1768,1769,1770,1771,1772,1773,1774,1775, 1776,1777,1778,1779,1780,1781,1782,1783,1784,1785,1786,1787,1788,1789,1790, 1791,1792,1793,1794,1795,1796,1797,1798,1799,1800,1801,1802,1803,1804,1805, 1806,1807,1808,1809,1810,1811'); DROP PROCEDURE proc29856; DROP TABLE t1; SET GLOBAL query_cache_size= default; # --echo # --echo # Bug#25132 disabled query cache: Qcache_free_blocks = 1 --echo # set global query_cache_size=102400; set global query_cache_size=0; set global query_cache_type=0; show status like 'Qcache_free_blocks'; set global query_cache_size=102400; show status like 'Qcache_free_blocks'; set global query_cache_type=on; set session query_cache_type=on; --echo Restore default values. --disable_warnings drop database if exists db1; drop database if exists db2; --enable_warnings set GLOBAL query_cache_size=15*1024*1024; create database db1; use db1; create table t1(c1 int)engine=myisam; insert into t1(c1) values (1); select * from db1.t1 f; show status like 'Qcache_queries_in_cache'; create database db2; rename table db1.t1 to db2.t2; drop database db1; show status like 'Qcache_queries_in_cache'; drop database db2; set global query_cache_size=@save_query_cache_size; --disable_warnings drop database if exists db1; drop database if exists db3; --enable_warnings set GLOBAL query_cache_size=15*1024*1024; create database db1; create database db3; use db1; create table t1(c1 int) engine=myisam; use db3; create table t1(c1 int) engine=myisam; use db1; insert into t1(c1) values (1); use test; select * from db1.t1; select c1+1 from db1.t1; select * from db3.t1; show status like 'Qcache_queries_in_cache'; create database db2; rename table db1.t1 to db2.t2; drop database db1; show status like 'Qcache_queries_in_cache'; drop database db2; drop database db3; set GLOBAL query_cache_type=default; set GLOBAL query_cache_limit=default; set GLOBAL query_cache_min_res_unit=default; 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; # # Bug#33756 - query cache with concurrent_insert=0 appears broken # FLUSH STATUS; SET GLOBAL query_cache_size=10*1024*1024; SET @save_concurrent_insert= @@concurrent_insert; SET GLOBAL concurrent_insert= 0; CREATE TABLE t1 (c1 INT NOT NULL) ENGINE=MyISAM; INSERT INTO t1 (c1) VALUES (1), (2); # SHOW GLOBAL VARIABLES LIKE 'concurrent_insert'; SHOW STATUS LIKE 'Qcache_hits'; SELECT * FROM t1; SELECT * FROM t1; SHOW STATUS LIKE 'Qcache_hits'; DROP TABLE t1; SET GLOBAL concurrent_insert= @save_concurrent_insert; SET GLOBAL query_cache_size= default; # # Bug#36326: nested transaction and select # --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings FLUSH STATUS; SET GLOBAL query_cache_size=1048576; CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(2),(3),(4),(5); SHOW STATUS LIKE 'Qcache_queries_in_cache'; SELECT * FROM t1; BEGIN; SELECT * FROM t1; COMMIT; SHOW STATUS LIKE 'Qcache_queries_in_cache'; SHOW STATUS LIKE "Qcache_hits"; SELECT * FROM t1; BEGIN; SELECT * FROM t1; COMMIT; SHOW STATUS LIKE "Qcache_hits"; DROP TABLE t1; SET GLOBAL query_cache_size= default; # # Bug#6760: Add SLEEP() function (feature request) # # Logics of original test: # Reveal that a query with SLEEP does not need less time than estimated. # # Bug#12689: SLEEP() gets incorrectly cached/optimized-away # # Description from bug report (slightly modified) # # Bug 1 (happened all time): # SELECT * FROM t1 WHERE SLEEP(1) will only result in a sleep of 1 # second, regardless of the number of rows in t1. # Bug 2 (happened all time): # Such a query will also get cached by the query cache, but should not. # # Notes (mleich, 2008-05) # ======================= # # Experiments around # Bug#36345 Test 'func_misc' fails on RHAS3 x86_64 # showed that the tests for both bugs could produce in case of parallel # artificial system time (like via ntpd) # - decreases false alarm # - increases false success # # We try here to circumvent these issues by reimplementation of the tests # and sophisticated scripting, although the cause of the problems is a massive # error within the setup of the testing environment. # Tests relying on or checking derivates of the system time must never meet # parallel manipulations of system time. # # Results of experiments with/without manipulation of system time, # information_schema.processlist content, high load on testing box # ---------------------------------------------------------------- # Definition: Predicted_cumulative_sleep_time = # #_of_result_rows * sleep_time_per_result_row # # 1. Total (real sleep time) ~= predicted_cumulative_sleep_time !! # 2. The state of a session within the PROCESSLIST changes to 'User sleep' # if the sessions runs a statement containing the sleep function and the # processing of the statement is just within the phase where the sleep # is done. (*) # 3. NOW() and processlist.time behave "synchronous" to system time and # show also the "jumps" caused by system time manipulations. (*) # 4. processlist.time is unsigned, the "next" value below 0 is ~ 4G (*) # 5. Current processlist.time ~= current real sleep time if the system time # was not manipulated. (*) # 6. High system load can cause delays of <= 2 seconds. # 7. Thanks to Davi for excellent hints and ideas. # # (*) # - information_schema.processlist is not available before MySQL 5.1. # - Observation of processlist content requires a # - "worker" session sending the query with "send" and pulling results # with "reap" # - session observing the processlist parallel to the worker session # "send" and "reap" do not work in case of an embedded server. # Conclusion: Tests based on processlist have too many restrictions. # # Solutions for subtests based on TIMEDIFF of values filled via NOW() # ------------------------------------------------------------------- # Run the following sequence three times # 1. SELECT # 2. Query with SLEEP # 3. SELECT # If TIMEDIFF(,) is at least two times within a # reasonable range assume that we did not met errors we were looking for. # # It is extreme unlikely that we have two system time changes within the # < 30 seconds runtime. Even if the unlikely happens, there are so # frequent runs of this test on this or another testing box which will # catch the problem. # --echo #------------------------------------------------------------------------ --echo # Tests for Bug#6760 and Bug#12689 # Number of rows within the intended result set. SET @row_count = 4; # Parameter within SLEEP function SET @sleep_time_per_result_row = 1; # Maximum acceptable delay caused by high load on testing box SET @max_acceptable_delay = 2; # TIMEDIFF = time for query with sleep (mostly the time caused by SLEEP) # + time for delays caused by high load on testing box # Ensure that at least a reasonable fraction of TIMEDIFF belongs to the SLEEP # by appropriate setting of variables. # Ensure that any "judging" has a base of minimum three attempts. # (Test 2 uses all attempts except the first one.) if (!` SELECT (@sleep_time_per_result_row * @row_count - @max_acceptable_delay > @sleep_time_per_result_row) AND (@row_count - 1 >= 3)`) { --echo # Have to abort because of error in plausibility check --echo ###################################################### --vertical_results SELECT @sleep_time_per_result_row * @row_count - @max_acceptable_delay > @sleep_time_per_result_row AS must_be_1, @row_count - 1 >= 3 AS must_be_also_1, @sleep_time_per_result_row, @row_count, @max_acceptable_delay; exit; } SET @@global.query_cache_size = 1024 * 64; --disable_warnings DROP TEMPORARY TABLE IF EXISTS t_history; DROP TABLE IF EXISTS t1; --enable_warnings CREATE TEMPORARY TABLE t_history (attempt SMALLINT, start_ts DATETIME, end_ts DATETIME, start_cached INTEGER, end_cached INTEGER); CREATE TABLE t1 (f1 BIGINT); let $num = `SELECT @row_count`; --disable_query_log begin; while ($num) { INSERT INTO t1 VALUES (1); dec $num; } commit; --enable_query_log let $loops = 4; let $num = $loops; while ($num) { let $Qcache_queries_in_cache = query_get_value(SHOW STATUS LIKE 'Qcache_queries_in_cache', Value, 1); eval INSERT INTO t_history SET attempt = $loops - $num + 1, start_ts = NOW(), start_cached = $Qcache_queries_in_cache; SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1; # # Do not determine Qcache_queries_in_cache before updating end_ts. The SHOW # might cost too much time on an overloaded box. eval UPDATE t_history SET end_ts = NOW() WHERE attempt = $loops - $num + 1; let $Qcache_queries_in_cache = query_get_value(SHOW STATUS LIKE 'Qcache_queries_in_cache', Value, 1); eval UPDATE t_history SET end_cached = $Qcache_queries_in_cache WHERE attempt = $loops - $num + 1; # DEBUG eval SELECT * FROM t_history WHERE attempt = $loops - $num + 1; dec $num; } # 1. The majority of queries with SLEEP must need a reasonable time # -> SLEEP has an impact on runtime # = Replacement for original Bug#6760 test # -> total runtime is clear more needed than for one result row needed # = Replacement for one of the original Bug#12689 tests --echo # Test 1: Does the query with SLEEP need a reasonable time? eval SELECT COUNT(*) >= $loops - 1 INTO @aux1 FROM t_history WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count BETWEEN 0 AND @max_acceptable_delay; SELECT @aux1 AS "Expect 1"; # # 2. The majority of queries (the first one must be ignored) with SLEEP must # need a reasonable time # -> If we assume that the result of a cached query will be sent back # immediate, without any sleep, than the query with SLEEP cannot be cached # (current and intended behaviour for queries with SLEEP). # -> It could be also not excluded that the query was cached but the server # honoured somehow the SLEEP. Such a behaviour would be also acceptable. # = Replacement for one of the original Bug#12689 tests --echo # Test 2: Does the query with SLEEP need a reasonable time even in case --echo # of the non first execution? eval SELECT COUNT(*) >= $loops - 1 - 1 INTO @aux2 FROM t_history WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count BETWEEN 0 AND @max_acceptable_delay AND attempt > 1; SELECT @aux2 AS "Expect 1"; # # 3. The query with SLEEP should be not cached. # -> SHOW STATUS Qcache_queries_in_cache must be not incremented after # the execution of the query with SLEEP --echo # Test 3: The query with SLEEP must be not cached. eval SELECT COUNT(*) = $loops INTO @aux3 FROM t_history WHERE end_cached = start_cached; SELECT @aux3 AS "Expect 1"; # # Dump the content of t_history if one of the tests failed. if (`SELECT @aux1 + @aux2 + @aux3 <> 3`) { --echo # Some tests failed, dumping the content of t_history SELECT * FROM t_history; } DROP TABLE t1; DROP TEMPORARY TABLE t_history; SET @@global.query_cache_size = default; --echo End of 5.0 tests # # Bug #31157: Crash when select+order by the avg of some field within the # group by # SET GLOBAL query_cache_size=1024*1024*512; CREATE TABLE t1 (a ENUM('rainbow')); INSERT INTO t1 VALUES (),(),(),(),(); SELECT 1 FROM t1 GROUP BY (SELECT 1 FROM t1 ORDER BY AVG(LAST_INSERT_ID())); DROP TABLE t1; CREATE TABLE t1 (a LONGBLOB); INSERT INTO t1 SET a = 'aaaa'; INSERT INTO t1 SET a = 'aaaa'; SELECT 1 FROM t1 GROUP BY (SELECT LAST_INSERT_ID() FROM t1 ORDER BY MIN(a) ASC LIMIT 1); DROP TABLE t1; SET GLOBAL query_cache_size= default; # # Bug#35020: illegal sql_cache select syntax # CREATE TABLE t1( a INT ); --error ER_CANT_USE_OPTION_HERE SET @v = ( SELECT SQL_CACHE 1 ); --error ER_CANT_USE_OPTION_HERE SET @v = ( SELECT SQL_NO_CACHE 1 ); # # Keywords 'SQL_CACHE' and 'SQL_NO_CACHE'. # --error ER_CANT_USE_OPTION_HERE SELECT a FROM t1 WHERE a IN ( SELECT SQL_CACHE a FROM t1 ); --error ER_CANT_USE_OPTION_HERE SELECT a FROM t1 WHERE a IN ( SELECT SQL_NO_CACHE a FROM t1 ); --error ER_CANT_USE_OPTION_HERE SELECT ( SELECT SQL_CACHE a FROM t1 ); --error ER_CANT_USE_OPTION_HERE SELECT ( SELECT SQL_NO_CACHE a FROM t1 ); SELECT SQL_CACHE * FROM t1; SELECT SQL_NO_CACHE * FROM t1; # SQL_CACHE is only allowed once in first top-level select. --error ER_CANT_USE_OPTION_HERE SELECT * FROM t1 UNION SELECT SQL_CACHE * FROM t1; --error ER_CANT_USE_OPTION_HERE SELECT * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1; --error ER_CANT_USE_OPTION_HERE SELECT * FROM t1 WHERE a IN (SELECT SQL_CACHE a FROM t1); --error ER_CANT_USE_OPTION_HERE SELECT * FROM t1 WHERE a IN (SELECT a FROM t1 UNION SELECT SQL_CACHE a FROM t1); --error ER_CANT_USE_OPTION_HERE SELECT * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1; --error ER_CANT_USE_OPTION_HERE SELECT * FROM t1 WHERE a IN (SELECT SQL_NO_CACHE a FROM t1); --error ER_CANT_USE_OPTION_HERE SELECT * FROM t1 WHERE a IN (SELECT a FROM t1 UNION SELECT SQL_NO_CACHE a FROM t1); --error ER_WRONG_USAGE SELECT SQL_CACHE SQL_NO_CACHE * FROM t1; --error ER_WRONG_USAGE SELECT SQL_NO_CACHE SQL_CACHE * FROM t1; --error ER_CANT_USE_OPTION_HERE SELECT SQL_CACHE * FROM t1 UNION SELECT SQL_CACHE * FROM t1; --error ER_CANT_USE_OPTION_HERE SELECT SQL_CACHE * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1; --error ER_CANT_USE_OPTION_HERE SELECT SQL_NO_CACHE * FROM t1 UNION SELECT SQL_CACHE * FROM t1; --error ER_CANT_USE_OPTION_HERE SELECT SQL_NO_CACHE * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1; --error ER_CANT_USE_OPTION_HERE SELECT SQL_CACHE * FROM t1 WHERE a IN (SELECT SQL_NO_CACHE a FROM t1); --error ER_CANT_USE_OPTION_HERE SELECT SQL_CACHE * FROM t1 WHERE a IN (SELECT a FROM t1 UNION SELECT SQL_NO_CACHE a FROM t1); DROP TABLE t1; --echo End of 5.1 tests --echo # --echo # Bug#51336 Assert in reload_acl_and_cache during RESET QUERY CACHE --echo # --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings CREATE TABLE t1(id INT); START TRANSACTION; SELECT * FROM t1; # This caused an assert RESET QUERY CACHE; COMMIT; DROP TABLE t1; --echo New query cache switching OFF mechanism test set global query_cache_size=1024*1024*20; set global query_cache_type=on; select @@query_cache_size, @@global.query_cache_type, @@local.query_cache_type; set global query_cache_size=0; select @@query_cache_size, @@global.query_cache_type, @@local.query_cache_type; set global query_cache_size=1024*1024*20; select @@query_cache_size, @@global.query_cache_type, @@local.query_cache_type; set global query_cache_type=off; select @@query_cache_size, @@global.query_cache_type, @@local.query_cache_type; set global query_cache_type=on; select @@query_cache_size, @@global.query_cache_type, @@local.query_cache_type; set local query_cache_type= on; select @@query_cache_size, @@global.query_cache_type, @@local.query_cache_type; --echo # --echo # MDEV-4981: Account for queries handled by query-cache in --echo # USER_STATISTICS (and in HOST_STATISTICS) --echo # set @save_userstat=@@global.userstat; SET GLOBAL userstat=1; set GLOBAL query_cache_size=1355776; FLUSH USER_STATISTICS; FLUSH CLIENT_STATISTICS; reset query cache; flush status; create table t1 (a int); insert into t1 values (1); select * from t1; select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.CLIENT_STATISTICS where CLIENT="localhost"; select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.USER_STATISTICS where USER="root"; show status like "Qcache_hits"; select * from t1; select * from t1; select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.CLIENT_STATISTICS where CLIENT="localhost"; select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.USER_STATISTICS where USER="root"; show status like "Qcache_hits"; drop table t1; FLUSH USER_STATISTICS; FLUSH CLIENT_STATISTICS; flush status; create table t1 (a int); select * from t1; select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.CLIENT_STATISTICS where CLIENT="localhost"; select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.USER_STATISTICS where USER="root"; show status like "Qcache_hits"; select * from t1; select * from t1; select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.CLIENT_STATISTICS where CLIENT="localhost"; select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.USER_STATISTICS where USER="root"; show status like "Qcache_hits"; FLUSH USER_STATISTICS; FLUSH CLIENT_STATISTICS; flush status; create procedure p1() select * from t1; call p1; select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.CLIENT_STATISTICS where CLIENT="localhost"; select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.USER_STATISTICS where USER="root"; show status like "Qcache_hits"; call p1; call p1; select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.CLIENT_STATISTICS where CLIENT="localhost"; select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.USER_STATISTICS where USER="root"; show status like "Qcache_hits"; FLUSH USER_STATISTICS; FLUSH CLIENT_STATISTICS; flush status; SET GLOBAL query_cache_size= 0; call p1; select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.CLIENT_STATISTICS where CLIENT="localhost"; select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.USER_STATISTICS where USER="root"; show status like "Qcache_hits"; call p1; call p1; select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.CLIENT_STATISTICS where CLIENT="localhost"; select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.USER_STATISTICS where USER="root"; show status like "Qcache_hits"; drop procedure p1; drop table t1; set GLOBAL query_cache_size=1355776; SET GLOBAL userstat=@save_userstat; --echo # --echo # MDEV-5924: MariaDB could crash after changing the query_cache size --echo # SET GLOBAL query_cache_size= 50*1024; SET GLOBAL query_cache_type= 1; SET query_cache_type= 1; CREATE TABLE t1 (pk INT); CREATE VIEW v1 AS SELECT * FROM t1; SELECT * FROM v1 WHERE pk IN (5178922,5178924,6911605,6584899,1754348,7735031,9583206,8377182,6309967,3110885,7197937,5582397,9811721,8310302,7001831,3687942,8454635,8743988,9524703,3313583,1376007,5276565,7238861,5307189,2242691,2052764,8160476,7668014,5891525,9070968,1989181,3014068,5365005,2974655,6877822,7813446,6188705,1028564,6426696,6098205,7231857,2749710,4996963,9879425,2995803,8160614,1934799,1981216,3673522,2135299,4803054,8515609,1825485,5805694,8211425,3712249,8013259,3496368,4339706,2326187,3236816,8158416,5749801,6339492,2517486,1769729,2576400,8177368,5471847,4670669,5694046,5155990,1219314,1304321,7951736,2381942,1467330,3329376,6069503,3821151,8118179,4575775,5291671,4757186,6241302,9809112,5388351,3356292,5753921,8776535,7101943,8558868,6655212,5498901,1629516,8016143,1156005,1280700,9236450,8289703,4549957,5404968,3594833,3034667,3167602,7983322,3939941,8382949,9258422,6927947,9639236,3246566,3144943,5516067,5266540,3760726,6491516,9515090,7776229,1582824,4031951,3336517,5871612,4268432,2600433,6188018,6158355,6442214,7808502,7692871,9180969,3982238,9212692,9944381,3932525,5937118,6315460,2464477,1933151,3393646,4244674,7036026,1470764,3015029,2453765,9876129,2097534,3467391,4287658,8120651,4975540,4454101,7758102,6087905,2167022,7575454,5370086,8289703,7460235,8734512,7346801,6660293,5826843,4305511,8093597,8970031,9104476,1784973,9245925,6893890,4996414,3144393,1145568,2702056,4984878,5602859,7088073,2044113,5248275,6037094,2185287,1791564,3180374,8750991,9187011,6411453,9600372,4819671,3105667,2837051,1252548,3729003,7986618,8305633,5684432,4528808,8670104,4132202,2101516,5218475,6885513,4886413,1288803,9584167,6524475,3943649,6195846,4204986,5435592,8877334,9276275,8848358,3583435,6662216,7178298,1973526,5917205,9156387,8877334,4559432,2792144,9831634,8846710,6979858,5287277,2220718,9358123,4140029,1263122,8049789,9508361,3597030,8504348,4525924,9062866,1880691,9788375,4746612,7711822,9735366,9227523,9701721,2832519,4498870,3725021,4836151,2351181,7339935,9890686,7641098,1797607,1571838,3258377,6244186,5147476,6760543,9151580,2465576,2545776,6846237,4037582,8310440,2503616,1998245,1716445,2364913,4665039,8420440,1187728,1065917,1734710,5826705,8538681,8311950,4662017,7804519,7696853,7385116,8674362,2787612,2393341,1652313,2254364,3852737,4177108,7013641,8654037,9062728,7826629,2569396,1039138,2572692,9001892,3470550,4859359,5218887,6479568,1424621,3535644,7808639,7817291,8825149,6060302,2830047,7787765,5971313,9603256,1800491,3429214,9350021,8716796,1972564,6054946,6445510,9234802,5616729,6064559,2048233,9458511,1597244,3902862,2530120,5723846,3463821,9008346,3055130,2941696,8774337,3095367,2195037,6208480,9869262,3615295,9916641,1078002,1815597,7737228,1412261,6588607,9740173,6696411,7740386,1641326,9269546,3848754,7745193,6819458,5297164,1280975,1224395,5247589,7793533,5314743,8814025,2579010,7882659,6753128,9558349,8710067,7898727,4209106,2634902,7311233,1644897,8363449,6201339,1770828,3572174,5493408,8835449,5644332,5096115,7116088,1534484,3204544,1772064,2091903,6744476,9183166,5546005,1030075,7387725,1300888,5799789,7340209,7356552,7677627,9410995,5775894,9442581,5718353,6544937,9809524,7171569,4565475,1397293,6687759,1509353,3715682,8607208,3506118,3910827,1890167,1559341,4150329,9679336,9756927,1292373,3445419,2105361,6594238,4234237,8359466,7352432,1492462,9482818,1601226,8561614,4186584,5849365,1460189,9139495,3113357,8384460,7229660,8701553,7786254,4606399,2057708,1638992,1083221,8147293,9569198,4776550,2539871,8040039,7104141,8090713,7242568,2361480,6913940,7958053,1414596,3451461,9160644,7901473,8289703,5428588,3063232,2302291,5366378,8216918,8033447,8048965,8636322,7807952,7146026,6589569,2882644,1971328,7786392,5357864,4637985,2137222,9819961,9039932,8900680,1666732,8126968,1652999,7199035,8229003,7845581,8902328,8100051,9506164,8168579,8786560,4753890,6941268,5035552,2919860,9570983,4751968,4566574,7540023,1621963,7924270,7578750,6669494,5857192,6409805,2030792,4401779,5737991,8241088,4739746,2776901,7373718,8786697,9211593,6219741,1758331,3863586,6932754,5006164,8200302,5925033,1962127,2728149,8540191,9044326,6171264,4224899,9248672,5911026,6974502,1950317,4998611,2561569,2891845,3243957,8806335,8058303,8791778,1475708,3335281,7841186,9153228,5532135,5453994,5966369,4194824,3612686,8645385,9952621,1211349,2806289,4358520,7454330,5964035,2415313,8897384,6479431,1467330,6496185,8941055,8369903,5015502,5586105,4288482,3266204,1793212,6083923,6920394,1272048,7913696,1253234,3975372,9038970,7229522,7319061,4729995,9990386,5756942,4622741,8179565,1901840,2060729,6308593,2311767,6058517,9440521,4506286,2667724,2707412,9264328,7481658,7283767,4022613,7292282,7722808,1607543,3303695,9334091,4429382,7483169,2624877,7084777,1376693,3797668,1654510,6480667,4619720,9884094,5862548,9422256,4009429,6273574,8836135,8204696,7987167,1890991,6920944,2501831,7627502,3287765,9907714,8246444,2397872,6005920,6982330,5250473,8604049,6665649,4658172,8910156,2989349,2872344,5909790,5837142,1457168,6535461,2226623,1763137,9385314,1692550,9805267,2558547,7501022,7434143,5598876,5709976,6785263,6020614,1443572,3101684,3374557,4787536,3978530,9441757,1930130,9930648,8580841,9180145,1442749,9766128,9032516,7260009,3941177,6559494,9137985,4546386,3074356,5515518,9012878,2276748,4035247,9025100,6259704,9377487,4794540,5761474,2752593,3987731,8114746,2718948,3247390,3037689,3311660,8790679,5536666,2222091,5232482,8974563,4368682,3214843,8420028,8806335,8848220,7466827,6930969,8109664,5539825,4431991,9777114,1658630,1989456,4565338,4458084,9845504,1885635,9934494,5555755,2949661,1578155,8792465,5856231,1098190,3172134,3951339,2971771,6514724,7918090,8303161,8927734,5148162,3115005,8331726,8686172,9277099,5245941,8956710,9073989,9181930,1564422,7557327,9082504,3478927,5851699,1516220,6011001,3210998,7561996,3128875,3419052,8286682,3075180,4222702,9359085,4364151,5275878,8327606,8856597,5770950,4176971,9744155,7107299,3555694,8808120,1351837,1360076,6263137,8084533,7500198,4953704,5528839,7879226,7829376,8476745,9084976,9013153,9360595,1519927,9272705,2386062,6703552,2987976,2653991,7962310,6720443,7441421,9816116,8835861,1495346,2436462,3964523,5086776,2948287,9331619,3395294,2654541,4939971,5529388,2443054,8942016,4211166,4622741,4996826,3370712,8998596,8414672,6178268,8606521,4673553,8279541,6275634,5673858,3244918,1834274,1526931,7676940,2071578,4389968,8847671,8347793,5627304,3150848,6094223,3139175,7662246,4629882,6958709,6080078,6604812,6250503,8088928,8115158,5547515,6602340,9526214,7144378,6659744,2319869,8054733,1483261,5373657,5053268,2558273,4960433,3183807,8498855,9974731,2374801,8405883,1960617,4945877,2526550,7739700,5407440,6752304,8544998,3976608,6499618,1631164,8728744,3698516,8548431,5066864,5619064,5310623,6882492,6150802,6524063,6251052,3584671,8603775,2213165,7723495,4073150,9552993,9999450,8793975,6491241,4660095,9930786,4196609,8377456,4691268,3305343,4692779,5583221,8125320,4233688,4325836,7907516,4892318,4463714,3417266,1417343,9836441,1187866,2645751,7921936,2998275,2052352,5054229,9570159,9308273,7085052,4329132,6040390,5786056,7763320,5193618,8289703,5839752,2938400,9261032,2333740,8758682,8836135,3190261,2023376,1993301,8853439,8487869,8288879,1314758,9366775,4800720,2819610,1451126,3274719,2042053,9648025,2290206,7490997,1195281,1606033,1245407,3106765,2140518,9124389,8877197,7443206,5344268,1341262,5363906,7709762,3759902,4991333,2916427,3489913,1779754,4042251,5729888,4771057,3584533,4547760,5565505,7738327,7732559,5686904,2558273,2051116,4332153,9457275,9341644,4819946,2643692,7991149,1085830,4004486,4451492,8963714,3540176,4449020,5051483,2061691,2676651,5276153,9197860,7980850,3026428,2856414,8852752,4922805,8302612,1072509,9081542,9056823,8404922,6097930,3939804,4919097,7398712,5407302,6692565,2214401,5561660,7238311,9212554,4992568,6093811,5223144,1899368,7665542,4582092,7409286,9964294,1835372,4815963,3387054,7423294,9401657,1044494,8743713,6644226,8916748,6272750,6561965,4788223,4657897,3687393,6183486,3993774,6385223,8807159,2952682,2643692,7253280,2452804,5163818,3558853,6846511,3127502,1926834,8465347,4805801,2904479,2171691,8575622,3015853,8413299,9511245,3628479,4821868,1020324,9179046,5233032,4244400,3795471,2762893,2857376,7661010,6360778,4951644,1309265,8922927,7212219,2014862,9049407,5376403,5611511,2232940,5183456,2757949,4638946,6997848,7474517,6429168,1501800,5802124,8222274,9924880,8694000,3835708,8349304,5278213,1097091,5408126,6541915,8095245,3619415,6916961,2786102,4845352,7466827,3578079,8144683,4338470,1635971,9640609,3117614,1855010,5728103,6300903,7430709,1900192,3673660,6037643,5595443,7049072,6462951,3585632,8084533,1853363,8477294,2266586,1465270,1276580,2511856,2895828,4337097,3626968,7087249,8985000,9414840,7458724,1141174,7457214,1602325,4407272,7694519,5595306,3399688,8429092,5586380,2441543,4488845,6415573,9871047,2366287,5840713,7647552,8970306,3026016,8186569,5060821,9175888,2428634,4199768,7791061,9595565,2325363,2228820,2966415,5135116,7646453,5928054,6217681,2612930,8201812,4628372,4872955,3597305,5363082,6790893,7307388,2064025,6947860,9389984,2415451,4464401,8022598,7566390,6675811,3299850,6845413,9396438,2775527,1796508,1665359,7119934,1264907,2772644,8598693,4670669,2209182,5293182,1299514,7853683,7307525,3205093,1643661,5012481,3448440,2148208,6146820,6530380,5167251,4132614,4331054,9009719,4979522,3280487,7764144,6472427,9053253,4821456,3984985,4425674,7194503,2939361,6038879,6136795,9609985,1561401,3836807,7960662,8419204,4684951,6060989,9063690,5382308,6334548,5833572,9388198,8814849,5744033,4868148,1200775,6155197,5857192,1321624,9067535,4156234,2739959,4067108,3602661,8168441,4998748,5604919,4829833,5483520,9798538,3330474,2504852,4206909,1574035,1379440,9239746,3629440,8028366,1766845,8773513,1564834,9511657,7040695,7232955,4622467,6376022,7167312,3728591,2885940,4396835,8868270,7126800,9963195,6857360,8126831,5344406,3878555,7389236,9083740,5007949,4776962,9162017,8039764,2822631,7905044,1516357,9784667,6493438,7841873,9634292,3971252,2542480,3446517,4340805,4752929,6867660,3490188,3628890,9403579,5384231,3443496,9004089,6138854,1594360,7386215,9240707,3856857,5428863,2509521,9643905,7018722,9202941,5178375,4411254,7385116,1032135,5022506,3187652,5829727,7550186,7026824,2408035,9947540,9273666,7087936,3519851,2677337,8457244,2005661,4680969,7654968,2781570,4380081,5025390,3519851,9721084,1380264,2092041,1889892,2931121,7856018,3507766,5226303,4501617,8759506,6521591,6303924,5419250,4346023,2481506,6510330,3082870,7123367,4848236,7687789,8214035,6017868,4840545,8739181,4010116,7725280,6304473,6717834,6878509,8717071,7901062,6616348,4601318,7868927,3206878,3577255,2269744,3181472,1819305,4741119,5834259,1561264,7062255,9452194,2613754,3131347,7384979,6041351,2607711,7039733,7047561,2902420,1954162,9234252,9188522,8082885,4378570,3174057,3865371,2107696,6976425,7944458,9164901,7252593,5173294,8744537,1974624,9989013,4207321,5217926,2511032,1816970,1975036,7593170,5195953,3204681,2588897,5102981,1978607,2856002,7484954,7652359,6692153,1021011,7428237,5203643,2542892,8071487,3258789,8846160,9323516,7058685,6720581,9020843,3444595,1471038,4219131,5868041,4378570,3913986,5849914,1166580,6608795,5926269,9542007,7833496,7679412,9654891,2661956,2453765,9437225,8606246,1918182,2806838,9062179,7191619,1914337,6861343,9976791,2286773,4190429,2203964,6232238,7523681,6100128,7373992,6461715,7533432,4364425,3069549,5995483,3859741,9647476,2696838,9232879,3760177,9996704,3229263,1862838,5615081,5493682,2845703,2029144,3163070,6955413,6317382,9031143,8281463,4034286,6611404,5656692,6529281,2557037,7679138,3738891,7174179,1447692,4899871,1031311,2919723,9078796,6147369,9996154,1052597,5393844,9947265,8596496,4228469,3644683,5696243,9690322,3616119,1088714,2409408,9116287,6616210,8487594,6966949,9066986,8876098,1753799,3326492,2843505,4818298,3586044,6671554,9584304,9400833,3439788,9963745,9062454,5329025,4675338,4869110,9144851,4437484,6226333,2525177,6007293,2460083,9634979,2118820,6699844,6908035,2795578,3744247,9154464,7273742,2250106,4507247,1230575,4279830,6382064,2348434,8891067,3391723,4348358,9550247,3103195,8312500,1096817,1399078,1557693,9679061,5311035,8970581,3799728,4678497,3626144,2506088,5866256,6802154,2960510,8350540,3022857,9459060,2306274,6918197,1693374,6662902,2821807,9658737,3177215,7515991,7572296,6487258,7247650,3706619,2758773,1652862,7224166,6737197,6782653,9508499,6613464,6106307,7986755,3156753,1912689,1157928,3418365,2435089,6668395,2821121,4458084,6213150,7384841,4956588,5656692,9468399,7376190,1529541,7625167,8110488,4155548,4326660,9321182,7022293,2455001,2438247,6575973,6285659,7469299,7221694,2205200,8063247,1420089,6965988,1546844,1101211,1029525,1977233,7771560,1325469,1002197,7301620,8807983,6497558,9104614,4806625,6226608,6400192,4939971,1838119,5926544,5520736,1008239,7172256,2969299,1701065,2148345,9481033,6402252,3724060,5954696,3031097,1415832,4303314,2261367,1832077,2679534,9446289,6289642,5956481,6198181,4659408,2550033,5247451,2534515,3963287,5095428,2133926,2739273,8188217,3215667,3772262,5836044,9515914,7171432,1232360,3201110,3740264,8057205,2948013,2683380,3211685,3389938,5149536,5809814,2937438,1515121,2497161,1916946,9803070,3426055,2634490,2554565,6387695,1088165,3881027,9005325,4338607,8863464,7781997,8261825,4775314,5127700,7733795,7307662,2691619,7675155,7405029,3044555,5825195,7004577,1170974,5709426,6961456,8078491,6280166,4126296,6142974,3652511,6972854,8634674,3751251,3765670,8268692,6040664,6930145,7486328,5643508,7432495,6320541,5509338,5313095,5205291,1573486,7694519,9343841,2139007,5612060,4143325,1307479,9871459,7109771,6907073,8700454,8613937,1154495,8917709,7844482,8447906,4566436,7239135,8489517,6052200,3839691,8229141,2835678,4199905,4175323,8708282,8194808,4871032,1574859,5727005,5008087,8324310,1463348,2027908,8441726,9971160,4810195,5793334,3275268,9397537,4217071,9775192,7305740,5373931,9941085,2398422,1982727,9201156,4322540,4933517,4495849,5232894,6585449,7331008,2030380,7920013,2480133,3811264,4413452,9220382,1735946,9804443,7867004,1716995,4794265,9334091,9085937,6289505,6787734,2436599,6362701,1682113,9238510,2713180,9974731,8810867,5440124,1605346,7554306,2156448,8995162,1488616,5659713,9083602,1474746,8179290,3266479,6432189,3670639,3946395,9397125,2223464,2407348,7623107,5608078,1825759,9384216,8912216,1553573,3422897,2014999,9478012,3343109,1127990,4734252,2919174,6914352,5589126,6739257,9217086,7136825,6427658,1636795,4750732,8867584,3355194,6962417,7476028,3676681,3311248,7041381,5358688,6461715,2466674,1160812,5658477,7668701,3436492,1520339,1155868,7340484,5543807,9931472,4916351,4708572,9482269,6733489,3684921,1550277,1217529,7894882,8505722,1027053,1472686,7768676,7660186,6224548,1642013,7472045,9516738,9112304,7475891,9356063,7386627,1142272,2380706,6537246,8979507,5205017,6678558,9957977,7552108,7161132,8668594,6944839,1344284,2669509,6835388,1734024,1395782,1526519,2048233,4932006,8337219,7240371,8092910,5380798,6250778,3054855,9382293,7395965,8190826,7143417,6188568,4846725,3462585,3192459,4239730,2046173,3249038,7091369,8025619,6921768,7681472,3949142,9657363,7432083,9947952,7155502,5621810,9702407,4531005,9706253,6277420,4844802,7171432,7510910,7433593,5931900,8650329,8901092,5858154,4095260,4981582,3058837,1055618,3214157,8112823,8584686,2161529,9165863,8723663,3921676,9294815,7104553,2218933,4856338,6214111,9738388,4507385,9814605,5619476,3073944,6663589,6171264,3944747,7595642,2061828,1291549,3983886,9349472,8080001,1524597,7195190,5899627,8965774,1866134,8026992,2628311,2957077,8510116,9107772,6343338,8253860,4008056,8646896,4668334,3932388,3253845,5886444,5178100,2396499,2014038,2950347,5752685,4460418,2222091,3933761,6116195,6655349,5753921,7576416,4029617,9855392,7905731,3363021,5107925,9814193,8291625,3396118,7727340,8709106,7378662,2883880,9994369,1283721,6381515,9586502,9243728,1684173,5730987,8065444,5034179,1582687,1839355,8079864,3111434,6681854,4377883,6971893,4306335,6193237,1788269,6387695,2837463,4385025,5243469,3174743,4987213,4790969,8780242,4800720,2618560,4176147,4818984,7139160,2503341,3850814,9791671,2962158,9929962,5429962,5096252,3986495,4558197,7627365,9094863,9817352,4991607,7182281,5376953,5630050,8035095,2510208,6003860,2938125,7106887,3171859,1955535,7287338,1773712,7754669,7495941,8222000,4877899,7259323,4678359,1366531,4223800,3587005,3707168,2965866,2295425,1219451,7376739,3728454,9970886,6685424,5303894,2315887,9703781,2909561,2175811,2323165,7140121,5034454,7728713,5091583,6640106,2812194,1678405,8201538,2672393,4156784,8321426,5984634,2550033,2953506,6023086,1902389,1477493,4717636,4315399,2133514,6376846,5195816,4818298,9213790,2461318,1505645,7708389,3072433,4026733,2905441,4950271,9309646,2427673,3788604,5009185,8055969,6708496,2996353,3267303,8261962,7856567,5043243,5857742,4757736,8148254,6347595,3138214,7927566,9555328,1061660,9522094,7344879,3679702,9596115,2885391,5208862,1187316,2430694,6269180,7927566,8208404,1305557,1094345,3691787,5673171,5388214,4610794,3382659,1052047,6508132,9796203,1656845,1468566,2053451,3425094,7553344,4655014,8623550,3527130,1465820,9716827,3031921,7952148,3823211,9178497,9751296,2261642,4323776,9275726,9396713,8665298,9065475,3965347,4339019,9221206,8415771,3620239,6043273,4017669,5966918,7879364,1225357,1557693,1418029,5619750,3420288,4062301,4727935,8520965,4057769,9912384,1385345,3190261,1635009,5948928,9135787,8316482,4085784,7848876,2012527,4822143,2933731,4295349,4014236,6482864,3328826,7162643,2271255,2981796,9557113,9432693,9047897,6868209,5119186,8063522,3421249,8389816,6970932,1526794,9981323,6666061,8019989,2235137,9397674,2172653,4471405,9574966,1193222,2005249,3118026,1768218,3572723,3890502,7165664,9276138,4645675,1415008,1691864,3969055,9891784,3438964,9327087,8777359,2208221,2164550,3255218,9043640,4385986,8827209,9126037,7295166,6357345,1478454,2973831,9655166,1058364,2829772,8735198,6611129,8250564,6625549,2459808,6358993,6145446,6513763,8809906,3443222,1175506,7884445,5938491,3910003,2754791,6642028,6344024,7692321,7374542,4383651,1791976,6447158,1875610,7949401,4899871,5562210,9243316,1815460,1476806,2551406,6766448,3296005,1213958,2557037,9905792,9026611,9817352,3179687,7716079,5693908,2177871,2351318,7162918,6483001,7673095,6473388,7181182,7209884,9192642,2536437,6816848,3608978,9982421,6441802,3296966,8742614,5900588,7242019,3370437,5003005,1180038,9520996,3764846,3674896,3289688,2631469,9101318,2526824,8989807,5007400,7113479,5401260,7174453,3273345,5511123,2270706,1593536,6365859,5335891,1730178,7051544,7387725,6149566,5393157,4172851,1414047,7900924,7161407,4330230,4966888,5813796,5835769,2828125,9380371,6140365,6038192,7937316,2771408,5123031,4912918,4870758,1837982,4010116,2574890,6298431,3201385,2466812,6776748,3491561,2513092,7227188,6759307,5692810,9042953,7330047,3757431,8803588,5969116,6781829,1129501,8984313,9088272,2991958,5577041,1259963,3164169,1823287,5426803,6726211,7632995,2600433,4440368,5447265,5885894,7922348,5123031,7642471,7846130,9620559,1999069,5252807,7059509,5707778,4822280,9482543,3017227,8660079,8191787,6408432,2930847,9877914,8539230,9252243,2676239,4667510,2959274,3407928,5126190,6587783,7850250,7819076,3590988,2506912,4833679,3799865,6584762,2210281,4922119,8892715,4637023,7906829,3403945,1856384,9367874,3473297,7413269,3380325,2544815,4784790,7654968,9615203,6342239,9971298,4251541,2117309,4519607,7946517,3183120,1297866,6738845,1051910,3286804,8972640,3738891,2159606,7285964,5103530,6586410,7077911,4817749,6329193,7722259,1603561,5926681,9375427,3019973,4063812,9994644,6939620,2578460,4693328,6574325,7145065,7464492,9687576,1096542,1156280,6125946,6278930,8918533,8050064,3693298,2677200,1683486,6537109,2888824,4219543,1459091,8626159,3761962,7572845,9624130,3825820,3968780,9332580,1971603,1976409,3816619,2862869,9997940,2307785,6790069,4718322,6846374,8813613,1777969,3496368,4872543,9539810,7721435,7458587,2303665,3877731,4899459,2769210,5956069,4456573,4572067,7691223,1483673,7730087,9200744,7586166,8124221,3849990,6962142,1059600,8411376,1920242,4776962,5097625,6823440,6225646,9569747,6536422,7835830,9529373,6981643,4710769,5347152,2032440,9251419,6622802,7945831,8088516,5485855,2476974,2988937,5269012,3038101,7923171,9959075,7870986,2211242,2853256,9069732,7463119,3007064,6093948,3587417,7560760,3138900,7839126,1839767,7027923,5026901,8167617,6376571,7295303,8993240,9487762,3256179,5992187,1379440,4252777,2920959,7083404,4800170,3793411,8635635,1105880,1255706,5607391,8953414,8598556,2320556,7952972,5181121,5320098,5126464,5088424,8310302,2346237,9359497,9002166,7384567,9643218,4989135,3976333,5771224,3207702,6949234,5828079,1304595,2371093,1488204,6173599,6773727,8357406,6408294,9555328,4717910,9692520,1911865,6779769,5003417,3555969,6274536,2307785,9147460,4669708,8062423,2040130,4858810,8818420,2114013,7345428,1764511,8593612,3003219,2669921,6790618,1456893,4204849,9576339,4165985,6714675,8679168,5553833,9517425,4499008,9095275,5443008,2026672,2348159,7412719,4820083,2114974,7480285,6037643,2184051,8626983,2354614,6275634,6289505,8980880,7612533,9296875,2471069,1254608,5995071,1334533,9300170,7675155,9326675,8334060,1420776,9482681,6162338,3772125,9906066,7634506,9190582,6864776,4980621,4321441,2985504,1883026,7451583,1762176,2202453,6793502,6691879,2246124,2810958,2945541,5521011,6893066,9458099,9021118,3825271,6098617,2557449,1967208,7262207,4133438,1194869,4129455,7893096,7865768,4447372,3305892,5086364,4075759,3208389,6939208,4536224,8330490,7111282,5166290,9741546,2888275,8646896,8943939,6785263,8600479,9068771,9970336,1762588,9280670,1178115,1618530,3697692,9509460,6584213,6604125,3295181,7342956,8532638,7602783,2369445,9894943,3896545,5538314,9294677,8260726,6422164,2759735,1321487,3750839,8825698,9824768,3100723,1905136,5832061,8110076,3261810,3254257,4751968,2966964,2386199,6297744,8689193,9639648,4221878,6668258,6972305,7666915,9481719,7949813,2905578,2983993,4068893,1119064,5430648,8445571,1074844,9077972,5795669,9986267,2391555,9248260,9822845,8139328,2283752,1693374,2869735,4131240,6762603,8740417,8077941,2270980,2107284,3566955,7001831,5853759,8375259,3725296,9212966,6295822,7248474,3069274,3972213,5722198,6054946,5055191,8563949,9722595,9314178,1884674,9386138,3497467,6645874,9457138,1390701,1110000,9389160,2602355,2966140,1065917,1773025,4560668,8858108,9937103,9985168,4180130,1220413,3248764,1978744,8799468,8390914,3350250,1365570,5284805,7485504,8485122,2234451,2189544,2404602,6783477,5243881,6506759,1344696,7390609,4827224,8981018,9410720,7455017,4858947,2450195,3420425,7191207,9621932,8185333,4497222,9738250,4422927,8697296,8542800,1031723,7697265,4978424,7184341,8407806,1947021,6649032,3291748,8159240,5358276,1976959,1654510,5760513,1439041,4238906,4916351,4981994,6522415,5391647,4358245,9611770,1479003,5523620,4626174,8002960,7481796,3053894,8994476,3166503,5167526,6147781,4260742,2627899,4039230,4318557,6865875,3765258,6450592,5683197,2331268,5849777,2020767,6841018,1609466,3505157,6818222,9844543,1439590,1806671,4161727,7229934,9302505,7736267,8379104,4578521,1070449,2215637,9368972,1574035,7941986,9432556,1309539,1029113,2759872,6681716,6356933,2844879,7301071,7437988,8677932,7377288,9637863,6880569,6660156,3174057,5158874,5587478,8644012,8555709,2346786,7618026,9019470,7005401,9906204,1703262,4032501,7838989,8333786,1762863,3143569,9122741,3526306,2465850,5283157,4307983,3519302,7056213,3846557,7551559,6949920,1160125,7774307,5189910,6339355,2794616,7558563,6337158,4785751,8296295,8522476,1073608,4164199,9388610,6213287,8196319,8426071,9106262,8256332,2998275,9091156,4796463,4509582,6045196,5527465,9914581,7866455,6419692,9112030,1833175,4547760,9400970,2865753,2384552,8228454,8048828,3656906,7353118,2841583,6660018,9567001,7639175,4403564,3567642,6511566,7309448,8705261,7249710,5712310,2257522,1211624,2218246,7110458,4687561,3014617,1655746,4319107,5145690,5181259,4268157,7204940,2313140,8344085,1324645,8695922,1282760,1873413,4350143,6906112,2536437,9478836,5441497,9173278,8342300,8581115,2676376,3102645,5790725,3300399,2581344,1209014,7187911,4402877,6129516,9254028,8025482,7049758,7237350,6868759,6244735,7693283,1226455,6558395,6015396,6962966,5222869,9681259,5745407,3885696,6958709,6495498,1543685,9283279,5948654,9869125,5851013,2692443,9506988,8744674,4460968,4648147,3575607,1954162,4647460,8678619,3831451,7477539,7618713,7850387,9041580,9737701,4016433,4211715,7136001,1026779,5677841,1975311,8964263,7656478,5381347,7785430,8208404,4928024,3792312,2912307,4417709,7512557,4328857,9718750,5635406,5338775,7167449,1241424,3586044,4579208,2104400,1230850,8892166,5830688,9494354,6495361,4289169,8081100,6983703,6889770,2306961,5557952,7257400,4796051,2386474,3050186,7518600,3436630,6901718,7799987,3918792,9866241,8053634,5555618,7658538,3985122,6106307,4879959,3976608,9416625,6934402,4309494,6746124,1595596,5348388,2456649,5898254,4907012,1169189,4647735,5388626,6224136,9518524,2193664,2929748,9683593,4296173,3884460,1203933,4047058,8309890,5801712,9778625,5489837,8029602,6043823,1441375,1160125,5433120,4456710,7173080,1354446,1911590,3964248,7478637,7652221,1706008,7592483,2295013,5852111,9839462,9779861,7191894,7055389,4018493,3069549,7088897,2740234,8468368,7775405,2202453,1168365,6172912,1716995,6445648,1971328,6488357,9616577,6997436,4256210,4597885,4251403,6260665,4079055,5777130,4956176,1926696,4624389,3939117,7569137,8367843,3940353,6426834,5414031,2072952,1567993,3523422,5414718,2348022,6912017,1646820,1932601,7998428,9695816,9699523,1423660,1212448,3342422,7540847,6507171,9365539,3629714,2051803,7540298,3961776,9458236,1759292,7292007,5433807,1079238,6490966,9811035,2019119,3625869,5026763,8080276,6429992,5289886,5218612,9552169,2538909,9989013,8544448,8159515,6794601,4868148,7567077,4892868,5590774,5479263,8266906,3542373,2303253,3980590,2714279,2693130,7217575,1203659,2055099,9571945,6062225,1927520,1273422,6836624,1369415,1206130,3703598,5902236,9379959,3092895,3758117,9898788,7712097,9604354,1842376,1853500,4512878,3268402,3922088,6190216,8310577,5100921,7714981,6142974,6286895,6352264,8973876,8173522,9187973,8870880,2830322,8990081,9592819,8423873,4667098,3257827,1758468,2822631,2489883,3597442,8758407,3192733,9264739,3965072,4136734,4235610,1190887,2005386,6793365,8823089,9379272,2474227,2320968,8770904,6902542,9323104,5511398,8132461,2687774,9538986,7251495,8858795,2219345,1334396,3525619,9166824,3521362,6780456,2744628,6460342,3387741,4477172,2120056,1148727,2329895,1354995,9301132,2203689,1208877,8199890,9995468,3802337,5022644,2997863,2789672,5896057,8815811,6691329,1890853,3052383,8181900,4440643,3005828,5410736,9325714,7986343,2078857,7098373,9154190,1204071,8104995,1948257,1367492,1446594,4737823,6863677,6014160,5766830,8911804,3673385,7483993,9615615,1196792,2820159,5404418,2107421,2103164,4727249,9409347,8449142,6057556,8186843,2250930,2623092,2266860,3613098,8221176,3921401,1190063,1504409,3352722,9422119,7835418,6958709,2368209,4004486,4603790,8584686,4846313,5992187,1894561,9653381,9572631,3024642,3194107,7834320,4545974,6243225,5866668,5358825,6606872,5392471,1362960,9954544,4158294,7925231,6069641,9396301,2946640,7708389,5514968,6014709,1372299,3421661,5150497,4008468,5298126,2243103,7428649,8902191,7824295,2916702,9393417,3995971,7999801,1792938,2502792,8146469,2937164,6939071,5904022,8729019,9300720,4910720,6877136,9117935,3636032,9279434,1667831,2534515,8511627,9510559,1428466,3602523,6937561,3283370,7483444,3457229,2033676,2848999,9641845,6750656,3414657,9519485,2771545,7396926,5259674,8880355,3356979,7401870,7537002,7822784,7258224,7619949,1351837,3986770,5388900,2783355,5885345,7711685,7533843,8645797,5894409,7084091,2023925,9585128,3241348,5181808,8486633,7509124,4420455,2102203,7391571,6408020,4552703,5873672,2610733,5396316,5814620,7840362,9709548,5589263,4772842,6615524,1190475,4657211,4590332,7197799,6405685,2400756,4575637,7341857,1358840,9191680,5042007,5779602,2113876,8623138,6945663,8385284,6030639,1211624,8272674,3876358,5544769,8496246,3642486,2145874,6711380,2377685,7096176,7819900,7232131,8041687,5540786,4132888,1181274,3310287,6814514,8714462,1154083,6763565,8845474,6383575,1052734,4477722,8870193,9541183,5229187,8721603,5181121,6255996,2205200,6456222,2373291,1638992,8686996,9980773,8556671,2596588,8093048,3568054,8504623,7560211,8314971,7435653,9206100,4283401,6929321,7892547,6791992,1301025,7579025,2009506,7302032,6144348,1744049,4652954,4263351,2906402,5619476,5228500,9547088,4249618,3318664,9977890,4474014,5451385,3122970,4170928,6637084,5580062,3993637,6038879,2408584,4396011,7067474,1791290,3602249,5070022,4352478,5560974,5258575,3315643,7344192,6619781,4021240,2025161,2780471,2710296,7075027,5007125,6253387,7836242,2111541,1915847,1898132,8355621,7295303,5968704,1875610,7719787,9693756,3544433,4869796,7704544,1145706,3255493,6317245,3472610,1031860,7589187,1587219,2316024,4919235,4710357,8832290,8419067,9547775,1521026,7727890,1486557,8126968,6568695,9818313,4580718,7411621,1897857,3689453,8011749,5526229,1439590,8686996,6624313,9006011,1031448,7397201,7323867,1022659,7661285,8611053,3187515,2266174,7030807,1988632,5002456,1447555,3030685,2144638,9576477,4895065,6220428,6371353,4662017,9210083,5910064,9719985,6841293,2452667,9932708,9657226,7213043,4825027,6706710,9017822,1225082,2321380,5676330,3470275,4499008,9314453,1728942,7214279,5987243,5545181,1679092,4130966,3308502,1485870,3416030,4101303,8604049,4545288,2805877,1714660,7760848,5083892,8944076,8083297,4341766,6709320,7851348,6984664,5069198,3818130,8206207,6047531,6206283,2856552,1208740,7201782,8676147,8264846,4168457,4111053,4267471,6577621,1911727,1806671,5765869,4645263,9599685,4241104,9358261,2449234,8053222,9979949,7151107,1476669,2177322,6751754,1148864,1124420,7578201,5074142,1534347,3101135,8968246,2674316,5595993,3296829,1451263,9923645,3144943,9086761,5283157,1004257,4766937,7540847,3200012,2027496,3750564,3505432,5908416,9821609,3038925,8026718,5832611,6608383,9044326,6085433,6710281,7287475,6673751,9109970,6131713,8546234,6405960,5238250,1616333,1514984,6766036,2796127,5320922,7186264,8038940,6961318,2970397,8315383,1568405,8081375,4109130,7023391,7482070,1615234,2262878,9819137,4189880,1166305,1107666,7260147,2496063,1575958,6237045,1971740,8670928,6546585,3623809,8240676,3325531,5762435,4368408,4905502,4432128,6977523,5828079,7759201,8335571,8038803,2721008,9185089,3098388,5313919,6298019,5243469,1023483,4491729,7177612,1928619,5698440,4224899,1935623,4813766,4405349,8582626,1045181,9804031,9238922,2783630,3260299,8215820,3778030,2175399,7035339,5900039,7653457,9932296,8077117,6630218,7855743,2438110,8619705,4472229,5127288,2822357,5519500,7355453,5281784,1621139,9760635,1564010,5795806,1028564,1467605,5366516,5515106,4708984,8016555,4503128,6819732,4639083,2340744,7748764,2092453,2947463,7022430,6272064,3833236,3221023,2265899,3006378,2264389,9246887,5345092,3754959,8768981,1659179,9620010,1245819,6007843,2458297,6713989,5858016,8057067,8871841,4948623,1234832,6412139,5526779,6626510,4506011,5199249,7400085,1258590,1335357,2441131,9518112,9328323,7513244,3718154,2872482,8686172,9312942,6069915,4521530,3169250,7329635,2481369,9345626,2539459,6019790,7796005,9426788,2333190,2661682,3400787,6518432,2717163,6953353,8526733,1576919,1944000,9968826,4507247,3821975,3500900,5690200,9840835,7295028,8545684,1834411,5398788,4384613,5723571,6194335,7624618,2287048,1958282,6211776,7065826,3871688,7312057,9001205,7084503,8918945,8507644,6545211,6089553,6200378,6205596,5275878,5133193,3368927,6631866,2766326,1216979,2129257,6648345,5746505,3151260,1655197,6860656,8165008,3309600,9723968,1857208,5513595,5124679,9537612,9171768,9135513,3667617,5696105,5065490,1733062,1155456,7295852,8720642,4797424,8729431,8618469,2940185,1174819,8349166,5381072,4946838,9492019,6145721,8015182,2375488,8656646,7076538,8943801,5053405,9153228,6228530,9325851,8660079,5352508,6609756,8235595,3863174,6553588,5775894,5746368,7021057,6976562,6134460,3887207,3048950,2425750,9270370,2942520,1540664,3841339,4136734,4060379,6738983,2458023,8454223,6641342,3450637,7791198,2164138,2475189,2497436,5165878,1277404,9094314,4799072,8011611,2963394,9312530,8679718,6637908,5223281,1418579,9493942,6712203,2990997,8991867,8163360,4156784,2006210,2811096,4720794,8685211,6300903,6822616,2452804,7695617,2647125,7638488,7735992,9739898,5805557,2532318,6160552,5288925,7921936,3402160,8034545,2010192,3913024,7668701,8862503,8278717,8186294,5577865,2893081,5138687,9538436,7876892,3328140,5435317,4574264,1331100,9287811,6335372,2491119,5052169,8125869,5954284,6572814,9105850,7187225,7311096,9235763,4366760,3604034,9326538,5971450,2090805,3220886,7086151,2029556,9172729,6246246,1085006,8185333,1558105,7721298,1673873,8433761,5778503,2401443,1425445,3955734,7078598,6142837,9639099,8200164,1102584,2389770,4702804,7423568,6611816,5854034,6531890,4533752,5199249,7982772,7802185,7578750,3470687,5305953,2196548,8727920,3662261,1259277,1384796,4084274); # Cleanup DROP VIEW v1; DROP TABLE t1; --echo End of 5.5 tests --echo # --echo # Bug#12977203: SERVER CRASH ON A DERIVED TABLE WITH QUERY CACHE ENABLED --echo # SET @qc= @@query_cache_size; SET GLOBAL query_cache_size=1355776; CREATE TABLE t1 (f1 blob); SELECT COUNT(*) FROM (SELECT * FROM t1 ) tt; DROP TABLE t1; SET GLOBAL query_cache_size= @qc; --echo # --echo # MDEV-617 LP:671189 - Query cache is not used for tables or --echo # databases with dots in their names --echo # CREATE DATABASE `foo.bar`; use `foo.bar`; flush status; CREATE TABLE moocow (a int); INSERT INTO moocow VALUES (1), (2), (3); SHOW STATUS LIKE 'Qcache_inserts'; SELECT * FROM moocow; SHOW STATUS LIKE 'Qcache_inserts'; SHOW STATUS LIKE 'Qcache_hits'; SELECT * FROM moocow; SHOW STATUS LIKE 'Qcache_hits'; use test; drop database `foo.bar`; --echo End of 10.0 tests --echo # --echo # MDEV-10766 Queries which start with WITH clause do not get --echo # inserted into query cache --echo # flush status; show status like "Qcache_inserts"; create table t1 (i int); with cte as (select * from t1) select * from cte; show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; with cte as (select * from t1) select * from cte; show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; drop table t1; --echo # --echo # MDEV-15328: MariaDB 10.2.13 Crashes upon CALL PROCEDURE PARAM --echo # LAST_INSERT_ID () --echo # (part 2, part 1 is in sp.test) --echo # create table t1 (a int); insert into t1 values (1); CREATE FUNCTION foo (i INT UNSIGNED ) RETURNS int deterministic RETURN 1; show status like "Qcache_queries_in_cache"; SELECT foo( LAST_INSERT_ID() ) from t1; show status like "Qcache_queries_in_cache"; DROP FUNCTION foo; drop table t1; --echo # --echo # MDEV-24858 SIGABRT in DbugExit from my_malloc in Query_cache::init_cache Regression --echo # --disable_warnings SET @qc= @@query_cache_size; set global Query_cache_size=18446744073709547520; SET GLOBAL query_cache_size= @qc; --enable_warnings --echo # --echo # MDEV-22301 JSON_TABLE: Queries are not inserted into query cache. --echo # create table t1 (a text); insert into t1 values ('{"a":"foo"}'); flush 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'; drop table t1; --echo # --echo # MDEV-25228 JSON_TABLE: Server crashes in Query_cache::unlink_table. --echo # CREATE TABLE t (a INT); SELECT * FROM t JOIN JSON_TABLE('{}' , '$' COLUMNS(b FOR ORDINALITY)) AS jt; DROP TABLE t; --echo restore defaults SET GLOBAL query_cache_type= default; SET GLOBAL query_cache_size=@save_query_cache_size;