mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
Yet another follow-up for the 5.5 version of fix for
bug #46947 "Embedded SELECT without FOR UPDATE is causing a lock". Fixed comments in tests. Improved comments and performance of auxiliary scripts. mysql-test/include/check_concurrent_insert.inc: Changed script to use temporary table for backing up data in order to make this operation less expensive. Made script more a bit generic by allowing to use multi-column tables with it. Improved comments. mysql-test/include/check_no_concurrent_insert.inc: Changed script to use temporary table for backing up data in order to make this operation less expensive. Made script more a bit generic by allowing to use multi-column tables with it. Improved comments. mysql-test/include/check_no_row_lock.inc: Improved comments in auxiliary script. mysql-test/r/innodb_mysql_lock2.result: Fixed errors in comments for test. mysql-test/r/lock_sync.result: Fixed typo in comments for test. mysql-test/t/innodb_mysql_lock2.test: Fixed errors in comments for test. mysql-test/t/lock_sync.test: Fixed typo in comments for test.
This commit is contained in:
parent
ef9aaa8e2e
commit
7c01868287
7 changed files with 24 additions and 26 deletions
|
@ -10,9 +10,9 @@
|
||||||
# $con_aux2 Name of the second auxiliary connection to be used by this
|
# $con_aux2 Name of the second auxiliary connection to be used by this
|
||||||
# script.
|
# script.
|
||||||
# $statement Statement to be checked.
|
# $statement Statement to be checked.
|
||||||
# $restore_table Table which might be modified affected by statement to be
|
# $restore_table Table which might be modified by statement to be checked
|
||||||
# checked and thus needs backing up before its execution
|
# and thus needs backing up before its execution and
|
||||||
# and restoring after it (can be empty).
|
# restoring after it (can be empty).
|
||||||
#
|
#
|
||||||
# EXAMPLE
|
# EXAMPLE
|
||||||
# lock_sync.test
|
# lock_sync.test
|
||||||
|
@ -25,7 +25,7 @@ set debug_sync= "RESET";
|
||||||
|
|
||||||
if (`SELECT '$restore_table' <> ''`)
|
if (`SELECT '$restore_table' <> ''`)
|
||||||
{
|
{
|
||||||
--eval create table t_backup select * from $restore_table;
|
--eval create temporary table t_backup select * from $restore_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
connection $con_aux1;
|
connection $con_aux1;
|
||||||
|
@ -34,19 +34,19 @@ set debug_sync='after_lock_tables_takes_lock SIGNAL parked WAIT_FOR go';
|
||||||
|
|
||||||
connection $con_aux2;
|
connection $con_aux2;
|
||||||
set debug_sync='now WAIT_FOR parked';
|
set debug_sync='now WAIT_FOR parked';
|
||||||
--send_eval insert into $table values (0);
|
--send_eval insert into $table (i) values (0);
|
||||||
|
|
||||||
--enable_result_log
|
--enable_result_log
|
||||||
--enable_query_log
|
--enable_query_log
|
||||||
connection default;
|
connection default;
|
||||||
# Wait until concurrent insert is successfully executed while
|
# Wait until concurrent insert is successfully executed while
|
||||||
# statement being checked has its tables locked.
|
# statement being checked has its tables locked.
|
||||||
# We use wait_condition.inc instead of simply executing
|
# We use wait_condition.inc instead of simply reaping
|
||||||
# concurrent insert here in order to avoid deadlocks if test
|
# concurrent insert here in order to avoid deadlocks if test
|
||||||
# fails and timing out instead.
|
# fails and to time out gracefully instead.
|
||||||
let $wait_condition=
|
let $wait_condition=
|
||||||
select count(*) = 0 from information_schema.processlist
|
select count(*) = 0 from information_schema.processlist
|
||||||
where info = "insert into $table values (0)";
|
where info = "insert into $table (i) values (0)";
|
||||||
--source include/wait_condition.inc
|
--source include/wait_condition.inc
|
||||||
|
|
||||||
--disable_result_log
|
--disable_result_log
|
||||||
|
@ -86,7 +86,7 @@ if (`SELECT '$restore_table' <> ''`)
|
||||||
{
|
{
|
||||||
--eval truncate table $restore_table;
|
--eval truncate table $restore_table;
|
||||||
--eval insert into $restore_table select * from t_backup;
|
--eval insert into $restore_table select * from t_backup;
|
||||||
drop table t_backup;
|
drop temporary table t_backup;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Clean-up. Reset DEBUG_SYNC facility after use.
|
# Clean-up. Reset DEBUG_SYNC facility after use.
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
# $con_aux2 Name of the second auxiliary connection to be used by this
|
# $con_aux2 Name of the second auxiliary connection to be used by this
|
||||||
# script.
|
# script.
|
||||||
# $statement Statement to be checked.
|
# $statement Statement to be checked.
|
||||||
# $restore_table Table which might be modified affected by statement to be
|
# $restore_table Table which might be modified by statement to be checked
|
||||||
# checked and thus needs backing up before its execution
|
# and thus needs backing up before its execution and
|
||||||
# and restoring after it (can be empty).
|
# restoring after it (can be empty).
|
||||||
#
|
#
|
||||||
# EXAMPLE
|
# EXAMPLE
|
||||||
# lock_sync.test
|
# lock_sync.test
|
||||||
|
@ -25,7 +25,7 @@ set debug_sync= "RESET";
|
||||||
|
|
||||||
if (`SELECT '$restore_table' <> ''`)
|
if (`SELECT '$restore_table' <> ''`)
|
||||||
{
|
{
|
||||||
--eval create table t_backup select * from $restore_table;
|
--eval create temporary table t_backup select * from $restore_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
connection $con_aux1;
|
connection $con_aux1;
|
||||||
|
@ -34,7 +34,7 @@ set debug_sync='after_lock_tables_takes_lock SIGNAL parked WAIT_FOR go';
|
||||||
|
|
||||||
connection $con_aux2;
|
connection $con_aux2;
|
||||||
set debug_sync='now WAIT_FOR parked';
|
set debug_sync='now WAIT_FOR parked';
|
||||||
--send_eval insert into $table values (0);
|
--send_eval insert into $table (i) values (0);
|
||||||
|
|
||||||
--enable_result_log
|
--enable_result_log
|
||||||
--enable_query_log
|
--enable_query_log
|
||||||
|
@ -43,7 +43,7 @@ connection default;
|
||||||
# of our statement.
|
# of our statement.
|
||||||
let $wait_condition=
|
let $wait_condition=
|
||||||
select count(*) = 1 from information_schema.processlist
|
select count(*) = 1 from information_schema.processlist
|
||||||
where state = "Table lock" and info = "insert into $table values (0)";
|
where state = "Table lock" and info = "insert into $table (i) values (0)";
|
||||||
--source include/wait_condition.inc
|
--source include/wait_condition.inc
|
||||||
|
|
||||||
--disable_result_log
|
--disable_result_log
|
||||||
|
@ -71,7 +71,7 @@ if (`SELECT '$restore_table' <> ''`)
|
||||||
{
|
{
|
||||||
--eval truncate table $restore_table;
|
--eval truncate table $restore_table;
|
||||||
--eval insert into $restore_table select * from t_backup;
|
--eval insert into $restore_table select * from t_backup;
|
||||||
drop table t_backup;
|
drop temporary table t_backup;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Clean-up. Reset DEBUG_SYNC facility after use.
|
# Clean-up. Reset DEBUG_SYNC facility after use.
|
||||||
|
|
|
@ -29,9 +29,9 @@ connection default;
|
||||||
# Wait until statement is successfully executed while
|
# Wait until statement is successfully executed while
|
||||||
# all rows in table are X-locked. This means that it
|
# all rows in table are X-locked. This means that it
|
||||||
# does not acquire any row locks.
|
# does not acquire any row locks.
|
||||||
# We use wait_condition.inc instead of simply executing
|
# We use wait_condition.inc instead of simply reaping
|
||||||
# statement here in order to avoid deadlocks if test
|
# statement here in order to avoid deadlocks if test
|
||||||
# fails and timing out instead.
|
# fails and to time out gracefully instead.
|
||||||
let $wait_condition=
|
let $wait_condition=
|
||||||
select count(*) = 0 from information_schema.processlist
|
select count(*) = 0 from information_schema.processlist
|
||||||
where info = "$statement";
|
where info = "$statement";
|
||||||
|
|
|
@ -178,8 +178,7 @@ end|
|
||||||
# 1.1 Simple SELECT statement.
|
# 1.1 Simple SELECT statement.
|
||||||
#
|
#
|
||||||
# No locks are necessary as this statement won't be written
|
# No locks are necessary as this statement won't be written
|
||||||
# to the binary log and thanks to how MyISAM works SELECT
|
# to the binary log and InnoDB supports snapshots.
|
||||||
# will see version of the table prior to concurrent insert.
|
|
||||||
Success: 'select * from t1' doesn't take row locks on 't1'.
|
Success: 'select * from t1' doesn't take row locks on 't1'.
|
||||||
#
|
#
|
||||||
# 1.2 Multi-UPDATE statement.
|
# 1.2 Multi-UPDATE statement.
|
||||||
|
@ -484,7 +483,7 @@ Success: 'insert into t2 values (f13((select i+10 from t1 where i=1)))' takes sh
|
||||||
# row locks on the data it reads.
|
# row locks on the data it reads.
|
||||||
Success: 'call p2(@a)' doesn't take row locks on 't1'.
|
Success: 'call p2(@a)' doesn't take row locks on 't1'.
|
||||||
#
|
#
|
||||||
# 5.2 Function that modifes data and uses CALL,
|
# 5.2 Function that modifies data and uses CALL,
|
||||||
# which reads a table through SELECT.
|
# which reads a table through SELECT.
|
||||||
#
|
#
|
||||||
# Since a call to such function is written to the binary
|
# Since a call to such function is written to the binary
|
||||||
|
|
|
@ -511,7 +511,7 @@ Success: 'insert into t2 values (f13((select i+10 from t1 where i=1)))' doesn't
|
||||||
# strong locks on the data it reads.
|
# strong locks on the data it reads.
|
||||||
Success: 'call p2(@a)' allows concurrent inserts into 't1'.
|
Success: 'call p2(@a)' allows concurrent inserts into 't1'.
|
||||||
#
|
#
|
||||||
# 5.2 Function that modifes data and uses CALL,
|
# 5.2 Function that modifies data and uses CALL,
|
||||||
# which reads a table through SELECT.
|
# which reads a table through SELECT.
|
||||||
#
|
#
|
||||||
# Since a call to such function is written to the binary
|
# Since a call to such function is written to the binary
|
||||||
|
|
|
@ -204,8 +204,7 @@ let $table= t1;
|
||||||
--echo # 1.1 Simple SELECT statement.
|
--echo # 1.1 Simple SELECT statement.
|
||||||
--echo #
|
--echo #
|
||||||
--echo # No locks are necessary as this statement won't be written
|
--echo # No locks are necessary as this statement won't be written
|
||||||
--echo # to the binary log and thanks to how MyISAM works SELECT
|
--echo # to the binary log and InnoDB supports snapshots.
|
||||||
--echo # will see version of the table prior to concurrent insert.
|
|
||||||
let $statement= select * from t1;
|
let $statement= select * from t1;
|
||||||
--source include/check_no_row_lock.inc
|
--source include/check_no_row_lock.inc
|
||||||
|
|
||||||
|
@ -659,7 +658,7 @@ let $statement= call p2(@a);
|
||||||
--source include/check_no_row_lock.inc
|
--source include/check_no_row_lock.inc
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # 5.2 Function that modifes data and uses CALL,
|
--echo # 5.2 Function that modifies data and uses CALL,
|
||||||
--echo # which reads a table through SELECT.
|
--echo # which reads a table through SELECT.
|
||||||
--echo #
|
--echo #
|
||||||
--echo # Since a call to such function is written to the binary
|
--echo # Since a call to such function is written to the binary
|
||||||
|
|
|
@ -716,7 +716,7 @@ let $restore_table= ;
|
||||||
--source include/check_concurrent_insert.inc
|
--source include/check_concurrent_insert.inc
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # 5.2 Function that modifes data and uses CALL,
|
--echo # 5.2 Function that modifies data and uses CALL,
|
||||||
--echo # which reads a table through SELECT.
|
--echo # which reads a table through SELECT.
|
||||||
--echo #
|
--echo #
|
||||||
--echo # Since a call to such function is written to the binary
|
--echo # Since a call to such function is written to the binary
|
||||||
|
|
Loading…
Add table
Reference in a new issue