mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-6720 - enable connection log in mysqltest by default
This commit is contained in:
@ -5,24 +5,34 @@ set global query_cache_size= 1024*768;
|
||||
drop table if exists t1;
|
||||
create table t1 (a varchar(100));
|
||||
insert into t1 values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
|
||||
connect bug30887con1, localhost, root, ,test;
|
||||
connect bug30887con2, localhost, root, ,test;
|
||||
connection bug30887con1;
|
||||
Activate debug hook and attempt to retrieve the statement from the cache.
|
||||
set debug_sync="wait_in_query_cache_insert SIGNAL parked WAIT_FOR go";
|
||||
select SQL_CACHE * from t1;;
|
||||
connection default;
|
||||
set debug_sync="now WAIT_FOR parked";
|
||||
On a second connection; clear the query cache.
|
||||
connection bug30887con2;
|
||||
clear the query cache.
|
||||
show status like 'Qcache_queries_in_cache';
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
set global query_cache_size= 0;
|
||||
connection default;
|
||||
Signal the debug hook to release the lock.
|
||||
set debug_sync="now SIGNAL go";
|
||||
Show query cache status.
|
||||
show status like 'Qcache_queries_in_cache';
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
connection bug30887con1;
|
||||
a
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
disconnect bug30887con1;
|
||||
disconnect bug30887con2;
|
||||
connection default;
|
||||
set debug_sync= 'RESET';
|
||||
set global query_cache_size= 0;
|
||||
use test;
|
||||
@ -36,24 +46,26 @@ INSERT INTO t1 VALUES (1),(2),(3);
|
||||
SET GLOBAL concurrent_insert= 1;
|
||||
SET GLOBAL query_cache_size= 1024*512;
|
||||
SET GLOBAL query_cache_type= ON;
|
||||
# Switch to connection con1
|
||||
connect con1,localhost,root,,test,,;
|
||||
connect con2,localhost,root,,test,,;
|
||||
connection con1;
|
||||
SET DEBUG_SYNC = "wait_after_query_cache_invalidate SIGNAL parked WAIT_FOR go";
|
||||
# Send concurrent insert, will wait in the query cache table invalidate
|
||||
INSERT INTO t1 VALUES (4);
|
||||
# Switch to connection default
|
||||
connection default;
|
||||
# Wait for concurrent insert to reach the debug point
|
||||
SET DEBUG_SYNC = "now WAIT_FOR parked";
|
||||
# Switch to connection con2
|
||||
connection con2;
|
||||
# Send SELECT that shouldn't be cached
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
# Switch to connection default
|
||||
connection default;
|
||||
# Notify the concurrent insert to proceed
|
||||
SET DEBUG_SYNC = "now SIGNAL go";
|
||||
# Switch to connection con1
|
||||
connection con1;
|
||||
# Gather insert result
|
||||
SHOW STATUS LIKE "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
@ -68,7 +80,9 @@ a
|
||||
SHOW STATUS LIKE "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
# Disconnect
|
||||
disconnect con1;
|
||||
disconnect con2;
|
||||
connection default;
|
||||
# Restore defaults
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
RESET QUERY CACHE;
|
||||
@ -93,7 +107,10 @@ INSERT INTO t2 VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
|
||||
INSERT INTO t3 VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
|
||||
INSERT INTO t4 VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
|
||||
INSERT INTO t5 VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
|
||||
=================================== Connection thd1
|
||||
connect thd2, localhost, root, ,test;
|
||||
connect thd3, localhost, root, ,test;
|
||||
connect thd1, localhost, root, ,test;
|
||||
connection thd1;
|
||||
**
|
||||
** Load Query Cache with a result set and one table.
|
||||
**
|
||||
@ -116,27 +133,27 @@ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
SET DEBUG_SYNC="wait_in_query_cache_invalidate1 SIGNAL parked1_1 WAIT_FOR go1_1";
|
||||
SET DEBUG_SYNC="wait_in_query_cache_invalidate2 SIGNAL parked1_2 WAIT_FOR go1_2";
|
||||
DELETE FROM t1 WHERE a like '%a%';;
|
||||
=================================== Connection default
|
||||
connection default;
|
||||
** Assert that the expect process status is obtained.
|
||||
SET DEBUG_SYNC="now WAIT_FOR parked1_1";
|
||||
**
|
||||
=================================== Connection thd2
|
||||
connection thd2;
|
||||
** On THD2: Insert a result into the cache. This attempt will be blocked
|
||||
** because of a debug hook placed just before the mutex lock after which
|
||||
** the first part of the result set is written.
|
||||
SET DEBUG_SYNC="wait_in_query_cache_insert SIGNAL parked2 WAIT_FOR go2 EXECUTE 1";
|
||||
SELECT SQL_CACHE * FROM t2 UNION SELECT * FROM t3;
|
||||
=================================== Connection default
|
||||
connection default;
|
||||
** Assert that the SELECT-stmt thread reaches the sync point.
|
||||
SET DEBUG_SYNC="now WAIT_FOR parked2";
|
||||
**
|
||||
**
|
||||
=================================== Connection thd3
|
||||
connection thd3;
|
||||
** On THD3: Insert another result into the cache and block on the same
|
||||
** debug hook.
|
||||
SET DEBUG_SYNC="wait_in_query_cache_insert SIGNAL parked3 WAIT_FOR go3 EXECUTE 1";
|
||||
SELECT SQL_CACHE * FROM t4 UNION SELECT * FROM t5;
|
||||
=================================== Connection default
|
||||
connection default;
|
||||
** Assert that the SELECT-stmt thread reaches the sync point.
|
||||
SET DEBUG_SYNC="now WAIT_FOR parked3";
|
||||
**
|
||||
@ -166,23 +183,28 @@ SET DEBUG_SYNC="now SIGNAL go1_2";
|
||||
**
|
||||
*************************************************************************
|
||||
** No tables should be locked
|
||||
=================================== Connection thd2
|
||||
connection thd2;
|
||||
a
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
DELETE FROM t1;
|
||||
DELETE FROM t2;
|
||||
DELETE FROM t3;
|
||||
=================================== Connection thd3
|
||||
connection thd3;
|
||||
a
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
DELETE FROM t4;
|
||||
DELETE FROM t5;
|
||||
=================================== Connection thd1
|
||||
connection thd1;
|
||||
** Done.
|
||||
connection default;
|
||||
disconnect thd1;
|
||||
disconnect thd2;
|
||||
disconnect thd3;
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
SET GLOBAL query_cache_size= 0;
|
||||
connection default;
|
||||
# Restore defaults
|
||||
RESET QUERY CACHE;
|
||||
FLUSH STATUS;
|
||||
@ -199,22 +221,27 @@ INSERT INTO t1 VALUES (1),(2),(3);
|
||||
SET GLOBAL concurrent_insert= 1;
|
||||
SET GLOBAL query_cache_size= 1024*512;
|
||||
SET GLOBAL query_cache_type= ON;
|
||||
# Switch to connection con1
|
||||
connect con1,localhost,root,,test,,;
|
||||
connect con2,localhost,root,,test,,;
|
||||
connection con1;
|
||||
SET DEBUG_SYNC = "wait_in_query_cache_invalidate2 SIGNAL parked WAIT_FOR go";
|
||||
# Send INSERT, will wait in the query cache table invalidation
|
||||
INSERT INTO t1 VALUES (4);;
|
||||
# Switch to connection default
|
||||
connection default;
|
||||
# Wait for insert to reach the debug point
|
||||
SET DEBUG_SYNC = "now WAIT_FOR parked";
|
||||
# Switch to connection con2
|
||||
connection con2;
|
||||
# Send a query that should wait on the query cache lock
|
||||
RESET QUERY CACHE;
|
||||
# Switch to connection default
|
||||
connection default;
|
||||
# Wait for the state to be reflected in the processlist
|
||||
# Signal that the query cache can be unlocked
|
||||
SET DEBUG_SYNC="now SIGNAL go";
|
||||
# Reap con1 and disconnect
|
||||
# Reap con2 and disconnect
|
||||
connection con1;
|
||||
disconnect con1;
|
||||
connection con2;
|
||||
disconnect con2;
|
||||
connection default;
|
||||
# Restore defaults
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
RESET QUERY CACHE;
|
||||
|
Reference in New Issue
Block a user