mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
merge: 5.1 -> 5.1-rpl-merge
conflicts: Text conflict in mysql-test/suite/sys_vars/r/rpl_max_binlog_size_func.result Text conflict in mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test
This commit is contained in:
121
mysql-test/suite/sys_vars/r/concurrent_insert_func.result
Normal file
121
mysql-test/suite/sys_vars/r/concurrent_insert_func.result
Normal file
@@ -0,0 +1,121 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
## Creating new table ##
|
||||
CREATE TABLE t1
|
||||
(
|
||||
name VARCHAR(30)
|
||||
);
|
||||
'#--------------------FN_DYNVARS_018_01-------------------------#'
|
||||
SET @start_value= @@global.concurrent_insert;
|
||||
## Setting initial value of variable to 1 ##
|
||||
SET @@global.concurrent_insert = 1;
|
||||
INSERT INTO t1(name) VALUES('Record_1');
|
||||
INSERT INTO t1(name) VALUES('Record_2');
|
||||
INSERT INTO t1(name) VALUES('Record_3');
|
||||
## locking table ##
|
||||
LOCK TABLE t1 READ LOCAL;
|
||||
## Creating new connection to insert some rows in table ##
|
||||
connection test_con1;
|
||||
## New records should come at the end of all rows ##
|
||||
INSERT INTO t1(name) VALUES('Record_4');
|
||||
SELECT * FROM t1;
|
||||
name
|
||||
Record_1
|
||||
Record_2
|
||||
Record_3
|
||||
Record_4
|
||||
## unlocking tables ##
|
||||
connection default;
|
||||
UNLOCK TABLES;
|
||||
## deleting record to create hole in table ##
|
||||
DELETE FROM t1 WHERE name ='Record_2';
|
||||
'#--------------------FN_DYNVARS_018_02-------------------------#'
|
||||
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
|
||||
WHERE state= "Locked" AND info LIKE "INSERT INTO t1%";
|
||||
state info
|
||||
Locked INSERT INTO t1(name) VALUES('Record_7')
|
||||
## 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;
|
||||
'#--------------------FN_DYNVARS_018_03-------------------------#'
|
||||
## lock table and connect with connection1 ##
|
||||
LOCK TABLE t1 READ LOCAL;
|
||||
connection test_con1;
|
||||
## 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 ##
|
||||
INSERT INTO t1(name) VALUES('Record_5');
|
||||
SELECT * FROM t1;
|
||||
name
|
||||
Record_1
|
||||
Record_7
|
||||
Record_3
|
||||
Record_4
|
||||
Record_6
|
||||
Record_5
|
||||
SELECT @@concurrent_insert;
|
||||
@@concurrent_insert
|
||||
2
|
||||
connection default;
|
||||
## Unlocking table ##
|
||||
UNLOCK TABLES;
|
||||
SELECT * FROM t1;
|
||||
name
|
||||
Record_1
|
||||
Record_7
|
||||
Record_3
|
||||
Record_4
|
||||
Record_6
|
||||
Record_5
|
||||
## Inserting new row, this should go in the hole ##
|
||||
INSERT INTO t1(name) VALUES('Record_6');
|
||||
SELECT * FROM t1;
|
||||
name
|
||||
Record_1
|
||||
Record_7
|
||||
Record_3
|
||||
Record_4
|
||||
Record_6
|
||||
Record_5
|
||||
Record_6
|
||||
## connection test_con1 ##
|
||||
DELETE FROM t1 WHERE name ='Record_3';
|
||||
SELECT * FROM t1;
|
||||
name
|
||||
Record_1
|
||||
Record_7
|
||||
Record_4
|
||||
Record_6
|
||||
Record_5
|
||||
Record_6
|
||||
## Dropping table ##
|
||||
DROP TABLE t1;
|
||||
## Disconnecting connection ##
|
||||
SET @@global.concurrent_insert= @start_value;
|
||||
Reference in New Issue
Block a user