1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

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.
This commit is contained in:
Konstantin Osipov
2010-02-03 14:09:36 +03:00
parent 0ce6d93f85
commit b7a80c679c
6 changed files with 34 additions and 20 deletions

View File

@@ -37,9 +37,9 @@ INSERT INTO t1(name) VALUES('Record_7');
connection default;
## show processlist info and state ##
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
Locked INSERT INTO t1(name) VALUES('Record_7')
Table lock INSERT INTO t1(name) VALUES('Record_7')
## table contents befor UNLOCK ##
SELECT * FROM t1;
name

View File

@@ -4,6 +4,7 @@ Creating connection con0
Creating connection con1
SET @global_delayed_insert_limit = @@GLOBAL.delayed_insert_limit;
CREATE TABLE t1 (a VARCHAR(100),b VARCHAR(100),c VARCHAR(100));
CREATE VIEW v1 as select * from t1;
'#--------------------FN_DYNVARS_25_01-------------------------#'
SET GLOBAL delayed_insert_limit = 14;
INSERT INTO t1 VALUES('1','1','1');
@@ -12,7 +13,7 @@ INSERT INTO t1 VALUES('3','1','1');
INSERT INTO t1 VALUES('4','1','1');
INSERT INTO t1 VALUES('5','1','1');
INSERT INTO t1 VALUES('6','1','1');
LOCK TABLE t1 WRITE;
LOCK TABLE v1 WRITE;
** Connection con1 **
INSERT DELAYED INTO t1 VALUES('7','1','1');
INSERT DELAYED INTO t1 VALUES('8','1','1');
@@ -70,8 +71,10 @@ SELECT COUNT(*) FROM t1;
COUNT(*)
43
DROP TABLE t1;
DROP VIEW v1;
'#--------------------FN_DYNVARS_25_02-------------------------#'
CREATE TABLE t1 (a VARCHAR(100));
CREATE VIEW v1 AS SELECT * FROM t1;
SET GLOBAL delayed_insert_limit = 20;
INSERT INTO t1 VALUES('1');
INSERT INTO t1 VALUES('2');
@@ -79,7 +82,7 @@ INSERT INTO t1 VALUES('3');
INSERT INTO t1 VALUES('4');
INSERT INTO t1 VALUES('5');
INSERT INTO t1 VALUES('6');
LOCK TABLE t1 WRITE;
LOCK TABLE v1 WRITE;
** Connection con1 **
Asynchronous execute
INSERT DELAYED INTO t1 VALUES('7');
@@ -116,5 +119,6 @@ COUNT(*) = 22
1
** Connection default**
DROP TABLE t1;
DROP VIEW v1;
SET @@GLOBAL.delayed_insert_limit = @global_delayed_insert_limit;
Disconnecting from con1, con0

View File

@@ -11,6 +11,7 @@ CREATE TABLE t1(id int, value varchar(10));
INSERT INTO t1 VALUES(1, 'val1');
INSERT INTO t1 VALUES(2, 'val2');
INSERT INTO t1 VALUES(3, 'val3');
CREATE VIEW v1 AS SELECT * FROM t1;
SET GLOBAL query_cache_size = 131072;
FLUSHING CACHE
SET GLOBAL query_cache_size = 0;
@@ -32,11 +33,11 @@ SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name Value
Qcache_queries_in_cache 1
1 Expected
LOCK TABLE t1 WRITE;
LOCK TABLE v1 WRITE;
UNLOCK TABLES;
SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name Value
Qcache_queries_in_cache 0
Qcache_queries_in_cache 1
0 Expected
'#----------------------------FN_DYNVARS_136_02-----------------------#'
SELECT * FROM t1;
@@ -48,12 +49,13 @@ id value
2 val2
3 val3
** Connection con0 **
LOCK TABLE t1 WRITE;
LOCK TABLE v1 WRITE;
** Connection con1 **
** Asynchronous Execution **
SELECT * FROM t1;
** Connection con0 **
wait until table is locked
Timeout in wait_condition.inc for SELECT count(*) > 0 FROM information_schema.processlist WHERE state= 'Table lock'
UNLOCK TABLES;
** Connection con1 **
** Asynchronous Result **
@@ -77,7 +79,7 @@ SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name Value
Qcache_queries_in_cache 1
1 Expected
LOCK TABLE t1 WRITE;
LOCK TABLE v1 WRITE;
UNLOCK TABLES;
SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name Value
@@ -100,7 +102,7 @@ id value
2 val2
3 val3
** Connection con0 **
LOCK TABLE t1 WRITE;
LOCK TABLE v1 WRITE;
** Connection con1 **
** Should not be blocked **
SELECT * FROM t1;
@@ -163,3 +165,4 @@ SET @@GLOBAL.query_cache_type = @old_cache_type;
** Connection default **
Disconnecting Connections con0, con1
DROP TABLE t1;
DROP VIEW v1;