2008-09-10 12:50:39 +02:00
|
|
|
DROP TABLE IF EXISTS t1;
|
2008-04-10 15:14:28 +02:00
|
|
|
## Creating new table ##
|
|
|
|
CREATE TABLE t1
|
|
|
|
(
|
2008-09-10 12:50:39 +02:00
|
|
|
name VARCHAR(30)
|
2008-04-10 15:14:28 +02:00
|
|
|
);
|
|
|
|
'#--------------------FN_DYNVARS_018_01-------------------------#'
|
2008-09-10 12:50:39 +02:00
|
|
|
SET @start_value= @@global.concurrent_insert;
|
2008-04-10 15:14:28 +02:00
|
|
|
## Setting initial value of variable to 1 ##
|
|
|
|
SET @@global.concurrent_insert = 1;
|
2008-09-10 12:50:39 +02:00
|
|
|
INSERT INTO t1(name) VALUES('Record_1');
|
|
|
|
INSERT INTO t1(name) VALUES('Record_2');
|
|
|
|
INSERT INTO t1(name) VALUES('Record_3');
|
2008-04-10 15:14:28 +02:00
|
|
|
## locking table ##
|
2008-09-10 12:50:39 +02:00
|
|
|
LOCK TABLE t1 READ LOCAL;
|
|
|
|
## Creating new connection to insert some rows in table ##
|
|
|
|
connection test_con1;
|
2008-04-10 15:14:28 +02:00
|
|
|
## New records should come at the end of all rows ##
|
2008-09-10 12:50:39 +02:00
|
|
|
INSERT INTO t1(name) VALUES('Record_4');
|
|
|
|
SELECT * FROM t1;
|
2008-04-10 15:14:28 +02:00
|
|
|
name
|
|
|
|
Record_1
|
|
|
|
Record_2
|
|
|
|
Record_3
|
|
|
|
Record_4
|
|
|
|
## unlocking tables ##
|
2008-09-10 12:50:39 +02:00
|
|
|
connection default;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
## deleting record to create hole in table ##
|
|
|
|
DELETE FROM t1 WHERE name ='Record_2';
|
2008-04-10 15:14:28 +02:00
|
|
|
'#--------------------FN_DYNVARS_018_02-------------------------#'
|
2008-09-10 12:50:39 +02:00
|
|
|
LOCK TABLE t1 READ LOCAL;
|
|
|
|
connection test_con1;
|
|
|
|
SET @@global.concurrent_insert=1;
|
|
|
|
## send INSERT which should be blocked until unlock of the table ##
|
|
|
|
INSERT INTO t1(name) VALUES('Record_7');
|
|
|
|
connection default;
|
|
|
|
## show processlist info and state ##
|
|
|
|
SELECT state,info FROM INFORMATION_SCHEMA.PROCESSLIST
|
Part of fix for bug#52044 "FLUSH TABLES WITH READ LOCK and
FLUSH TABLES <list> WITH READ LOCK are incompatible" to
be pushed as separate patch.
Replaced thread state name "Waiting for table", which was
used by threads waiting for a metadata lock or table flush,
with a set of names which better reflect types of resources
being waited for.
Also replaced "Table lock" thread state name, which was used
by threads waiting on thr_lock.c table level lock, with more
elaborate "Waiting for table level lock", to make it
more consistent with other thread state names.
Updated test cases and their results according to these
changes.
Fixed sys_vars.query_cache_wlock_invalidate_func test to not
to wait for timeout of wait_condition.inc script.
mysql-test/r/query_cache.result:
Added test coverage for query_cache_wlock_invalidate
behavior for implicitly locked tables.
mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result:
Fixed sys_vars.query_cache_wlock_invalidate_func test to not
to wait for timeout of wait_condition.inc script. Reverted
changes to test which introduced timeout and replaced waiting
condition with a more appropriate one.
Test coverage for query_cache_wlock_invalidate behavior for
implicitly locked tables was added to query_cache.test.
mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test:
Fixed sys_vars.query_cache_wlock_invalidate_func test to not
to wait for timeout of wait_condition.inc script. Reverted
changes to test which introduced timeout and replaced waiting
condition with a more appropriate one.
Test coverage for query_cache_wlock_invalidate behavior for
implicitly locked tables was added to query_cache.test.
mysql-test/t/query_cache.test:
Added test coverage for query_cache_wlock_invalidate
behavior for implicitly locked tables.
mysys/thr_lock.c:
Replaced "Table lock" thread state name, which was used by
threads waiting on thr_lock.c table level lock, with more
elaborate "Waiting for table level lock", to make it
consistent with thread state names which are used while
waiting for metadata locks and table flush.
sql/mdl.cc:
Replaced thread state name "Waiting for table", which was
used by threads waiting for a metadata lock or table flush,
with a set of names which better reflect types of resources
being waited for.
To implement this:
- Adjusted MDL_wait::timed_wait() to take thread state name
as parameter.
- Introduced method of MDL_key class which allows to get
thread state name to be used while waiting for resource
corresponding to the key and changed code to use it.
Added array translating namespaces to thread state names
as part of this change.
sql/mdl.h:
To implement this:
- Adjusted MDL_wait::timed_wait() to take thread state name
as parameter.
- Introduced method of MDL_key class which allows to get
thread state name to be used while waiting for resource
corresponding to the key and changed code to use it.
Added array translating namespaces to thread state names
as part of this change.
sql/sql_base.cc:
Replaced thread state name "Waiting for table", which was
used by threads waiting for table flush, with a more elaborate
"Waiting for table flush".
2010-08-06 13:29:37 +02:00
|
|
|
WHERE state= "Waiting for table level lock" AND info LIKE "INSERT INTO t1%";
|
2008-09-10 12:50:39 +02:00
|
|
|
state info
|
Part of fix for bug#52044 "FLUSH TABLES WITH READ LOCK and
FLUSH TABLES <list> WITH READ LOCK are incompatible" to
be pushed as separate patch.
Replaced thread state name "Waiting for table", which was
used by threads waiting for a metadata lock or table flush,
with a set of names which better reflect types of resources
being waited for.
Also replaced "Table lock" thread state name, which was used
by threads waiting on thr_lock.c table level lock, with more
elaborate "Waiting for table level lock", to make it
more consistent with other thread state names.
Updated test cases and their results according to these
changes.
Fixed sys_vars.query_cache_wlock_invalidate_func test to not
to wait for timeout of wait_condition.inc script.
mysql-test/r/query_cache.result:
Added test coverage for query_cache_wlock_invalidate
behavior for implicitly locked tables.
mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result:
Fixed sys_vars.query_cache_wlock_invalidate_func test to not
to wait for timeout of wait_condition.inc script. Reverted
changes to test which introduced timeout and replaced waiting
condition with a more appropriate one.
Test coverage for query_cache_wlock_invalidate behavior for
implicitly locked tables was added to query_cache.test.
mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test:
Fixed sys_vars.query_cache_wlock_invalidate_func test to not
to wait for timeout of wait_condition.inc script. Reverted
changes to test which introduced timeout and replaced waiting
condition with a more appropriate one.
Test coverage for query_cache_wlock_invalidate behavior for
implicitly locked tables was added to query_cache.test.
mysql-test/t/query_cache.test:
Added test coverage for query_cache_wlock_invalidate
behavior for implicitly locked tables.
mysys/thr_lock.c:
Replaced "Table lock" thread state name, which was used by
threads waiting on thr_lock.c table level lock, with more
elaborate "Waiting for table level lock", to make it
consistent with thread state names which are used while
waiting for metadata locks and table flush.
sql/mdl.cc:
Replaced thread state name "Waiting for table", which was
used by threads waiting for a metadata lock or table flush,
with a set of names which better reflect types of resources
being waited for.
To implement this:
- Adjusted MDL_wait::timed_wait() to take thread state name
as parameter.
- Introduced method of MDL_key class which allows to get
thread state name to be used while waiting for resource
corresponding to the key and changed code to use it.
Added array translating namespaces to thread state names
as part of this change.
sql/mdl.h:
To implement this:
- Adjusted MDL_wait::timed_wait() to take thread state name
as parameter.
- Introduced method of MDL_key class which allows to get
thread state name to be used while waiting for resource
corresponding to the key and changed code to use it.
Added array translating namespaces to thread state names
as part of this change.
sql/sql_base.cc:
Replaced thread state name "Waiting for table", which was
used by threads waiting for table flush, with a more elaborate
"Waiting for table flush".
2010-08-06 13:29:37 +02:00
|
|
|
Waiting for table level lock INSERT INTO t1(name) VALUES('Record_7')
|
2008-09-10 12:50:39 +02:00
|
|
|
## table contents befor UNLOCK ##
|
|
|
|
SELECT * FROM t1;
|
|
|
|
name
|
|
|
|
Record_1
|
|
|
|
Record_3
|
|
|
|
Record_4
|
|
|
|
UNLOCK TABLES;
|
|
|
|
## table contens after UNLOCK ##
|
|
|
|
SELECT * FROM t1;
|
|
|
|
name
|
|
|
|
Record_1
|
|
|
|
Record_7
|
|
|
|
Record_3
|
|
|
|
Record_4
|
|
|
|
INSERT INTO t1(name) VALUES('Record_6');
|
|
|
|
connection test_con1;
|
|
|
|
SELECT * FROM t1;
|
|
|
|
name
|
|
|
|
Record_1
|
|
|
|
Record_7
|
|
|
|
Record_3
|
|
|
|
Record_4
|
|
|
|
Record_6
|
|
|
|
connection default;
|
2008-04-10 15:14:28 +02:00
|
|
|
'#--------------------FN_DYNVARS_018_03-------------------------#'
|
|
|
|
## lock table and connect with connection1 ##
|
2008-09-10 12:50:39 +02:00
|
|
|
LOCK TABLE t1 READ LOCAL;
|
|
|
|
connection test_con1;
|
2008-04-10 15:14:28 +02:00
|
|
|
## setting value of concurrent_insert to 2 ##
|
|
|
|
SET @@global.concurrent_insert=2;
|
|
|
|
## Inserting record in table, record should go at the end of the table ##
|
2008-09-10 12:50:39 +02:00
|
|
|
INSERT INTO t1(name) VALUES('Record_5');
|
|
|
|
SELECT * FROM t1;
|
2008-04-10 15:14:28 +02:00
|
|
|
name
|
|
|
|
Record_1
|
2008-09-10 12:50:39 +02:00
|
|
|
Record_7
|
2008-04-10 15:14:28 +02:00
|
|
|
Record_3
|
|
|
|
Record_4
|
2008-09-10 12:50:39 +02:00
|
|
|
Record_6
|
2008-04-10 15:14:28 +02:00
|
|
|
Record_5
|
|
|
|
SELECT @@concurrent_insert;
|
|
|
|
@@concurrent_insert
|
2009-12-22 10:35:56 +01:00
|
|
|
ALWAYS
|
2008-09-10 12:50:39 +02:00
|
|
|
connection default;
|
2008-04-10 15:14:28 +02:00
|
|
|
## Unlocking table ##
|
2008-09-10 12:50:39 +02:00
|
|
|
UNLOCK TABLES;
|
|
|
|
SELECT * FROM t1;
|
2008-04-10 15:14:28 +02:00
|
|
|
name
|
|
|
|
Record_1
|
2008-09-10 12:50:39 +02:00
|
|
|
Record_7
|
2008-04-10 15:14:28 +02:00
|
|
|
Record_3
|
|
|
|
Record_4
|
2008-09-10 12:50:39 +02:00
|
|
|
Record_6
|
2008-04-10 15:14:28 +02:00
|
|
|
Record_5
|
|
|
|
## Inserting new row, this should go in the hole ##
|
2008-09-10 12:50:39 +02:00
|
|
|
INSERT INTO t1(name) VALUES('Record_6');
|
|
|
|
SELECT * FROM t1;
|
2008-04-10 15:14:28 +02:00
|
|
|
name
|
|
|
|
Record_1
|
2008-09-10 12:50:39 +02:00
|
|
|
Record_7
|
2008-04-10 15:14:28 +02:00
|
|
|
Record_3
|
|
|
|
Record_4
|
2008-09-10 12:50:39 +02:00
|
|
|
Record_6
|
2008-04-10 15:14:28 +02:00
|
|
|
Record_5
|
2008-09-10 12:50:39 +02:00
|
|
|
Record_6
|
2008-04-10 15:14:28 +02:00
|
|
|
## connection test_con1 ##
|
2008-09-10 12:50:39 +02:00
|
|
|
DELETE FROM t1 WHERE name ='Record_3';
|
|
|
|
SELECT * FROM t1;
|
2008-04-10 15:14:28 +02:00
|
|
|
name
|
|
|
|
Record_1
|
2008-09-10 12:50:39 +02:00
|
|
|
Record_7
|
2008-04-10 15:14:28 +02:00
|
|
|
Record_4
|
2008-09-10 12:50:39 +02:00
|
|
|
Record_6
|
2008-04-10 15:14:28 +02:00
|
|
|
Record_5
|
2008-09-10 12:50:39 +02:00
|
|
|
Record_6
|
2008-04-10 15:14:28 +02:00
|
|
|
## Dropping table ##
|
2008-09-10 12:50:39 +02:00
|
|
|
DROP TABLE t1;
|
2008-04-10 15:14:28 +02:00
|
|
|
## Disconnecting connection ##
|
2008-09-10 12:50:39 +02:00
|
|
|
SET @@global.concurrent_insert= @start_value;
|