mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge 10.7 into 10.8
This commit is contained in:
36
mysql-test/suite/innodb/t/alter_table_upgrade.test
Normal file
36
mysql-test/suite/innodb/t/alter_table_upgrade.test
Normal file
@@ -0,0 +1,36 @@
|
||||
--source include/have_innodb.inc
|
||||
|
||||
let $datadir=`select @@datadir`;
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.4 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-29481 mariadb-upgrade prints confusing statement
|
||||
--echo #
|
||||
|
||||
CREATE TABLE pet4 (
|
||||
build_time double(18,7) DEFAULT NULL,
|
||||
KEY idx1 (build_time)) ENGINE=InnoDB;
|
||||
FLUSH TABLES;
|
||||
remove_file $datadir/test/pet4.frm;
|
||||
copy_file std_data/mysql_upgrade/mdev29481_100104_innodb.frm $datadir/test/pet4.frm;
|
||||
SHOW CREATE TABLE pet4;
|
||||
CHECK TABLE pet4 FOR UPGRADE;
|
||||
ALTER TABLE pet4 ADD i1 INTEGER, ALGORITHM=INSTANT;
|
||||
DROP TABLE pet4;
|
||||
|
||||
CREATE TABLE pet4 (
|
||||
build_time double(18,7) DEFAULT NULL,
|
||||
KEY idx1 (build_time)) ENGINE=InnoDB;
|
||||
FLUSH TABLES;
|
||||
remove_file $datadir/test/pet4.frm;
|
||||
copy_file std_data/mysql_upgrade/mdev29481_100104_innodb.frm $datadir/test/pet4.frm;
|
||||
SHOW CREATE TABLE pet4;
|
||||
ALTER TABLE pet4 ADD i1 INTEGER, ALGORITHM=NOCOPY;
|
||||
DROP TABLE pet4;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.4 tests
|
||||
--echo #
|
1
mysql-test/suite/innodb/t/deadlock_wait_lock_race.opt
Normal file
1
mysql-test/suite/innodb/t/deadlock_wait_lock_race.opt
Normal file
@@ -0,0 +1 @@
|
||||
--innodb-force-recovery=2
|
67
mysql-test/suite/innodb/t/deadlock_wait_lock_race.test
Normal file
67
mysql-test/suite/innodb/t/deadlock_wait_lock_race.test
Normal file
@@ -0,0 +1,67 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug_sync.inc
|
||||
--source include/count_sessions.inc
|
||||
|
||||
# Purge can cause deadlock in the test, requesting page's RW_X_LATCH for trx
|
||||
# ids reseting, after trx 2 acqured RW_S_LATCH and suspended in debug sync point
|
||||
# lock_trx_handle_wait_enter, waiting for upd_cont signal, which must be
|
||||
# emitted after the last SELECT in this test. The last SELECT will hang waiting
|
||||
# for purge RW_X_LATCH releasing, and trx 2 will be rolled back by timeout.
|
||||
|
||||
# There is deadlock_report_before_lock_releasing sync point in
|
||||
# Deadlock::report(), which is waiting for sel_cont signal under
|
||||
# lock_sys_t lock. The signal must be issued after "UPDATE t SET b = 100"
|
||||
# rollback, and that rollback is executing undo record, which is blocked on
|
||||
# dict_sys latch request. dict_sys is locked by the thread of statistics
|
||||
# update(dict_stats_save()), and during that update lock_sys lock is requested,
|
||||
# and can't be acquired as Deadlock::report() holds it. We have to disable
|
||||
# statistics update to make the test stable.
|
||||
|
||||
CREATE TABLE t (a int PRIMARY KEY, b int) engine = InnoDB STATS_PERSISTENT=0;
|
||||
CREATE TABLE t2 (a int PRIMARY KEY) engine = InnoDB STATS_PERSISTENT=0;
|
||||
|
||||
INSERT INTO t VALUES (10, 10), (20, 20), (30, 30);
|
||||
INSERT INTO t2 VALUES (10), (20), (30);
|
||||
|
||||
BEGIN; # trx 1
|
||||
# The following update is necessary to increase the transaction weight, which is
|
||||
# calculated as the number of locks + the number of undo records during deadlock
|
||||
# report. Victim's transaction should have minimum weight. We need trx 2 to be
|
||||
# choosen as victim, that's why we need to increase the current transaction
|
||||
# weight.
|
||||
UPDATE t2 SET a = a + 100;
|
||||
SELECT * FROM t WHERE a = 20 FOR UPDATE;
|
||||
|
||||
--connect(con_2,localhost,root,,)
|
||||
# RC is necessary to do semi-consistent read
|
||||
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
BEGIN; # trx 2
|
||||
# The first time it will be hit on trying to lock (20,20), the second hit
|
||||
# will be on (30,30).
|
||||
SET DEBUG_SYNC = 'lock_trx_handle_wait_before_unlocked_wait_lock_check SIGNAL upd_locked WAIT_FOR upd_cont';
|
||||
# We must not modify primary key fields to cause rr_sequential() read record
|
||||
# function choosing in mysql_update(), i.e. both query_plan.using_filesort and
|
||||
# query_plan.using_io_buffer must be false during init_read_record() call.
|
||||
--send UPDATE t SET b = 100
|
||||
|
||||
--connection default
|
||||
SET DEBUG_SYNC="now WAIT_FOR upd_locked";
|
||||
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL upd_cont";
|
||||
--send SELECT * FROM t WHERE a = 10 FOR UPDATE
|
||||
|
||||
--connection con_2
|
||||
# If the bug is not fixed, lock_trx_handle_wait() wrongly returns DB_SUCCESS
|
||||
# instead of DB_DEADLOCK, row_search_mvcc() of trx 2 behaves so as if (20,20)
|
||||
# was locked. Some debug assertion must crash the server. If the bug is fixed,
|
||||
# trx 2 must just be rolled back by deadlock detector.
|
||||
--error ER_LOCK_DEADLOCK
|
||||
--reap
|
||||
|
||||
--disconnect con_2
|
||||
|
||||
--connection default
|
||||
--reap
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
DROP TABLE t;
|
||||
DROP TABLE t2;
|
||||
--source include/wait_until_count_sessions.inc
|
1
mysql-test/suite/innodb/t/deadlock_wait_thr_race.opt
Normal file
1
mysql-test/suite/innodb/t/deadlock_wait_thr_race.opt
Normal file
@@ -0,0 +1 @@
|
||||
--innodb-force-recovery=2
|
71
mysql-test/suite/innodb/t/deadlock_wait_thr_race.test
Normal file
71
mysql-test/suite/innodb/t/deadlock_wait_thr_race.test
Normal file
@@ -0,0 +1,71 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug_sync.inc
|
||||
--source include/count_sessions.inc
|
||||
|
||||
# Purge can cause deadlock in the test, requesting page's RW_X_LATCH for trx
|
||||
# ids reseting, after trx 2 acqured RW_S_LATCH and suspended in debug sync point
|
||||
# lock_trx_handle_wait_enter, waiting for upd_cont signal, which must be
|
||||
# emitted after the last SELECT in this test. The last SELECT will hang waiting
|
||||
# for purge RW_X_LATCH releasing, and trx 2 will be rolled back by timeout.
|
||||
|
||||
# There is deadlock_report_before_lock_releasing sync point in
|
||||
# Deadlock::report(), which is waiting for sel_cont signal under
|
||||
# lock_sys_t lock. The signal must be issued after "UPDATE t SET b = 100"
|
||||
# rollback, and that rollback is executing undo record, which is blocked on
|
||||
# dict_sys latch request. dict_sys is locked by the thread of statistics
|
||||
# update(dict_stats_save()), and during that update lock_sys lock is requested,
|
||||
# and can't be acquired as Deadlock::report() holds it. We have to disable
|
||||
# statistics update to make the test stable.
|
||||
|
||||
CREATE TABLE t (a int PRIMARY KEY, b int) engine = InnoDB STATS_PERSISTENT=0;
|
||||
CREATE TABLE t2 (a int PRIMARY KEY) engine = InnoDB STATS_PERSISTENT=0;
|
||||
|
||||
INSERT INTO t VALUES (10, 10), (20, 20), (30, 30);
|
||||
INSERT INTO t2 VALUES (10), (20), (30);
|
||||
|
||||
BEGIN; # trx 1
|
||||
# The following update is necessary to increase the transaction weight, which is
|
||||
# calculated as the number of locks + the number of undo records during deadlock
|
||||
# report. Victim's transaction should have minimum weight. We need trx 2 to be
|
||||
# choosen as victim, that's why we need to increase the current transaction
|
||||
# weight.
|
||||
UPDATE t2 SET a = a + 100;
|
||||
SELECT * FROM t WHERE a = 20 FOR UPDATE;
|
||||
|
||||
--connect(con_2,localhost,root,,)
|
||||
# RC is necessary to do semi-consistent read
|
||||
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
# It will be hit on trying to lock (20,20).
|
||||
SET DEBUG_SYNC = 'lock_trx_handle_wait_enter SIGNAL upd_locked WAIT_FOR upd_cont';
|
||||
SET DEBUG_SYNC = 'trx_t_release_locks_enter SIGNAL sel_cont WAIT_FOR upd_cont_2';
|
||||
BEGIN; # trx 2
|
||||
# We must not modify primary key fields to cause rr_sequential() read record
|
||||
# function choosing in mysql_update(), i.e. both query_plan.using_filesort and
|
||||
# query_plan.using_io_buffer must be false during init_read_record() call.
|
||||
# The following UPDATE will be chosen as deadlock victim and rolled back.
|
||||
--send UPDATE t SET b = 100
|
||||
|
||||
--connection default
|
||||
SET DEBUG_SYNC="now WAIT_FOR upd_locked";
|
||||
SET DEBUG_SYNC="deadlock_report_before_lock_releasing SIGNAL upd_cont WAIT_FOR sel_cont";
|
||||
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL sel_before_suspend";
|
||||
# If the bug is not fixed, the following SELECT will crash, as the above UPDATE
|
||||
# will reset trx->lock.wait_thr during rollback
|
||||
--send SELECT * FROM t WHERE a = 10 FOR UPDATE;
|
||||
|
||||
--connect(con_3,localhost,root,,)
|
||||
SET DEBUG_SYNC="now WAIT_FOR sel_before_suspend";
|
||||
SET DEBUG_SYNC="now SIGNAL upd_cont_2";
|
||||
--disconnect con_3
|
||||
|
||||
--connection con_2
|
||||
--error ER_LOCK_DEADLOCK
|
||||
--reap
|
||||
--disconnect con_2
|
||||
|
||||
--connection default
|
||||
--reap
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
DROP TABLE t;
|
||||
DROP TABLE t2;
|
||||
--source include/wait_until_count_sessions.inc
|
@@ -195,6 +195,19 @@ INSERT INTO t VALUES (0);
|
||||
INSERT INTO t VALUES (1),(0),(1);
|
||||
DROP TABLE t;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-28327 InnoDB persistent statistics fail to update
|
||||
--echo # after bulk insert
|
||||
--echo #
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY)ENGINE=InnoDB;
|
||||
INSERT INTO t1 SELECT * FROM seq_1_to_4096;
|
||||
--echo # Wait till statistics update after bulk insert operation
|
||||
let $wait_condition= select n_rows > 100 from mysql.innodb_table_stats
|
||||
where table_name="t1";
|
||||
source include/wait_condition.inc;
|
||||
SELECT n_rows FROM mysql.innodb_table_stats WHERE TABLE_NAME="t1";
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-26947 UNIQUE column checks fail in InnoDB resulting
|
||||
--echo # in table corruption
|
||||
@@ -327,3 +340,38 @@ CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB
|
||||
INSERT INTO t1 VALUES (1),(21);
|
||||
# Cleanup
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-29761 Bulk insert fails to rollback
|
||||
--echo # during insert..select
|
||||
--echo #
|
||||
CREATE TABLE t1 (f1 INT)ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (f1 INT, UNIQUE INDEX(f1)) ENGINE=InnoDB;
|
||||
CREATE TRIGGER tr AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(1);
|
||||
BEGIN;
|
||||
INSERT t1 SELECT 1 FROM seq_1_to_2;
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
CHECK TABLE t1;
|
||||
CHECK TABLE t2;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-29801 Inconsistent ER_TOO_BIG_ROWSIZE during bulk
|
||||
--echo # insert operation
|
||||
--echo #
|
||||
call mtr.add_suppression("InnoDB: Cannot add field `c11` in table");
|
||||
|
||||
SET @format= @@innodb_default_row_format;
|
||||
CREATE TABLE t1 (pk int primary key, c01 text, c02 text, c03 text,
|
||||
c04 text, c05 text, c06 text, c07 text, c08 text,
|
||||
c09 text, c10 text, c11 text, c12 text) ENGINE=InnoDB;
|
||||
SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= COMPACT;
|
||||
ALTER TABLE t1 FORCE;
|
||||
INSERT IGNORE INTO t1 VALUES
|
||||
(1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)),
|
||||
(2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107));
|
||||
CHECK TABLE t1;
|
||||
DROP TABLE t1;
|
||||
SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= @format;
|
||||
|
76
mysql-test/suite/innodb/t/lock_update_split_rc.test
Normal file
76
mysql-test/suite/innodb/t/lock_update_split_rc.test
Normal file
@@ -0,0 +1,76 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/count_sessions.inc
|
||||
|
||||
CREATE TABLE t (
|
||||
`a` INT NOT NULL,
|
||||
`b` INT NOT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--disable_query_log
|
||||
SET @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug;
|
||||
--enable_query_log
|
||||
|
||||
SET GLOBAL innodb_limit_optimistic_insert_debug = 3;
|
||||
|
||||
INSERT INTO t VALUES(10, 0);
|
||||
INSERT INTO t VALUES(20, 0);
|
||||
INSERT INTO t VALUES(30, 0);
|
||||
|
||||
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
XA START '1';
|
||||
REPLACE INTO t VALUES(10, 1);
|
||||
REPLACE INTO t VALUES(20, 1);
|
||||
|
||||
# We need the following sync point because mysql_insert() resets
|
||||
# trx->duplicates with the following condition:
|
||||
#
|
||||
# if (duplic == DUP_REPLACE &&
|
||||
# (!table->triggers || !table->triggers->has_delete_triggers()))
|
||||
# table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
|
||||
#
|
||||
# and ha_innobase::extra() resets trx_t::duplicates, but we need
|
||||
# lock_update_split_right() to be invoked when trx->duplicates is set to
|
||||
# repeat the bug. So the transaction will hang just after
|
||||
# row_insert_for_mysql() call until another transaction inserts new row and
|
||||
# splits the page.
|
||||
SET DEBUG_SYNC= 'ib_after_row_insert SIGNAL inserted WAIT_FOR cont';
|
||||
--send REPLACE INTO t VALUES(30, 1)
|
||||
|
||||
connect (con1,localhost,root);
|
||||
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
XA START '2';
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR inserted';
|
||||
# The following statement will cause page split and (20, ...) will be split
|
||||
# record. As the previous REPLACE set non-gap X-lock on it,
|
||||
# lock_update_split_right() and lock_rec_inherit_to_gap() will 'inherit' the
|
||||
# lock from the very first (20, ...) new right page record to the supremum of
|
||||
# the old left page, what should not be for READ COMMITTED isolation level
|
||||
INSERT INTO t VALUES(40, 2);
|
||||
SET DEBUG_SYNC= 'now SIGNAL cont';
|
||||
|
||||
--connection default
|
||||
--reap
|
||||
XA END '1';
|
||||
# This will cause the assertion failure, because the supremum of the left page
|
||||
# has X-lock.
|
||||
XA PREPARE '1';
|
||||
--connection default
|
||||
XA COMMIT '1';
|
||||
|
||||
--connection con1
|
||||
XA END '2';
|
||||
XA PREPARE '2';
|
||||
XA COMMIT '2';
|
||||
--disconnect con1
|
||||
|
||||
--connection default
|
||||
SET DEBUG_SYNC= "RESET";
|
||||
DROP TABLE t;
|
||||
|
||||
--disable_query_log
|
||||
SET GLOBAL innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug;
|
||||
--enable_query_log
|
||||
|
||||
--source include/wait_until_count_sessions.inc
|
@@ -613,3 +613,15 @@ INSERT INTO t VALUES (1);
|
||||
START TRANSACTION READ ONLY;
|
||||
UPDATE t SET a = NULL;
|
||||
ROLLBACK;
|
||||
DROP TABLE t;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-29886 Assertion !index->table->is_temporary() failed
|
||||
--echo # in trx_undo_prev_version_build upon CHECK
|
||||
--echo #
|
||||
CREATE TEMPORARY TABLE t (a INT, KEY(a)) ENGINE=InnoDB SELECT 1;
|
||||
UPDATE t SET a=2;
|
||||
CHECK TABLE t;
|
||||
CHECK TABLE t EXTENDED;
|
||||
DROP TEMPORARY TABLE t;
|
||||
--echo # End of 10.6 tests
|
||||
|
@@ -57,19 +57,11 @@ syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n";
|
||||
close(FILE) || die "Unable to close $file";
|
||||
EOF
|
||||
|
||||
# Debug assertions would fail due to the injected corruption.
|
||||
--let $restart_parameters= --loose-skip-debug-assert
|
||||
--source include/start_mysqld.inc
|
||||
|
||||
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
|
||||
let SEARCH_PATTERN= \[Warning\] InnoDB: A transaction id in a record of table `test`\.`t1` is newer than the system-wide maximum;
|
||||
--source include/search_pattern_in_file.inc
|
||||
|
||||
call mtr.add_suppression("\\[Warning\\] InnoDB: A transaction id in a record of table `test`\\.`t1` is newer than the system-wide maximum");
|
||||
call mtr.add_suppression("\\[ERROR\\] InnoDB: We detected index corruption");
|
||||
call mtr.add_suppression("Index for table 't1' is corrupt; try to repair it");
|
||||
|
||||
# A debug assertion would cause a duplicated message to be output.
|
||||
SET @save_count = @@max_error_count;
|
||||
SET max_error_count = 1;
|
||||
--error ER_NOT_KEYFILE
|
||||
SELECT * FROM t1;
|
||||
SET max_error_count = @save_count;
|
||||
DROP TABLE t1;
|
||||
|
Reference in New Issue
Block a user