mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge 10.8 into 10.9
This commit is contained in:
@@ -3,8 +3,11 @@
|
||||
source include/have_debug.inc;
|
||||
source include/have_debug_sync.inc;
|
||||
|
||||
SET @save_freq=@@GLOBAL.innodb_purge_rseg_truncate_frequency;
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
|
||||
CREATE TABLE t (a int PRIMARY KEY, b int NOT NULL UNIQUE) engine = InnoDB;
|
||||
|
||||
--source include/wait_all_purged.inc
|
||||
--connect(prevent_purge,localhost,root,,)
|
||||
start transaction with consistent snapshot;
|
||||
|
||||
@@ -80,4 +83,5 @@ INSERT INTO t VALUES(30, 20);
|
||||
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
DROP TABLE t;
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_freq;
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
@@ -14,6 +14,7 @@ SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
|
||||
|
||||
CREATE TABLE t1(a INT PRIMARY KEY, b INT NOT NULL)
|
||||
ROW_FORMAT=REDUNDANT ENGINE=InnoDB;
|
||||
--source include/wait_all_purged.inc
|
||||
|
||||
--connect (prevent_purge,localhost,root)
|
||||
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
||||
@@ -33,7 +34,12 @@ UPDATE t1 SET b=4 WHERE a=3;
|
||||
# Initiate a full purge, which should reset the DB_TRX_ID except for a=3.
|
||||
--source include/wait_all_purged.inc
|
||||
# Initiate a ROLLBACK of the update, which should reset the DB_TRX_ID for a=3.
|
||||
--connection con1
|
||||
ROLLBACK;
|
||||
--disconnect con1
|
||||
--connection default
|
||||
# Reset the DB_TRX_ID for the hidden ADD COLUMN metadata record.
|
||||
--source include/wait_all_purged.inc
|
||||
|
||||
FLUSH TABLE t1 FOR EXPORT;
|
||||
# The following is based on innodb.table_flags:
|
||||
|
@@ -9,6 +9,7 @@ CREATE TABLE t1(id INT PRIMARY key, val VARCHAR(16000)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 (id,val) SELECT 2*seq,'x' FROM seq_0_to_1023;
|
||||
|
||||
connect(con1,localhost,root,,);
|
||||
source include/wait_all_purged.inc;
|
||||
# Prevent purge.
|
||||
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
||||
connection default;
|
||||
|
@@ -13,12 +13,10 @@ DELIMITER ~~;
|
||||
CREATE PROCEDURE insert_n(start int, end int)
|
||||
BEGIN
|
||||
DECLARE i INT DEFAULT start;
|
||||
START TRANSACTION;
|
||||
WHILE i <= end do
|
||||
INSERT INTO t1 VALUES (1, 2, 3) ON DUPLICATE KEY UPDATE c = i;
|
||||
SET i = i + 1;
|
||||
END WHILE;
|
||||
COMMIT;
|
||||
END~~
|
||||
|
||||
CREATE FUNCTION num_pages_get()
|
||||
@@ -37,6 +35,7 @@ DELIMITER ;~~
|
||||
--echo #
|
||||
CREATE TABLE t1 (a INT, b INT, c INT, PRIMARY KEY(a,b), KEY (b,c))
|
||||
ENGINE=InnoDB STATS_PERSISTENT=0;
|
||||
--source include/wait_all_purged.inc
|
||||
BEGIN;
|
||||
SELECT * FROM t1;
|
||||
|
||||
@@ -45,18 +44,22 @@ SELECT * FROM t1;
|
||||
--echo #
|
||||
connect (con2, localhost, root,,);
|
||||
connection con2;
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (1, 2, 3) ON DUPLICATE KEY UPDATE c = NULL;
|
||||
--send CALL insert_n(1, 50);
|
||||
|
||||
connect (con3, localhost, root,,);
|
||||
connection con3;
|
||||
BEGIN;
|
||||
--send CALL insert_n(51, 100);
|
||||
|
||||
connection con2;
|
||||
reap;
|
||||
COMMIT;
|
||||
connection con3;
|
||||
reap;
|
||||
INSERT INTO t1 VALUES (1, 2, 1) ON DUPLICATE KEY UPDATE c = NULL;
|
||||
COMMIT;
|
||||
|
||||
connection default;
|
||||
|
||||
@@ -64,7 +67,7 @@ connection default;
|
||||
--echo # Connect to default and record how many pages were accessed
|
||||
--echo # when selecting the record using the secondary key.
|
||||
--echo #
|
||||
--let $wait_all_purged=4
|
||||
--let $wait_all_purged=2
|
||||
--source include/wait_all_purged.inc
|
||||
SET @num_pages_1 = num_pages_get();
|
||||
SELECT * FROM t1 force index (b);
|
||||
|
58
mysql-test/suite/innodb/t/lock_move_wait_lock_race.test
Normal file
58
mysql-test/suite/innodb/t/lock_move_wait_lock_race.test
Normal file
@@ -0,0 +1,58 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/count_sessions.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/have_debug_sync.inc
|
||||
|
||||
CREATE TABLE t (pk int PRIMARY KEY, c varchar(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t VALUES (10, "0123456789");
|
||||
|
||||
--connection default
|
||||
BEGIN;
|
||||
SELECT * FROM t WHERE c = 10 FOR UPDATE;
|
||||
|
||||
--connect(trx2, localhost,root,,)
|
||||
BEGIN;
|
||||
SET DEBUG_SYNC="lock_wait_start SIGNAL trx2_start_waiting";
|
||||
SET DEBUG_SYNC="lock_wait_end SIGNAL trx2_wait_end WAIT_FOR trx2_cont_upd";
|
||||
SET DEBUG_SYNC="lock_rec_store_on_page_infimum_end SIGNAL trx2_moved_locks WAIT_FOR trx2_cont";
|
||||
#################
|
||||
# We need to update clustered record without changing ordering fields and
|
||||
# changing the size of non-ordering fields to cause locks moving from deleted
|
||||
# record to infimum.
|
||||
###
|
||||
--send UPDATE t SET c = NULL WHERE pk = 10
|
||||
|
||||
|
||||
--connect(trx3, localhost,root,,)
|
||||
SET DEBUG_SYNC="now WAIT_FOR trx2_start_waiting";
|
||||
#################
|
||||
# The condition wariable waiting in lock_wait() must be finished by timeout
|
||||
###
|
||||
SET innodb_lock_wait_timeout=1;
|
||||
BEGIN;
|
||||
SET DEBUG_SYNC="lock_wait_start SIGNAL trx3_start_waiting WAIT_FOR trx3_cont_waiting";
|
||||
SET DEBUG_SYNC="lock_sys_t_cancel_enter SIGNAL trx3_cancel_enter WAIT_FOR trx3_cont_cancel_waiting";
|
||||
--send UPDATE t SET c = "abcdefghij" WHERE pk = 10
|
||||
|
||||
--connection default
|
||||
SET DEBUG_SYNC="now WAIT_FOR trx3_start_waiting";
|
||||
COMMIT;
|
||||
SET DEBUG_SYNC="now WAIT_FOR trx2_wait_end";
|
||||
SET DEBUG_SYNC="now SIGNAL trx3_cont_waiting";
|
||||
SET DEBUG_SYNC="now WAIT_FOR trx3_cancel_enter";
|
||||
SET DEBUG_SYNC="now SIGNAL trx2_cont_upd";
|
||||
SET DEBUG_SYNC="now WAIT_FOR trx2_moved_locks";
|
||||
#################
|
||||
# If the bug is not fixed, there will be assertion failure here, because trx2
|
||||
# moved trx3 lock from deleted record to infimum when trx3 tried to cancel the
|
||||
# lock.
|
||||
###
|
||||
SET DEBUG_SYNC="now SIGNAL trx3_cont_cancel_waiting";
|
||||
SET DEBUG_SYNC="now SIGNAL trx2_cont";
|
||||
|
||||
--disconnect trx2
|
||||
--disconnect trx3
|
||||
--connection default
|
||||
SET DEBUG_SYNC="RESET";
|
||||
DROP TABLE t;
|
||||
--source include/wait_until_count_sessions.inc
|
Reference in New Issue
Block a user