diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:24:36 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:24:36 +0000 |
commit | 06eaf7232e9a920468c0f8d74dcf2fe8b555501c (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/main/merge-big.test | |
parent | Initial commit. (diff) | |
download | mariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.tar.xz mariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/main/merge-big.test')
-rw-r--r-- | mysql-test/main/merge-big.test | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/mysql-test/main/merge-big.test b/mysql-test/main/merge-big.test new file mode 100644 index 00000000..873161a3 --- /dev/null +++ b/mysql-test/main/merge-big.test @@ -0,0 +1,80 @@ +# +# Test of MERGE tables with multisession and many waits. +# +# This test takes rather long time so let us run it only in --big-test mode +--source include/big_test.inc +# We use some debug-only features in this test +--source include/have_debug.inc +# We use INFORMATION_SCHEMA.PROCESSLIST in this test +--source include/not_embedded.inc + +--disable_warnings +drop table if exists t1,t2,t3,t4,t5,t6; +--enable_warnings + +--echo # +--echo # Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE +--echo # corrupts a MERGE table +--echo # Problem #3 +--echo # +# Two FLUSH TABLES within a LOCK TABLES segment could invalidate the lock. +# This did *not* require a MERGE table. +# +# To increase reproducibility it was necessary to enter a sleep of 2 +# seconds at the end of wait_for_tables() after unlock of LOCK_open. In +# 5.0 and 5.1 the sleep must be inserted in open_and_lock_tables() after +# open_tables() instead. wait_for_tables() is not used in this case. The +# problem was that FLUSH TABLES releases LOCK_open while having unlocked +# and closed all tables. When this happened while a thread was in the +# loop in mysql_lock_tables() right after wait_for_tables() +# (open_tables()) and before retrying to lock, the thread got the lock. +# And it did not notice that the table needed a refresh after the +# [re-]open. So it executed its statement on the table. +# +# The first FLUSH TABLES kicked the INSERT out of thr_multi_lock() and +# let it wait in wait_for_tables() (open_table()). The second FLUSH +# TABLES must happen while the INSERT was on its way from +# wait_for_tables() (open_table()) to the next call of thr_multi_lock(). +# This needed to be supported by a sleep to make it repeatable. +# +CREATE TABLE t1 (c1 INT) ENGINE= MyISAM; +LOCK TABLE t1 WRITE; +#SELECT NOW(); + connect (con1,localhost,root,,); + let $con1_id= `SELECT CONNECTION_ID()`; + SET @orig_debug=@@global.debug_dbug; + SET GLOBAL debug_dbug="+d,sleep_open_and_lock_after_open"; + send INSERT INTO t1 VALUES (1); +connection default; +--echo # Let INSERT go into thr_multi_lock(). +#--sleep 8 +#SELECT ID,STATE,INFO FROM INFORMATION_SCHEMA.PROCESSLIST; +let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST + WHERE ID = $con1_id AND STATE = 'Waiting for table metadata lock'; +--source include/wait_condition.inc +#SELECT NOW(); +--echo # Kick INSERT out of thr_multi_lock(). +FLUSH TABLES; +#SELECT NOW(); +--echo # Let INSERT go through open_tables() where it sleeps. +#--sleep 8 +#SELECT ID,STATE,INFO FROM INFORMATION_SCHEMA.PROCESSLIST; +let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST + WHERE ID = $con1_id AND STATE = 'Waiting for table metadata lock'; +--source include/wait_condition.inc +#SELECT NOW(); +--echo # Unlock and close table and wait for con1 to close too. +FLUSH TABLES; +#SELECT NOW(); +--disable_service_connection +--echo # This should give no result. +SELECT * FROM t1; +--enable_service_connection +#SELECT NOW(); +UNLOCK TABLES; + connection con1; + reap; + SET GLOBAL debug_dbug=@orig_debug; + disconnect con1; +connection default; +DROP TABLE t1; |