Commit f9a9c10a authored by Konstantin Osipov's avatar Konstantin Osipov

Merge next-mr -> next-4284.

Post merge fixes. In sys_vars tests suite, whenever we use LOCK TABLE WRITE,
adjust to lock the subject table indirecty via a view, to ensure that
there the desired lock conflict in thr_lock.c is still taking place.
If locked directly in LOCK TABLES list, thr_lock.c does not get
involved.
Adjust the thread wait state names in information_schema.processlist.
parent 514a2e75
...@@ -37,9 +37,9 @@ INSERT INTO t1(name) VALUES('Record_7'); ...@@ -37,9 +37,9 @@ INSERT INTO t1(name) VALUES('Record_7');
connection default; connection default;
## show processlist info and state ## ## show processlist info and state ##
SELECT state,info FROM INFORMATION_SCHEMA.PROCESSLIST SELECT state,info FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE state= "Locked" AND info LIKE "INSERT INTO t1%"; WHERE state= "Table lock" AND info LIKE "INSERT INTO t1%";
state info state info
Locked INSERT INTO t1(name) VALUES('Record_7') Table lock INSERT INTO t1(name) VALUES('Record_7')
## table contents befor UNLOCK ## ## table contents befor UNLOCK ##
SELECT * FROM t1; SELECT * FROM t1;
name name
......
...@@ -4,6 +4,7 @@ Creating connection con0 ...@@ -4,6 +4,7 @@ Creating connection con0
Creating connection con1 Creating connection con1
SET @global_delayed_insert_limit = @@GLOBAL.delayed_insert_limit; SET @global_delayed_insert_limit = @@GLOBAL.delayed_insert_limit;
CREATE TABLE t1 (a VARCHAR(100),b VARCHAR(100),c VARCHAR(100)); CREATE TABLE t1 (a VARCHAR(100),b VARCHAR(100),c VARCHAR(100));
CREATE VIEW v1 as select * from t1;
'#--------------------FN_DYNVARS_25_01-------------------------#' '#--------------------FN_DYNVARS_25_01-------------------------#'
SET GLOBAL delayed_insert_limit = 14; SET GLOBAL delayed_insert_limit = 14;
INSERT INTO t1 VALUES('1','1','1'); INSERT INTO t1 VALUES('1','1','1');
...@@ -12,7 +13,7 @@ INSERT INTO t1 VALUES('3','1','1'); ...@@ -12,7 +13,7 @@ INSERT INTO t1 VALUES('3','1','1');
INSERT INTO t1 VALUES('4','1','1'); INSERT INTO t1 VALUES('4','1','1');
INSERT INTO t1 VALUES('5','1','1'); INSERT INTO t1 VALUES('5','1','1');
INSERT INTO t1 VALUES('6','1','1'); INSERT INTO t1 VALUES('6','1','1');
LOCK TABLE t1 WRITE; LOCK TABLE v1 WRITE;
** Connection con1 ** ** Connection con1 **
INSERT DELAYED INTO t1 VALUES('7','1','1'); INSERT DELAYED INTO t1 VALUES('7','1','1');
INSERT DELAYED INTO t1 VALUES('8','1','1'); INSERT DELAYED INTO t1 VALUES('8','1','1');
...@@ -70,8 +71,10 @@ SELECT COUNT(*) FROM t1; ...@@ -70,8 +71,10 @@ SELECT COUNT(*) FROM t1;
COUNT(*) COUNT(*)
43 43
DROP TABLE t1; DROP TABLE t1;
DROP VIEW v1;
'#--------------------FN_DYNVARS_25_02-------------------------#' '#--------------------FN_DYNVARS_25_02-------------------------#'
CREATE TABLE t1 (a VARCHAR(100)); CREATE TABLE t1 (a VARCHAR(100));
CREATE VIEW v1 AS SELECT * FROM t1;
SET GLOBAL delayed_insert_limit = 20; SET GLOBAL delayed_insert_limit = 20;
INSERT INTO t1 VALUES('1'); INSERT INTO t1 VALUES('1');
INSERT INTO t1 VALUES('2'); INSERT INTO t1 VALUES('2');
...@@ -79,7 +82,7 @@ INSERT INTO t1 VALUES('3'); ...@@ -79,7 +82,7 @@ INSERT INTO t1 VALUES('3');
INSERT INTO t1 VALUES('4'); INSERT INTO t1 VALUES('4');
INSERT INTO t1 VALUES('5'); INSERT INTO t1 VALUES('5');
INSERT INTO t1 VALUES('6'); INSERT INTO t1 VALUES('6');
LOCK TABLE t1 WRITE; LOCK TABLE v1 WRITE;
** Connection con1 ** ** Connection con1 **
Asynchronous execute Asynchronous execute
INSERT DELAYED INTO t1 VALUES('7'); INSERT DELAYED INTO t1 VALUES('7');
...@@ -116,5 +119,6 @@ COUNT(*) = 22 ...@@ -116,5 +119,6 @@ COUNT(*) = 22
1 1
** Connection default** ** Connection default**
DROP TABLE t1; DROP TABLE t1;
DROP VIEW v1;
SET @@GLOBAL.delayed_insert_limit = @global_delayed_insert_limit; SET @@GLOBAL.delayed_insert_limit = @global_delayed_insert_limit;
Disconnecting from con1, con0 Disconnecting from con1, con0
...@@ -11,6 +11,7 @@ CREATE TABLE t1(id int, value varchar(10)); ...@@ -11,6 +11,7 @@ CREATE TABLE t1(id int, value varchar(10));
INSERT INTO t1 VALUES(1, 'val1'); INSERT INTO t1 VALUES(1, 'val1');
INSERT INTO t1 VALUES(2, 'val2'); INSERT INTO t1 VALUES(2, 'val2');
INSERT INTO t1 VALUES(3, 'val3'); INSERT INTO t1 VALUES(3, 'val3');
CREATE VIEW v1 AS SELECT * FROM t1;
SET GLOBAL query_cache_size = 131072; SET GLOBAL query_cache_size = 131072;
FLUSHING CACHE FLUSHING CACHE
SET GLOBAL query_cache_size = 0; SET GLOBAL query_cache_size = 0;
...@@ -32,11 +33,11 @@ SHOW STATUS LIKE 'Qcache_queries_in_cache'; ...@@ -32,11 +33,11 @@ SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name Value Variable_name Value
Qcache_queries_in_cache 1 Qcache_queries_in_cache 1
1 Expected 1 Expected
LOCK TABLE t1 WRITE; LOCK TABLE v1 WRITE;
UNLOCK TABLES; UNLOCK TABLES;
SHOW STATUS LIKE 'Qcache_queries_in_cache'; SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name Value Variable_name Value
Qcache_queries_in_cache 0 Qcache_queries_in_cache 1
0 Expected 0 Expected
'#----------------------------FN_DYNVARS_136_02-----------------------#' '#----------------------------FN_DYNVARS_136_02-----------------------#'
SELECT * FROM t1; SELECT * FROM t1;
...@@ -48,12 +49,13 @@ id value ...@@ -48,12 +49,13 @@ id value
2 val2 2 val2
3 val3 3 val3
** Connection con0 ** ** Connection con0 **
LOCK TABLE t1 WRITE; LOCK TABLE v1 WRITE;
** Connection con1 ** ** Connection con1 **
** Asynchronous Execution ** ** Asynchronous Execution **
SELECT * FROM t1; SELECT * FROM t1;
** Connection con0 ** ** Connection con0 **
wait until table is locked wait until table is locked
Timeout in wait_condition.inc for SELECT count(*) > 0 FROM information_schema.processlist WHERE state= 'Table lock'
UNLOCK TABLES; UNLOCK TABLES;
** Connection con1 ** ** Connection con1 **
** Asynchronous Result ** ** Asynchronous Result **
...@@ -77,7 +79,7 @@ SHOW STATUS LIKE 'Qcache_queries_in_cache'; ...@@ -77,7 +79,7 @@ SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name Value Variable_name Value
Qcache_queries_in_cache 1 Qcache_queries_in_cache 1
1 Expected 1 Expected
LOCK TABLE t1 WRITE; LOCK TABLE v1 WRITE;
UNLOCK TABLES; UNLOCK TABLES;
SHOW STATUS LIKE 'Qcache_queries_in_cache'; SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name Value Variable_name Value
...@@ -100,7 +102,7 @@ id value ...@@ -100,7 +102,7 @@ id value
2 val2 2 val2
3 val3 3 val3
** Connection con0 ** ** Connection con0 **
LOCK TABLE t1 WRITE; LOCK TABLE v1 WRITE;
** Connection con1 ** ** Connection con1 **
** Should not be blocked ** ** Should not be blocked **
SELECT * FROM t1; SELECT * FROM t1;
...@@ -163,3 +165,4 @@ SET @@GLOBAL.query_cache_type = @old_cache_type; ...@@ -163,3 +165,4 @@ SET @@GLOBAL.query_cache_type = @old_cache_type;
** Connection default ** ** Connection default **
Disconnecting Connections con0, con1 Disconnecting Connections con0, con1
DROP TABLE t1; DROP TABLE t1;
DROP VIEW v1;
...@@ -98,12 +98,12 @@ INSERT INTO t1(name) VALUES('Record_7'); ...@@ -98,12 +98,12 @@ INSERT INTO t1(name) VALUES('Record_7');
connection default; connection default;
# wait until INSERT will be locked (low performance) # wait until INSERT will be locked (low performance)
let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE state= "Locked" AND info LIKE "INSERT INTO t1%"; WHERE state= "Table lock" AND info LIKE "INSERT INTO t1%";
--source include/wait_condition.inc --source include/wait_condition.inc
--echo ## show processlist info and state ## --echo ## show processlist info and state ##
SELECT state,info FROM INFORMATION_SCHEMA.PROCESSLIST SELECT state,info FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE state= "Locked" AND info LIKE "INSERT INTO t1%"; WHERE state= "Table lock" AND info LIKE "INSERT INTO t1%";
--echo ## table contents befor UNLOCK ## --echo ## table contents befor UNLOCK ##
SELECT * FROM t1; SELECT * FROM t1;
UNLOCK TABLES; UNLOCK TABLES;
......
...@@ -46,6 +46,7 @@ SET @global_delayed_insert_limit = @@GLOBAL.delayed_insert_limit; ...@@ -46,6 +46,7 @@ SET @global_delayed_insert_limit = @@GLOBAL.delayed_insert_limit;
# #
CREATE TABLE t1 (a VARCHAR(100),b VARCHAR(100),c VARCHAR(100)); CREATE TABLE t1 (a VARCHAR(100),b VARCHAR(100),c VARCHAR(100));
CREATE VIEW v1 as select * from t1;
--echo '#--------------------FN_DYNVARS_25_01-------------------------#' --echo '#--------------------FN_DYNVARS_25_01-------------------------#'
...@@ -60,7 +61,7 @@ INSERT INTO t1 VALUES('4','1','1'); ...@@ -60,7 +61,7 @@ INSERT INTO t1 VALUES('4','1','1');
INSERT INTO t1 VALUES('5','1','1'); INSERT INTO t1 VALUES('5','1','1');
INSERT INTO t1 VALUES('6','1','1'); INSERT INTO t1 VALUES('6','1','1');
LOCK TABLE t1 WRITE; LOCK TABLE v1 WRITE;
--echo ** Connection con1 ** --echo ** Connection con1 **
connection con1; connection con1;
...@@ -122,7 +123,7 @@ connection default; ...@@ -122,7 +123,7 @@ connection default;
--echo ** Wait till con0 is blocked ** --echo ** Wait till con0 is blocked **
let $wait_condition= let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE state = 'Locked' AND info = '$my_select'; WHERE state = 'Table lock' AND info = '$my_select';
--source include/wait_condition.inc --source include/wait_condition.inc
UNLOCK TABLES; UNLOCK TABLES;
...@@ -153,6 +154,7 @@ let $wait_condition= SELECT count(*) = 43 FROM t1; ...@@ -153,6 +154,7 @@ let $wait_condition= SELECT count(*) = 43 FROM t1;
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
DROP TABLE t1; DROP TABLE t1;
DROP VIEW v1;
--echo '#--------------------FN_DYNVARS_25_02-------------------------#' --echo '#--------------------FN_DYNVARS_25_02-------------------------#'
...@@ -160,6 +162,7 @@ DROP TABLE t1; ...@@ -160,6 +162,7 @@ DROP TABLE t1;
# delayed_insert_limit is bigger than the number of inserted rows # delayed_insert_limit is bigger than the number of inserted rows
CREATE TABLE t1 (a VARCHAR(100)); CREATE TABLE t1 (a VARCHAR(100));
CREATE VIEW v1 AS SELECT * FROM t1;
SET GLOBAL delayed_insert_limit = 20; SET GLOBAL delayed_insert_limit = 20;
...@@ -170,7 +173,7 @@ INSERT INTO t1 VALUES('4'); ...@@ -170,7 +173,7 @@ INSERT INTO t1 VALUES('4');
INSERT INTO t1 VALUES('5'); INSERT INTO t1 VALUES('5');
INSERT INTO t1 VALUES('6'); INSERT INTO t1 VALUES('6');
LOCK TABLE t1 WRITE; LOCK TABLE v1 WRITE;
--echo ** Connection con1 ** --echo ** Connection con1 **
connection con1; connection con1;
...@@ -214,7 +217,7 @@ connection default; ...@@ -214,7 +217,7 @@ connection default;
--echo ** Wait till con0 is blocked ** --echo ** Wait till con0 is blocked **
let $wait_condition= let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE state = 'Locked' AND info = '$my_select'; WHERE state = 'Table lock' AND info = '$my_select';
--source include/wait_condition.inc --source include/wait_condition.inc
UNLOCK TABLES; UNLOCK TABLES;
...@@ -240,6 +243,7 @@ eval $my_select; ...@@ -240,6 +243,7 @@ eval $my_select;
--echo ** Connection default** --echo ** Connection default**
connection default; connection default;
DROP TABLE t1; DROP TABLE t1;
DROP VIEW v1;
SET @@GLOBAL.delayed_insert_limit = @global_delayed_insert_limit; SET @@GLOBAL.delayed_insert_limit = @global_delayed_insert_limit;
--echo Disconnecting from con1, con0 --echo Disconnecting from con1, con0
......
...@@ -60,6 +60,8 @@ INSERT INTO t1 VALUES(1, 'val1'); ...@@ -60,6 +60,8 @@ INSERT INTO t1 VALUES(1, 'val1');
INSERT INTO t1 VALUES(2, 'val2'); INSERT INTO t1 VALUES(2, 'val2');
INSERT INTO t1 VALUES(3, 'val3'); INSERT INTO t1 VALUES(3, 'val3');
CREATE VIEW v1 AS SELECT * FROM t1;
# #
# Clearing the query cache and setting up cache size # Clearing the query cache and setting up cache size
# #
...@@ -99,7 +101,7 @@ SELECT * FROM t1; ...@@ -99,7 +101,7 @@ SELECT * FROM t1;
SHOW STATUS LIKE 'Qcache_queries_in_cache'; SHOW STATUS LIKE 'Qcache_queries_in_cache';
--echo 1 Expected --echo 1 Expected
LOCK TABLE t1 WRITE; LOCK TABLE v1 WRITE;
UNLOCK TABLES; UNLOCK TABLES;
...@@ -127,7 +129,7 @@ SELECT * FROM t1; ...@@ -127,7 +129,7 @@ SELECT * FROM t1;
--echo ** Connection con0 ** --echo ** Connection con0 **
connection con0; connection con0;
LOCK TABLE t1 WRITE; LOCK TABLE v1 WRITE;
--echo ** Connection con1 ** --echo ** Connection con1 **
connection con1; connection con1;
...@@ -139,7 +141,7 @@ send SELECT * FROM t1; ...@@ -139,7 +141,7 @@ send SELECT * FROM t1;
connection con0; connection con0;
--echo wait until table is locked --echo wait until table is locked
let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE state= 'Locked'; let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE state= 'Table lock';
--source include/wait_condition.inc --source include/wait_condition.inc
UNLOCK TABLES; UNLOCK TABLES;
...@@ -175,7 +177,7 @@ SELECT * FROM t1; ...@@ -175,7 +177,7 @@ SELECT * FROM t1;
SHOW STATUS LIKE 'Qcache_queries_in_cache'; SHOW STATUS LIKE 'Qcache_queries_in_cache';
--echo 1 Expected --echo 1 Expected
LOCK TABLE t1 WRITE; LOCK TABLE v1 WRITE;
UNLOCK TABLES; UNLOCK TABLES;
...@@ -199,7 +201,7 @@ SELECT * FROM t1; ...@@ -199,7 +201,7 @@ SELECT * FROM t1;
--echo ** Connection con0 ** --echo ** Connection con0 **
connection con0; connection con0;
LOCK TABLE t1 WRITE; LOCK TABLE v1 WRITE;
--echo ** Connection con1 ** --echo ** Connection con1 **
connection con1; connection con1;
...@@ -281,6 +283,7 @@ disconnect con0; ...@@ -281,6 +283,7 @@ disconnect con0;
disconnect con1; disconnect con1;
DROP TABLE t1; DROP TABLE t1;
DROP VIEW v1;
--enable_ps_protocol --enable_ps_protocol
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment