Commit 13dd7875 authored by Yuchen Pei's avatar Yuchen Pei

Merge branch '10.4' into 10.5

parents ddd5449c 66fafdb9
#
# Include this file in your .test file if your testcase uses InnoDB tables
# requiring stable query plans, which likely requires that InnoDB produces
# stable estimates for #records in tables.
#
# How it works:
# Unstable InnoDB estimates are caused by InnoDB's background statistics
# collection. When you include this file, MTR will use server options from
# include/innodb_stable_estimates.opt, which disables background statistics
# collection.
# (and no, InnoDB team objects to using this configuration for all MTR tests)
#
......@@ -330,6 +330,113 @@ JOIN t1 ON dt.a=t1.b;
a
Australia
DROP TABLES t1, t2;
#
# MDEV-15656: Assertion `is_last_prefix <= 0' failed in
# QUICK_GROUP_MIN_MAX_SELECT::get_next
#
SET @lru_depth.save= @@innodb_lru_scan_depth;
SET GLOBAL innodb_lru_scan_depth= 1024;
CREATE TABLE t1 (
pk_part1 INT AUTO_INCREMENT,
a VARCHAR(4),
row_start timestamp(6) default current_timestamp,
PRIMARY KEY (pk_part1, row_start)
) ENGINE=InnoDB;
INSERT INTO t1 (a) VALUES
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo');
connect con1,localhost,root,,test;
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
disconnect con1;
connection default;
DROP TABLE t1;
SET GLOBAL innodb_lru_scan_depth= @lru_depth.save;
set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages=
@innodb_stats_persistent_sample_pages_save;
......@@ -273,6 +273,53 @@ eval $query;
DROP TABLES t1, t2;
--echo #
--echo # MDEV-15656: Assertion `is_last_prefix <= 0' failed in
--echo # QUICK_GROUP_MIN_MAX_SELECT::get_next
--echo #
SET @lru_depth.save= @@innodb_lru_scan_depth;
SET GLOBAL innodb_lru_scan_depth= 1024;
CREATE TABLE t1 (
pk_part1 INT AUTO_INCREMENT,
a VARCHAR(4),
row_start timestamp(6) default current_timestamp,
PRIMARY KEY (pk_part1, row_start)
) ENGINE=InnoDB;
INSERT INTO t1 (a) VALUES
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo');
--connect (con1,localhost,root,,test)
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
--let $run= 20
--disable_result_log
while ($run)
{
--send
SELECT DISTINCT pk_part1 FROM t1;
--connection default
INSERT INTO t1 (pk_part1) VALUES (NULL);
--connection con1
--reap
--dec $run
}
--enable_result_log
--disconnect con1
--connection default
DROP TABLE t1;
SET GLOBAL innodb_lru_scan_depth= @lru_depth.save;
set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages=
@innodb_stats_persistent_sample_pages_save;
--- ./main/innodb_ext_key.result
+++ ./main/innodb_ext_key.reject
@@ -244,7 +244,7 @@
Variable_name Value
Handler_read_first 0
Handler_read_key 21
-Handler_read_last 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_retry 0
@@ -266,7 +266,7 @@
Variable_name Value
Handler_read_first 0
Handler_read_key 6
-Handler_read_last 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_retry 0
--- ./main/innodb_ext_key.result
+++ ./main/innodb_ext_key.reject
@@ -244,7 +244,7 @@
Variable_name Value
Handler_read_first 0
Handler_read_key 21
-Handler_read_last 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_retry 0
@@ -266,7 +266,7 @@
Variable_name Value
Handler_read_first 0
Handler_read_key 6
-Handler_read_last 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_retry 0
......@@ -22,7 +22,9 @@ rmdir $ddir;
# MDEV-23052
# 1. mysql_install_db works on existing, empty directory
mkdir $ddir;
exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --password=foo -R > /dev/null;
disable_result_log;
exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --password=foo -R --verbose-bootstrap;
enable_result_log;
rmdir $ddir;
# 2. mysql_install_db rejects existing, non-empty directory, and does not
......
......@@ -65,4 +65,13 @@ SET GLOBAL gtid_slave_pos='0-2-1003';
-- CHANGE MASTER TO MASTER_LOG_FILE='slave-bin.000001', MASTER_LOG_POS=BINLOG_START;
CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
SET GLOBAL gtid_slave_pos='0-2-1003';
connection master;
CREATE TABLE t (
id int
);
insert into t values (1);
insert into t values (2);
drop table t;
-- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000002', MASTER_LOG_POS=BINLOG_START;
-- SET GLOBAL gtid_slave_pos='0-1-1005';
include/rpl_end.inc
......@@ -83,6 +83,46 @@ DROP TABLE t2;
--replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/
--exec $MYSQL_DUMP_SLAVE --compact --master-data --single-transaction --gtid test
#
# MDEV-32611 Added test for mysqldump --delete-master-logs option.
# This options is alias of
# get binlogs: show master status -> flush logs -> purge binary logs to <new_binlog>
# sequence and this test is derived using the same pattern.
#
connection master;
CREATE TABLE t (
id int
);
insert into t values (1);
insert into t values (2);
drop table t;
--let $predump_binlog_filename= query_get_value(SHOW MASTER STATUS, File, 1)
# Execute mysqldump with delete-master-logs option
--replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/
--exec $MYSQL_DUMP --compact --no-create-info --no-data --delete-master-logs test
--let $postdump_binlog_filename= query_get_value(SHOW MASTER STATUS, File, 1)
--let $postdump_first_binary_log_filename= query_get_value(SHOW BINARY LOGS, Log_name, 1)
if ($predump_binlog_filename == $postdump_binlog_filename)
{
--echo # predump_binlog_filename: $predump_binlog_filename
--echo # postdump_binlog_filename: $postdump_binlog_filename
--die Master state didn't change after mariadb-dump with --delete-master-logs.
}
if ($postdump_first_binary_log_filename != $postdump_binlog_filename)
{
--echo # postdump_first_binary_log_filename: $postdump_first_binary_log_filename
--echo # postdump_binlog_filename: $postdump_binlog_filename
--die Master binlog wasn't deleted after mariadb-dump with --delete-master-logs.
}
--source include/rpl_end.inc
--source include/have_log_bin.inc
--source include/have_binlog_format_row.inc
--source include/have_innodb.inc
--echo #
......@@ -101,7 +101,7 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_BINLOG -vv $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_original_1.sql
--exec $MYSQL_BINLOG -B -vv $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_1.sql
--exec $MYSQL -e "SET binlog_format= ROW; source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_1.sql;"
--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_1.sql;"
SELECT * FROM t1;
......@@ -126,7 +126,7 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_BINLOG -vv $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_original_2.sql
--exec $MYSQL_BINLOG -B -vv $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_2.sql
--exec $MYSQL -e "SET binlog_format= ROW; source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_2.sql;"
--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_2.sql;"
SELECT * FROM t1;
......@@ -160,7 +160,7 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_BINLOG -vv $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_original_3.sql
--exec $MYSQL_BINLOG -B -vv $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_3.sql
--exec $MYSQL -e "SET binlog_format= ROW; source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_3.sql;"
--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_3.sql;"
SELECT * FROM t1;
......@@ -202,7 +202,7 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_BINLOG -vv $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_original_4.sql
--exec $MYSQL_BINLOG -B $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_4.sql
--exec $MYSQL -e "SET binlog_format= ROW; source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_4.sql;"
--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_4.sql;"
SELECT * FROM t1;
SELECT * FROM t2;
......@@ -247,7 +247,7 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_BINLOG -vv $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_original_5.sql
--exec $MYSQL_BINLOG -B $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_5.sql
--exec $MYSQL -e "SET binlog_format= ROW; source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_5.sql;"
--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_5.sql;"
SELECT * FROM t1;
......@@ -323,7 +323,7 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_BINLOG --database=world --table=city -vv $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_original_6.sql
--exec $MYSQL_BINLOG --database=world --table=city -B $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_6.sql
--exec $MYSQL -e "SET binlog_format= ROW; source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_6.sql;"
--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_6.sql;"
SELECT * FROM world.city;
......@@ -355,7 +355,7 @@ FLUSH LOGS;
--source include/assert.inc
--exec $MYSQL_BINLOG -vv -B --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002> $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_7.sql
--exec $MYSQL -e "SET binlog_format= ROW; source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_7.sql;"
--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_7.sql;"
--echo # 6- Rows must be present upon restoring from flashback
--let $assert_cond= COUNT(*) = 6 FROM t1
......
......@@ -20,6 +20,8 @@ versioning_trx_id : MDEV-18590 : galera.versioning_trx_id: Test failure: mysqlte
galera_concurrent_ctas : MDEV-32779 galera_concurrent_ctas: assertion in the galera::ReplicatorSMM::finish_cert()
galera_as_slave_replay : MDEV-32780 galera_as_slave_replay: assertion in the wsrep::transaction::before_rollback()
galera_slave_replay : MDEV-32780 galera_as_slave_replay: assertion in the wsrep::transaction::before_rollback()
galera_bf_lock_wait : MDEV-32781 galera_bf_lock_wait test failed
galera_sst_mysqldump_with_key : MDEV-32782 galera_sst_mysqldump_with_key test failed
mdev-31285 : MDEV-25089 Assertion `error.len > 0' failed in galera::ReplicatorSMM::handle_apply_error()
galera_var_ignore_apply_errors : MENT-1997 galera_var_ignore_apply_errors test freezes
MW-402 : temporarily disabled at the request of Codership
MDEV-22232 : temporarily disabled at the request of Codership
connection node_2;
connection node_1;
connect con1,127.0.0.1,root,,test,$NODE_MYPORT_1;
call mtr.add_suppression("WSREP: ALTER TABLE isolation failure");
CREATE TABLE t1(c1 INT PRIMARY KEY, c2 INT) ENGINE=InnoDB;
SET DEBUG_SYNC = 'wsrep_append_fk_toi_keys_before_close_tables SIGNAL may_alter WAIT_FOR bf_abort';
ALTER TABLE t1 DROP COLUMN c2;
connection node_1;
SET DEBUG_SYNC = 'now WAIT_FOR may_alter';
ALTER TABLE t1 ADD COLUMN c3 INT;
connection con1;
ERROR 70100: Query execution was interrupted
INSERT INTO t1 (c1, c2, c3) VALUES (1, 0, 0);
connection node_2;
INSERT INTO t1 (c1, c2, c3) VALUES (2, 0, 0);
connection node_1;
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;
disconnect con1;
disconnect node_2;
disconnect node_1;
......@@ -33,6 +33,26 @@ SET SESSION wsrep_sync_wait=0;
call p1(1000);
connection node_1;
checking error log for 'BF lock wait long' message for 10 times every 10 seconds ...
include/assert_grep.inc [BF lock wait long]
include/assert_grep.inc [BF lock wait long]
include/assert_grep.inc [BF lock wait long]
include/assert_grep.inc [BF lock wait long]
include/assert_grep.inc [BF lock wait long]
include/assert_grep.inc [BF lock wait long]
include/assert_grep.inc [BF lock wait long]
include/assert_grep.inc [BF lock wait long]
include/assert_grep.inc [BF lock wait long]
include/assert_grep.inc [BF lock wait long]
include/assert_grep.inc [BF lock wait long]
include/assert_grep.inc [BF lock wait long]
include/assert_grep.inc [BF lock wait long]
include/assert_grep.inc [BF lock wait long]
include/assert_grep.inc [BF lock wait long]
include/assert_grep.inc [BF lock wait long]
include/assert_grep.inc [BF lock wait long]
include/assert_grep.inc [BF lock wait long]
include/assert_grep.inc [BF lock wait long]
include/assert_grep.inc [BF lock wait long]
connection node_1_p1;
connection node_1_p2;
connection node_2_p1;
......
connection node_2;
connection node_1;
connection node_1;
connection node_2;
CREATE TABLE t1 (f1 INT PRIMARY KEY);
connection node_2;
# Verify that graceful shutdown succeeds...
connection node_1;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3);
connection node_2;
# Start node_2 again...
SELECT * FROM t1;
f1
1
2
3
connection node_1;
include/assert_grep.inc [mariabackup IST completed on joiner]
DROP TABLE t1;
connection node_2;
connection node_1;
connection node_1;
connection node_2;
CREATE TABLE t1 (f1 INT PRIMARY KEY);
connection node_2;
# Verify that graceful shutdown succeeds...
connection node_1;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3);
connection node_2;
# Start node_2 again...
SELECT * FROM t1;
f1
1
2
3
connection node_1;
include/assert_grep.inc [rsync IST completed on joiner]
DROP TABLE t1;
#
# MDEV-32938: ALTER command is replicated and successfully applied while being BF-aborted locally.
#
# Why it happend:
# - ALTER went to prepare FK-referenced tables as TOI keys
# - to do this, it would open the main table with SHARED_HIGH_PRIO MDL lock which disregarded any
# other locks (including X-lock) waiting in the queue in case someone was already holding a
# compatible lock type (like any DML operation)
# - if there was other TOI operation on the same table, it would go through BF-abort cycle to grab
# the lock for itself
# - since the initial ALTER had not reached TOI yet, it would loose to real TOI operation and got
# BF-aborted with its THD marked as killed
# - then, ALTER would enter TOI and get replicated with no checks that it has already been aborted
# - after entering TOI mode, it would later find it'd been killed, and complete with an error
# - at the same time, the command would successfully apply on every other node except the initiator.
#
# Fixed by checking killed state on THD before entering TOI.
#
--source include/galera_cluster.inc
--source include/have_debug_sync.inc
--source include/have_debug.inc
--connect con1,127.0.0.1,root,,test,$NODE_MYPORT_1
call mtr.add_suppression("WSREP: ALTER TABLE isolation failure");
CREATE TABLE t1(c1 INT PRIMARY KEY, c2 INT) ENGINE=InnoDB;
# Run ALTER DROP COLUMN and hang before closing tables on adding FK keys and before entering TOI.
# Wait until it gets BF-aborted.
SET DEBUG_SYNC = 'wsrep_append_fk_toi_keys_before_close_tables SIGNAL may_alter WAIT_FOR bf_abort';
--send
ALTER TABLE t1 DROP COLUMN c2;
--connection node_1
# Run ALTER ADD COLUMN and BF-abort the previous ALTER DROP COLUMN.
SET DEBUG_SYNC = 'now WAIT_FOR may_alter';
ALTER TABLE t1 ADD COLUMN c3 INT;
--connection con1
# ALTER DROP COLUMN gets BF aborted.
--error ER_QUERY_INTERRUPTED
--reap
INSERT INTO t1 (c1, c2, c3) VALUES (1, 0, 0);
--connection node_2
# ALTER DROP COLUMN must not be replicated.
INSERT INTO t1 (c1, c2, c3) VALUES (2, 0, 0);
# Cleanup.
--connection node_1
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;
--disconnect con1
--source include/galera_end.inc
......@@ -52,6 +52,12 @@ let $counter=10;
let $sleep_period=10;
echo checking error log for 'BF lock wait long' message for $counter times every $sleep_period seconds ...;
--let assert_text= BF lock wait long
--let assert_select= BF lock wait long
--let assert_count= 0
--let assert_only_after= CURRENT_TEST: galera.galera_bf_lock_wait
while($counter > 0)
{
--disable_query_log
......@@ -60,9 +66,11 @@ while($counter > 0)
--enable_query_log
--enable_result_log
# use error 0,1 instead if want test to continue
--error 1
exec grep 'BF lock wait long' $MYSQLTEST_VARDIR/log/mysqld.*.err;
--let assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
--source include/assert_grep.inc
--let assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err
--source include/assert_grep.inc
dec $counter;
}
......
!include ../galera_2nodes.cnf
[mysqld]
wsrep_sst_method=mariabackup
wsrep_sst_auth=root:
ssl-cert=@ENV.MYSQL_TEST_DIR/std_data/server-cert.pem
ssl-key=@ENV.MYSQL_TEST_DIR/std_data/server-key.pem
ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem
[mysqld.1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true'
[mysqld.2]
wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true'
[sst]
ssl-mode=VERIFY_CA
transferfmt=@ENV.MTR_GALERA_TFMT
streamfmt=mbstream
--source include/big_test.inc
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_mariabackup.inc
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
--let $LOG_FILE=$MYSQL_TMP_DIR/galera_node2.log
--error 0,1
--remove_file $LOG_FILE
CREATE TABLE t1 (f1 INT PRIMARY KEY);
--connection node_2
--echo # Verify that graceful shutdown succeeds...
--source include/shutdown_mysqld.inc
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3);
--connection node_2
--echo # Start node_2 again...
--let $restart_noprint=2
--let $start_mysqld_params=--log-error=$LOG_FILE
--source include/start_mysqld.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
SELECT * FROM t1;
--let $start_mysqld_params=
--source include/restart_mysqld.inc
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
# Confirm that IST took place
--let $assert_text = mariabackup IST completed on joiner
--let $assert_select = mariabackup IST completed on joiner
--let $assert_count = 1
--let $assert_file = $LOG_FILE
--let $assert_only_after = Prepared IST receiver for
--source include/assert_grep.inc
DROP TABLE t1;
--source include/auto_increment_offset_restore.inc
--remove_file $LOG_FILE
!include ../galera_2nodes.cnf
[mysqld]
wsrep_sst_method=rsync
ssl-cert=@ENV.MYSQL_TEST_DIR/std_data/server-cert.pem
ssl-key=@ENV.MYSQL_TEST_DIR/std_data/server-key.pem
ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem
[mysqld.1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true'
[mysqld.2]
wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true'
[sst]
ssl-mode=VERIFY_CA
--source include/big_test.inc
--source include/galera_cluster.inc
--source include/have_innodb.inc
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
--let $LOG_FILE=$MYSQL_TMP_DIR/galera_node2.log
--error 0,1
--remove_file $LOG_FILE
CREATE TABLE t1 (f1 INT PRIMARY KEY);
--connection node_2
--echo # Verify that graceful shutdown succeeds...
--source include/shutdown_mysqld.inc
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3);
--connection node_2
--echo # Start node_2 again...
--let $restart_noprint=2
--let $start_mysqld_params=--log-error=$LOG_FILE
--source include/start_mysqld.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
SELECT * FROM t1;
--let $start_mysqld_params=
--source include/restart_mysqld.inc
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
# Confirm that IST took place
--let $assert_text = rsync IST completed on joiner
--let $assert_select = rsync IST completed on joiner
--let $assert_count = 1
--let $assert_file = $LOG_FILE
--let $assert_only_after = Prepared IST receiver for
--source include/assert_grep.inc
DROP TABLE t1;
--source include/auto_increment_offset_restore.inc
--remove_file $LOG_FILE
......@@ -14,3 +14,6 @@ galera_2_cluster : MDEV-32631 galera_2_cluster: before_rollback(): Assertion `0'
galera_gtid_2_cluster : MDEV-32633 galera_gtid_2_cluster: Assertion `thd->wsrep_next_trx_id() != (0x7fffffffffffffffLL * 2ULL + 1)'
galera_vote_rejoin_mysqldump : MDEV-24481: galera_3nodes.galera_vote_rejoin_mysqldump MTR failed: mysql_shutdown failed
galera_ssl_reload : MDEV-32778 galera_ssl_reload failed with warning message
galera_ipv6_mariabackup : temporarily disabled at the request of Codership
galera_pc_bootstrap : temporarily disabled at the request of Codership
galera_ipv6_mariabackup_section : temporarily disabled at the request of Codership
......@@ -654,3 +654,34 @@ t2 CREATE TABLE `t2` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table t2;
drop table t1;
#
# MDEV-29092 FOREIGN_KEY_CHECKS does not prevent non-copy
# alter from creating invalid FK structures
#
CREATE TABLE t1(f1 INT, KEY(f1),
FOREIGN KEY(f1) references t1(f1))ENGINE=InnoDB;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
KEY `f1` (`f1`),
CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1;
CREATE TABLE t1(f1 INT, KEY(f1),
FOREIGN KEY(f1) REFERENCES t1(f1))ENGINE=InnoDB;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
KEY `f1` (`f1`),
CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
ALTER TABLE t1 DROP KEY f1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1;
......@@ -86,8 +86,7 @@ CREATE TABLE t2 (f2 INT, FOREIGN KEY(f2) REFERENCES t1 (f2)) ENGINE=InnoDB;
CREATE TABLE t3 (a INT) ENGINE=InnoDB;
ERROR HY000: Can't create table `test`.`t3` (errno: 150 "Foreign key constraint is incorrectly formed")
ALTER TABLE t1 RENAME TO t3;
ERROR HY000: Error on rename of './test/t1' to './test/t3' (errno: 150 "Foreign key constraint is incorrectly formed")
ALTER TABLE t1 FORCE;
TRUNCATE TABLE t1;
ALTER TABLE t3 FORCE;
TRUNCATE TABLE t3;
ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `test`.`t3` (`f2`))
DROP TABLE t2, t1;
DROP TABLE t2, t3;
call mtr.add_suppression("In ALTER TABLE .* has or is referenced in foreign key constraints which are not compatible with the new table definition.");
# restart
create table t1 (f1 integer primary key) engine innodb;
alter table t1 add constraint c1 foreign key (f1) references t1(f1);
ERROR HY000: Error on rename of '#sql-alter' to './test/t1' (errno: 150 "Foreign key constraint is incorrectly formed")
drop table t1;
......@@ -511,3 +511,19 @@ alter table t2 drop key t,algorithm=inplace;
show create table t2;
drop table t2;
drop table t1;
--echo #
--echo # MDEV-29092 FOREIGN_KEY_CHECKS does not prevent non-copy
--echo # alter from creating invalid FK structures
--echo #
CREATE TABLE t1(f1 INT, KEY(f1),
FOREIGN KEY(f1) references t1(f1))ENGINE=InnoDB;
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1(f1 INT, KEY(f1),
FOREIGN KEY(f1) REFERENCES t1(f1))ENGINE=InnoDB;
SHOW CREATE TABLE t1;
ALTER TABLE t1 DROP KEY f1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
......@@ -85,10 +85,8 @@ SET FOREIGN_KEY_CHECKS= ON;
CREATE TABLE t2 (f2 INT, FOREIGN KEY(f2) REFERENCES t1 (f2)) ENGINE=InnoDB;
--error ER_CANT_CREATE_TABLE
CREATE TABLE t3 (a INT) ENGINE=InnoDB;
--replace_result $datadir ./
--error ER_ERROR_ON_RENAME
ALTER TABLE t1 RENAME TO t3;
ALTER TABLE t1 FORCE;
ALTER TABLE t3 FORCE;
--error ER_TRUNCATE_ILLEGAL_FK
TRUNCATE TABLE t1;
DROP TABLE t2, t1;
TRUNCATE TABLE t3;
DROP TABLE t2, t3;
# Bug 12902967: Creating self referencing fk on same index unhandled,
# confusing error
#
# Creating a self referencing foreign key on the same
# column/index is an unhandled exception, it should throw a sensible
# error but instead implies that your data dictionary may now be out
# of sync:
--source include/have_innodb.inc
--source include/not_embedded.inc
call mtr.add_suppression("In ALTER TABLE .* has or is referenced in foreign key constraints which are not compatible with the new table definition.");
let error_log= $MYSQLTEST_VARDIR/log/mysqld.1.err;
--source include/restart_mysqld.inc
create table t1 (f1 integer primary key) engine innodb;
# The below statement should produce error message in error log.
# This error message should mention problem with foreign keys
# rather than with data dictionary.
--replace_regex /'\.\/test\/#sql-alter-[0-9a-f_\-]*'/'#sql-alter'/
--error ER_ERROR_ON_RENAME
alter table t1 add constraint c1 foreign key (f1) references t1(f1);
drop table t1;
......@@ -2,6 +2,8 @@
--source include/count_sessions.inc
--source include/have_debug_sync.inc
--source include/innodb_stable_estimates.inc
CREATE TABLE t1 (
pk INT,
f1 VARCHAR(10) NOT NULL,
......
......@@ -102,6 +102,7 @@ if [ -z "$BACKUP_BIN" ]; then
fi
DATA="$WSREP_SST_OPT_DATA"
INFO_FILE='xtrabackup_galera_info'
IST_FILE='xtrabackup_ist'
MAGIC_FILE="$DATA/$INFO_FILE"
......@@ -1042,6 +1043,23 @@ setup_commands()
INNOBACKUP="$BACKUP_BIN$WSREP_SST_OPT_CONF --backup$disver${iopts:+ }$iopts$tmpopts$INNOEXTRA --galera-info --stream=$sfmt --target-dir='$itmpdir' --datadir='$DATA'$mysqld_args $INNOBACKUP"
}
send_magic()
{
# Store donor's wsrep GTID (state ID) and wsrep_gtid_domain_id
# (separated by a space).
echo "$WSREP_SST_OPT_GTID $WSREP_SST_OPT_GTID_DOMAIN_ID" > "$MAGIC_FILE"
if [ -n "$WSREP_SST_OPT_REMOTE_PSWD" ]; then
# Let joiner know that we know its secret
echo "$SECRET_TAG $WSREP_SST_OPT_REMOTE_PSWD" >> "$MAGIC_FILE"
fi
if [ $WSREP_SST_OPT_BYPASS -eq 0 -a $WSREP_SST_OPT_PROGRESS -eq 1 ]; then
# Tell joiner what to expect:
echo "$TOTAL_TAG $payload" >> "$MAGIC_FILE"
fi
}
get_stream
get_transfer
......@@ -1099,20 +1117,7 @@ if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then
fi
wsrep_log_info "Streaming GTID file before SST"
# Store donor's wsrep GTID (state ID) and wsrep_gtid_domain_id
# (separated by a space).
echo "$WSREP_SST_OPT_GTID $WSREP_SST_OPT_GTID_DOMAIN_ID" > "$MAGIC_FILE"
if [ -n "$WSREP_SST_OPT_REMOTE_PSWD" ]; then
# Let joiner know that we know its secret
echo "$SECRET_TAG $WSREP_SST_OPT_REMOTE_PSWD" >> "$MAGIC_FILE"
fi
if [ $WSREP_SST_OPT_PROGRESS -eq 1 ]; then
# Tell joiner what to expect:
echo "$TOTAL_TAG $payload" >> "$MAGIC_FILE"
fi
send_magic
ttcmd="$tcmd"
......@@ -1202,9 +1207,8 @@ if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then
wsrep_log_info "Bypassing the SST for IST"
echo "continue" # now server can resume updating data
# Store donor's wsrep GTID (state ID) and wsrep_gtid_domain_id
# (separated by a space).
echo "$WSREP_SST_OPT_GTID $WSREP_SST_OPT_GTID_DOMAIN_ID" > "$MAGIC_FILE"
send_magic
echo "1" > "$DATA/$IST_FILE"
if [ -n "$scomp" ]; then
......@@ -1310,7 +1314,7 @@ else # joiner
impts="--parallel=$backup_threads${impts:+ }$impts"
fi
SST_PID="$WSREP_SST_OPT_DATA/wsrep_sst.pid"
SST_PID="$DATA/wsrep_sst.pid"
# give some time for previous SST to complete:
check_round=0
......@@ -1451,8 +1455,8 @@ else # joiner
TDATA="$DATA"
DATA="$DATA/.sst"
MAGIC_FILE="$DATA/$INFO_FILE"
wsrep_log_info "Waiting for SST streaming to complete!"
monitor_process $jpid
......
......@@ -149,10 +149,12 @@ check_pid_and_port()
check_pid "$pid_file" && [ $CHECK_PID -eq $pid ]
}
STUNNEL_CONF="$WSREP_SST_OPT_DATA/stunnel.conf"
STUNNEL_PID="$WSREP_SST_OPT_DATA/stunnel.pid"
DATA="$WSREP_SST_OPT_DATA"
STUNNEL_CONF="$DATA/stunnel.conf"
STUNNEL_PID="$DATA/stunnel.pid"
MAGIC_FILE="$WSREP_SST_OPT_DATA/rsync_sst_complete"
MAGIC_FILE="$DATA/rsync_sst_complete"
get_binlog
......@@ -163,7 +165,6 @@ fi
OLD_PWD="$(pwd)"
DATA="$WSREP_SST_OPT_DATA"
if [ -n "$DATA" -a "$DATA" != '.' ]; then
[ ! -d "$DATA" ] && mkdir -p "$DATA"
cd "$DATA"
......@@ -347,7 +348,7 @@ fi
readonly SECRET_TAG='secret'
readonly BYPASS_TAG='bypass'
SST_PID="$WSREP_SST_OPT_DATA/wsrep_sst.pid"
SST_PID="$DATA/wsrep_sst.pid"
# give some time for previous SST to complete:
check_round=0
......@@ -379,8 +380,8 @@ done
MODULE="${WSREP_SST_OPT_MODULE:-rsync_sst}"
RSYNC_PID="$WSREP_SST_OPT_DATA/$MODULE.pid"
RSYNC_CONF="$WSREP_SST_OPT_DATA/$MODULE.conf"
RSYNC_PID="$DATA/$MODULE.pid"
RSYNC_CONF="$DATA/$MODULE.conf"
# give some time for rsync from the previous SST to complete:
check_round=0
......@@ -422,8 +423,8 @@ EOF
if [ $WSREP_SST_OPT_BYPASS -eq 0 ]; then
FLUSHED="$WSREP_SST_OPT_DATA/tables_flushed"
ERROR="$WSREP_SST_OPT_DATA/sst_error"
FLUSHED="$DATA/tables_flushed"
ERROR="$DATA/sst_error"
[ -f "$FLUSHED" ] && rm -f "$FLUSHED"
[ -f "$ERROR" ] && rm -f "$ERROR"
......@@ -580,7 +581,7 @@ FILTER="-f '- /lost+found'
eval rsync ${STUNNEL:+"--rsh='$STUNNEL'"} \
--owner --group --perms --links --specials \
--ignore-times --inplace --dirs --delete --quiet \
$WHOLE_FILE_OPT $FILTER "'$WSREP_SST_OPT_DATA/'" \
$WHOLE_FILE_OPT $FILTER "'$DATA/'" \
"'rsync://$WSREP_SST_OPT_ADDR'" >&2 || RC=$?
if [ $RC -ne 0 ]; then
......@@ -688,7 +689,7 @@ FILTER="-f '- /lost+found'
-f '- $ib_log_dir/ib_logfile[0-9]*' \
-f '- $ar_log_dir/aria_log_control' \
-f '- $ar_log_dir/aria_log.*' \
"$WSREP_SST_OPT_DATA/{}/" \
"$DATA/{}/" \
"rsync://$WSREP_SST_OPT_ADDR/{}" >&2 || RC=$?
cd "$OLD_PWD"
......@@ -770,7 +771,7 @@ read only = no
timeout = 300
$SILENT
[$MODULE]
path = $WSREP_SST_OPT_DATA
path = $DATA
exclude = .zfs
[$MODULE-log_dir]
path = $ib_log_dir
......
......@@ -15010,13 +15010,6 @@ int QUICK_GROUP_MIN_MAX_SELECT::init()
{
if (group_prefix) /* Already initialized. */
return 0;
/*
We allocate one byte more to serve the case when the last field in
the buffer is compared using uint3korr (e.g. a Field_newdate field)
*/
if (!(last_prefix= (uchar*) alloc_root(&alloc, group_prefix_len+1)))
return 1;
/*
We may use group_prefix to store keys with all select fields, so allocate
enough space for it.
......@@ -15273,8 +15266,7 @@ void QUICK_GROUP_MIN_MAX_SELECT::update_key_stat()
QUICK_GROUP_MIN_MAX_SELECT::reset()
DESCRIPTION
Initialize the index chosen for access and find and store the prefix
of the last group. The method is expensive since it performs disk access.
Initialize the index chosen for access.
RETURN
0 OK
......@@ -15296,12 +15288,6 @@ int QUICK_GROUP_MIN_MAX_SELECT::reset(void)
}
if (quick_prefix_select && quick_prefix_select->reset())
DBUG_RETURN(1);
result= file->ha_index_last(record);
if (result == HA_ERR_END_OF_FILE)
DBUG_RETURN(0);
/* Save the prefix of the last group. */
key_copy(last_prefix, record, index_info, group_prefix_len);
DBUG_RETURN(0);
}
......@@ -15347,34 +15333,20 @@ int QUICK_GROUP_MIN_MAX_SELECT::get_next()
#else
int result;
#endif
int is_last_prefix= 0;
DBUG_ENTER("QUICK_GROUP_MIN_MAX_SELECT::get_next");
/*
Loop until a group is found that satisfies all query conditions or the last
group is reached.
Loop until a group is found that satisfies all query conditions or
there are no satisfying groups left
*/
do
{
result= next_prefix();
if (result != 0)
break;
/*
Check if this is the last group prefix. Notice that at this point
this->record contains the current prefix in record format.
At this point this->record contains the current prefix in record format.
*/
if (!result)
{
is_last_prefix= key_cmp(index_info->key_part, last_prefix,
group_prefix_len);
DBUG_ASSERT(is_last_prefix <= 0);
}
else
{
if (result == HA_ERR_KEY_NOT_FOUND)
continue;
break;
}
if (have_min)
{
min_res= next_min();
......@@ -15403,8 +15375,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::get_next()
HA_READ_KEY_EXACT);
result= have_min ? min_res : have_max ? max_res : result;
} while ((result == HA_ERR_KEY_NOT_FOUND || result == HA_ERR_END_OF_FILE) &&
is_last_prefix != 0);
} while (result == HA_ERR_KEY_NOT_FOUND || result == HA_ERR_END_OF_FILE);
if (result == HA_ERR_KEY_NOT_FOUND)
result= HA_ERR_END_OF_FILE;
......
......@@ -1590,7 +1590,6 @@ class QUICK_GROUP_MIN_MAX_SELECT : public QUICK_SELECT_I
uchar *group_prefix; /* Key prefix consisting of the GROUP fields. */
const uint group_prefix_len; /* Length of the group prefix. */
uint group_key_parts; /* A number of keyparts in the group prefix */
uchar *last_prefix; /* Prefix of the last group for detecting EOF. */
bool have_min; /* Specify whether we are computing */
bool have_max; /* a MIN, a MAX, or both. */
bool have_agg_distinct;/* aggregate_function(DISTINCT ...). */
......
......@@ -554,19 +554,19 @@ bool Sql_cmd_alter_table::execute(THD *thd)
}
wsrep::key_array keys;
wsrep_append_fk_parent_table(thd, first_table, &keys);
WSREP_TO_ISOLATION_BEGIN_ALTER(lex->name.str ? select_lex->db.str
: first_table->db.str,
lex->name.str ? lex->name.str
: first_table->table_name.str,
first_table, &alter_info, &keys,
used_engine ? &create_info : nullptr)
if (wsrep_append_fk_parent_table(thd, first_table, &keys))
{
WSREP_WARN("ALTER TABLE isolation failure");
DBUG_RETURN(TRUE);
WSREP_TO_ISOLATION_BEGIN_ALTER(lex->name.str ? select_lex->db.str
: first_table->db.str,
lex->name.str ? lex->name.str
: first_table->table_name.str,
first_table, &alter_info, &keys,
used_engine ? &create_info : nullptr)
{
WSREP_WARN("ALTER TABLE isolation failure");
DBUG_RETURN(TRUE);
}
}
DEBUG_SYNC(thd, "wsrep_alter_table_after_toi");
}
#endif
......
......@@ -1390,7 +1390,7 @@ static void wsrep_keys_free(wsrep_key_arr_t* key_arr)
* @param tables list of tables
* @param keys prepared keys
* @return true if parent table append was successfull, otherwise false.
* @return 0 if parent table append was successful, non-zero otherwise.
*/
bool
wsrep_append_fk_parent_table(THD* thd, TABLE_LIST* tables, wsrep::key_array* keys)
......@@ -1439,6 +1439,8 @@ wsrep_append_fk_parent_table(THD* thd, TABLE_LIST* tables, wsrep::key_array* key
}
exit:
DEBUG_SYNC(thd, "wsrep_append_fk_toi_keys_before_close_tables");
/* close the table and release MDL locks */
close_thread_tables(thd);
thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
......@@ -1449,6 +1451,24 @@ wsrep_append_fk_parent_table(THD* thd, TABLE_LIST* tables, wsrep::key_array* key
table->mdl_request.ticket= NULL;
}
/*
MDEV-32938: Check if DDL operation has been killed before.
It may be that during collecting foreign keys this operation gets BF-aborted
by another already-running TOI operation because it got MDL locks on the same
table for checking foreign keys.
After `close_thread_tables()` has been called it's safe to assume that no-one
can BF-abort this operation as it's not holding any MDL locks any more.
*/
if (!fail)
{
mysql_mutex_lock(&thd->LOCK_thd_kill);
if (thd->killed)
{
fail= true;
}
mysql_mutex_unlock(&thd->LOCK_thd_kill);
}
return fail;
}
......@@ -2537,6 +2557,15 @@ int wsrep_to_isolation_begin(THD *thd, const char *db_, const char *table_,
const wsrep::key_array *fk_tables,
const HA_CREATE_INFO *create_info)
{
mysql_mutex_lock(&thd->LOCK_thd_kill);
const killed_state killed = thd->killed;
mysql_mutex_unlock(&thd->LOCK_thd_kill);
if (killed)
{
DBUG_ASSERT(FALSE);
return -1;
}
/*
No isolation for applier or replaying threads.
*/
......
......@@ -2898,8 +2898,7 @@ dict_foreign_find_index(
for (dict_index_t* index = dict_table_get_first_index(table);
index;
index = dict_table_get_next_index(index)) {
if (types_idx != index
&& !index->to_be_dropped
if (!index->to_be_dropped
&& !dict_index_is_online_ddl(index)
&& dict_foreign_qualify_index(
table, col_names, columns, n_cols,
......
--echo #
--echo # MDEV-28683 Spider: SIGSEGV in spider_db_direct_delete, SIGSEGV in spider_db_connect, ASAN: heap-use-after-free in spider_db_direct_delete
--echo #
--disable_query_log
--disable_result_log
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
CREATE TABLE t (c INT) ENGINE=Spider;
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
SELECT * FROM t;
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
INSERT INTO t (SELECT 1 FROM t);
LOCK TABLES t WRITE CONCURRENT;
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
DELETE FROM t;
UNLOCK TABLES;
DROP TABLE t;
--disable_query_log
--disable_result_log
--source ../../t/test_deinit.inc
--enable_result_log
--enable_query_log
--echo #
--echo # end of test mdev_28683
--echo #
......@@ -2688,7 +2688,7 @@ static MYSQL_SYSVAR_UINT(
"Static thread count of table sts",
NULL,
NULL,
10,
1,
1,
4294967295U,
0
......@@ -2707,7 +2707,7 @@ static MYSQL_SYSVAR_UINT(
"Static thread count of table crd",
NULL,
NULL,
10,
1,
1,
4294967295U,
0
......
......@@ -3642,9 +3642,6 @@ int spider_check_trx_and_get_conn(
for (roop_count = 0; roop_count < (int) share->link_count; roop_count++)
{
if (
/*
spider->conn_kind[roop_count] != SPIDER_CONN_KIND_MYSQL &&
*/
share->hs_dbton_ids[spider->conn_link_idx[roop_count]] ==
SPIDER_DBTON_SIZE
) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment