From d8e6bb00888b1f82c031938f4c8ac5d97f6874c3 Mon Sep 17 00:00:00 2001 From: Gulshan Kumar Prasad Date: Sat, 18 Nov 2023 19:08:10 +0530 Subject: [PATCH 01/12] MDEV-32611: Test suite is missing dump option delete-master-logs. Extending the rpl_mysqldump_slave.test to incorporate the delete-master-logs option, and this options is alias of get binlogs: show master status -> flush logs -> purge binary logs to sequence and this test is derived using the same pattern. also we measure the pre and post log state on the master following the mysqldump process. Introducing assertions to validate the correct state. --- mysql-test/main/rpl_mysqldump_slave.result | 9 +++++ mysql-test/main/rpl_mysqldump_slave.test | 40 ++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/mysql-test/main/rpl_mysqldump_slave.result b/mysql-test/main/rpl_mysqldump_slave.result index 903b671178f..c5458ec374c 100644 --- a/mysql-test/main/rpl_mysqldump_slave.result +++ b/mysql-test/main/rpl_mysqldump_slave.result @@ -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 diff --git a/mysql-test/main/rpl_mysqldump_slave.test b/mysql-test/main/rpl_mysqldump_slave.test index 345bdb82535..315b4def2a4 100644 --- a/mysql-test/main/rpl_mysqldump_slave.test +++ b/mysql-test/main/rpl_mysqldump_slave.test @@ -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 +# 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 From 9a8b1f2ac41657d11bec5efed7ca45acb22130a1 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 4 Dec 2023 12:15:30 +0100 Subject: [PATCH 02/12] MDEV-32926 mysql_install_db_win fails on buildbot - Do not suppress mysql_install_db.exe output in case of error - Add --verbose-bootstrap to get errors coming from mysqld --boostrap --- mysql-test/main/mysql_install_db_win.test | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mysql-test/main/mysql_install_db_win.test b/mysql-test/main/mysql_install_db_win.test index 3f0256e860e..5c90779c1a3 100644 --- a/mysql-test/main/mysql_install_db_win.test +++ b/mysql-test/main/mysql_install_db_win.test @@ -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 From 9d15c3e35a30ad4801f00632c194fe2850cd79f1 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 15 Nov 2023 14:27:56 +1100 Subject: [PATCH 03/12] MDEV-29020 Reduce default spider bg sts/crd thread counts --- storage/spider/spd_param.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc index b77acef57fe..5eaf9518048 100644 --- a/storage/spider/spd_param.cc +++ b/storage/spider/spd_param.cc @@ -2701,7 +2701,7 @@ static MYSQL_SYSVAR_UINT( "Static thread count of table sts", NULL, NULL, - 10, + 1, 1, 4294967295U, 0 @@ -2720,7 +2720,7 @@ static MYSQL_SYSVAR_UINT( "Static thread count of table crd", NULL, NULL, - 10, + 1, 1, 4294967295U, 0 From dc7138cbed7150f473dd5f74be71003f24c1083e Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Thu, 30 Nov 2023 08:45:11 +0100 Subject: [PATCH 04/12] galera: temporarily disabling problematic tests --- mysql-test/suite/galera/disabled.def | 4 ++++ mysql-test/suite/galera_3nodes/disabled.def | 3 +++ 2 files changed, 7 insertions(+) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index c5412874929..9fcc1f18fd4 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -22,3 +22,7 @@ galera_as_slave_replay : MDEV-32780 galera_as_slave_replay: assertion in the wsr 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 diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def index 2cec93fd3b7..730f98667e6 100644 --- a/mysql-test/suite/galera_3nodes/disabled.def +++ b/mysql-test/suite/galera_3nodes/disabled.def @@ -13,3 +13,6 @@ galera_2_cluster : MDEV-32631 galera_2_cluster: before_rollback(): Assertion `0' failed galera_gtid_2_cluster : MDEV-32633 galera_gtid_2_cluster: Assertion `thd->wsrep_next_trx_id() != (0x7fffffffffffffffLL * 2ULL + 1)' 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 From 6d9c9d92cc518fe429bd4aa866ad0655bb56c11e Mon Sep 17 00:00:00 2001 From: Denis Protivensky Date: Mon, 27 Nov 2023 11:45:34 +0300 Subject: [PATCH 05/12] MDEV-32938: DDL must check if not aborted before entering TOI Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera/r/MDEV-32938.result | 21 ++++++++ mysql-test/suite/galera/t/MDEV-32938.test | 57 +++++++++++++++++++++ sql/sql_alter.cc | 19 +++---- sql/wsrep_mysqld.cc | 31 ++++++++++- 4 files changed, 118 insertions(+), 10 deletions(-) create mode 100644 mysql-test/suite/galera/r/MDEV-32938.result create mode 100644 mysql-test/suite/galera/t/MDEV-32938.test diff --git a/mysql-test/suite/galera/r/MDEV-32938.result b/mysql-test/suite/galera/r/MDEV-32938.result new file mode 100644 index 00000000000..5e310eb7843 --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-32938.result @@ -0,0 +1,21 @@ +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; diff --git a/mysql-test/suite/galera/t/MDEV-32938.test b/mysql-test/suite/galera/t/MDEV-32938.test new file mode 100644 index 00000000000..cb41f21a58a --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-32938.test @@ -0,0 +1,57 @@ +# +# 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 diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc index f83f629a715..b619f9ed741 100644 --- a/sql/sql_alter.cc +++ b/sql/sql_alter.cc @@ -490,17 +490,18 @@ 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 : NULL), - (lex->name.str ? lex->name.str : NULL), - first_table, &alter_info, &keys) + 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 : NULL), + (lex->name.str ? lex->name.str : NULL), + first_table, &alter_info, &keys) + { + WSREP_WARN("ALTER TABLE isolation failure"); + DBUG_RETURN(TRUE); + } - DEBUG_SYNC(thd, "wsrep_alter_table_after_toi"); + DEBUG_SYNC(thd, "wsrep_alter_table_after_toi"); + } } #endif diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 688b0061389..7c8bb683aab 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1288,7 +1288,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) @@ -1337,6 +1337,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); @@ -1347,6 +1349,24 @@ exit: 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; } @@ -2294,6 +2314,15 @@ int wsrep_to_isolation_begin(THD *thd, const char *db_, const char *table_, const TABLE_LIST* table_list, Alter_info* alter_info, wsrep::key_array* fk_tables) { + 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. */ From 5c4c1844bf8b60dcee9fdeacd4a39705d40a4515 Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Mon, 20 Nov 2023 13:42:38 +0100 Subject: [PATCH 06/12] MDEV-32781 galera_bf_lock_wait test failed This test happens to fail if it runs after test galera_inject_bf_long_wait. And the reason is that galera_bf_lock_wait greps for message "BF lock wait long" in the error log, and expects that grep matches no lines. Whereas galera_inject_bf_long_wait intentionally causes the message to appear in the log. The fix consists in using assert_grep.inc with option assert_only_after, such that galera_bf_lock_wait is limited to grep only those lines that appeared in the log after it started to execute. Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera/disabled.def | 1 - .../suite/galera/r/galera_bf_lock_wait.result | 20 +++++++++++++++++++ .../suite/galera/t/galera_bf_lock_wait.test | 14 ++++++++++--- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 9fcc1f18fd4..4db06714bc1 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -20,7 +20,6 @@ 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 diff --git a/mysql-test/suite/galera/r/galera_bf_lock_wait.result b/mysql-test/suite/galera/r/galera_bf_lock_wait.result index 757fbf50cad..9e5cb2d9266 100644 --- a/mysql-test/suite/galera/r/galera_bf_lock_wait.result +++ b/mysql-test/suite/galera/r/galera_bf_lock_wait.result @@ -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; diff --git a/mysql-test/suite/galera/t/galera_bf_lock_wait.test b/mysql-test/suite/galera/t/galera_bf_lock_wait.test index 0562b4361ff..8ef2fee78ed 100644 --- a/mysql-test/suite/galera/t/galera_bf_lock_wait.test +++ b/mysql-test/suite/galera/t/galera_bf_lock_wait.test @@ -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; } From bd23b3dc0673bc9556a2bd7207c242d489dc92a7 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Mon, 4 Dec 2023 15:55:53 +0300 Subject: [PATCH 07/12] MDEV-32901: innodb.mdev-14846 fails in 11.0 InnoDB could return off-by-1 estimates for the involved tables. This would cause off-by-many difference in join output cardinality for the top-level SELECT, and so different query plan for the subquery. The fix: Introduce mysql-test/include/innodb_stable_estimates.{inc,opt} which disables InnoDB's background statistics collection, and use it. --- mysql-test/include/innodb_stable_estimates.inc | 12 ++++++++++++ mysql-test/include/innodb_stable_estimates.opt | 1 + mysql-test/suite/innodb/t/mdev-14846.test | 2 ++ 3 files changed, 15 insertions(+) create mode 100644 mysql-test/include/innodb_stable_estimates.inc create mode 100644 mysql-test/include/innodb_stable_estimates.opt diff --git a/mysql-test/include/innodb_stable_estimates.inc b/mysql-test/include/innodb_stable_estimates.inc new file mode 100644 index 00000000000..dc3bc4de9ee --- /dev/null +++ b/mysql-test/include/innodb_stable_estimates.inc @@ -0,0 +1,12 @@ +# +# 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) +# diff --git a/mysql-test/include/innodb_stable_estimates.opt b/mysql-test/include/innodb_stable_estimates.opt new file mode 100644 index 00000000000..896950f4ae5 --- /dev/null +++ b/mysql-test/include/innodb_stable_estimates.opt @@ -0,0 +1 @@ +--innodb_stats_auto_recalc=0 diff --git a/mysql-test/suite/innodb/t/mdev-14846.test b/mysql-test/suite/innodb/t/mdev-14846.test index adcefecd52f..0952470506d 100644 --- a/mysql-test/suite/innodb/t/mdev-14846.test +++ b/mysql-test/suite/innodb/t/mdev-14846.test @@ -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, From dc9ac9266ccedcfc8ce269dbf1b710aec536f560 Mon Sep 17 00:00:00 2001 From: Brandon Nesterenko Date: Mon, 4 Dec 2023 07:38:44 -0700 Subject: [PATCH 08/12] MDEV-32933: Skip statement and mix mode for binlog.flashback The binlog.flashback test tries to run using the stmt and mix binlog_format combinations (because it includes have_log_bin.inc), yet are meaningless tests because the server starts with the --flashback option, forcing binlog_format=row. This patch optimizes test time by removing the stmt and mix format combinations from running. Reviewed By: ============ Andrei Elkin --- mysql-test/suite/binlog/t/flashback.test | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mysql-test/suite/binlog/t/flashback.test b/mysql-test/suite/binlog/t/flashback.test index 50190da6dbe..0c499139a9f 100644 --- a/mysql-test/suite/binlog/t/flashback.test +++ b/mysql-test/suite/binlog/t/flashback.test @@ -1,4 +1,4 @@ ---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 From d5fc34db4c722309bc30d5f6fe7c24397b104a7d Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Wed, 6 Dec 2023 14:29:17 +0530 Subject: [PATCH 09/12] MDEV-29092 FOREIGN_KEY_CHECKS does not prevent non-copy alter from creating invalid FK structure Problem: ======== - InnoDB should have two keys on the same column for the self referencing foreign key relation. Solution: ========= - Allow self referential foreign key relation to work with one key. --- .../innodb/r/innodb-index-online-fk.result | 31 +++++++++++++++++++ .../suite/innodb/r/innodb-truncate.result | 7 ++--- .../suite/innodb/r/innodb_bug12902967.result | 6 ---- .../innodb/t/innodb-index-online-fk.test | 16 ++++++++++ .../suite/innodb/t/innodb-truncate.test | 8 ++--- .../suite/innodb/t/innodb_bug12902967.test | 25 --------------- storage/innobase/dict/dict0dict.cc | 3 +- 7 files changed, 54 insertions(+), 42 deletions(-) delete mode 100644 mysql-test/suite/innodb/r/innodb_bug12902967.result delete mode 100644 mysql-test/suite/innodb/t/innodb_bug12902967.test diff --git a/mysql-test/suite/innodb/r/innodb-index-online-fk.result b/mysql-test/suite/innodb/r/innodb-index-online-fk.result index afe55543e55..35ef7ae9ef9 100644 --- a/mysql-test/suite/innodb/r/innodb-index-online-fk.result +++ b/mysql-test/suite/innodb/r/innodb-index-online-fk.result @@ -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; diff --git a/mysql-test/suite/innodb/r/innodb-truncate.result b/mysql-test/suite/innodb/r/innodb-truncate.result index 8610a892cc6..fb027967390 100644 --- a/mysql-test/suite/innodb/r/innodb-truncate.result +++ b/mysql-test/suite/innodb/r/innodb-truncate.result @@ -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; diff --git a/mysql-test/suite/innodb/r/innodb_bug12902967.result b/mysql-test/suite/innodb/r/innodb_bug12902967.result deleted file mode 100644 index 6478cdb6c1f..00000000000 --- a/mysql-test/suite/innodb/r/innodb_bug12902967.result +++ /dev/null @@ -1,6 +0,0 @@ -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-temporary' to './test/t1' (errno: 150 "Foreign key constraint is incorrectly formed") -drop table t1; diff --git a/mysql-test/suite/innodb/t/innodb-index-online-fk.test b/mysql-test/suite/innodb/t/innodb-index-online-fk.test index 12a6eea49c2..00333db0d8f 100644 --- a/mysql-test/suite/innodb/t/innodb-index-online-fk.test +++ b/mysql-test/suite/innodb/t/innodb-index-online-fk.test @@ -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; diff --git a/mysql-test/suite/innodb/t/innodb-truncate.test b/mysql-test/suite/innodb/t/innodb-truncate.test index 71c0fcfea8b..87387c313df 100644 --- a/mysql-test/suite/innodb/t/innodb-truncate.test +++ b/mysql-test/suite/innodb/t/innodb-truncate.test @@ -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; diff --git a/mysql-test/suite/innodb/t/innodb_bug12902967.test b/mysql-test/suite/innodb/t/innodb_bug12902967.test deleted file mode 100644 index 1b5df7fa165..00000000000 --- a/mysql-test/suite/innodb/t/innodb_bug12902967.test +++ /dev/null @@ -1,25 +0,0 @@ -# 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-[0-9a-f_]*'/'#sql-temporary'/ ---error ER_ERROR_ON_RENAME -alter table t1 add constraint c1 foreign key (f1) references t1(f1); -drop table t1; diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index 1245799b7d3..d0f8ac21dd8 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -2697,8 +2697,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, From a8bd6a9813d497d15ee42eefcc02682872484b3b Mon Sep 17 00:00:00 2001 From: Oleg Smirnov Date: Fri, 10 Nov 2023 20:03:06 +0700 Subject: [PATCH 10/12] MDEV-15656 Assertion `is_last_prefix <= 0' failed in QUICK_GROUP_MIN_MAX_SELECT::get_next When QUICK_GROUP_MIN_MAX_SELECT is initialized or being reset it stores the prefix of the last group of the index chosen for retrieving data (last_value). Later, when looping through records at get_next() method, the server checks whether the retrieved group is the last, and if so, it finishes processing. At the same time, it looks like there is no need for that additional check since method next_prefix() returns HA_ERR_KEY_NOT_FOUND or HA_ERR_END_OF_FILE when there are no more satisfying records. If we do not perform the check, we do not need to retrieve and store last_value either. This commit removes using of last_value from QUICK_GROUP_MIN_MAX_SELECT. Reviewer: Sergei Petrunia --- mysql-test/main/group_min_max_innodb.result | 107 ++++++++++++++++++ mysql-test/main/group_min_max_innodb.test | 47 ++++++++ .../innodb_ext_key,covering,innodb,on.rdiff | 20 ++++ ...innodb_ext_key,innodb,on,unoptimized.rdiff | 20 ++++ sql/opt_range.cc | 45 ++------ sql/opt_range.h | 1 - 6 files changed, 202 insertions(+), 38 deletions(-) create mode 100644 mysql-test/main/innodb_ext_key,covering,innodb,on.rdiff create mode 100644 mysql-test/main/innodb_ext_key,innodb,on,unoptimized.rdiff diff --git a/mysql-test/main/group_min_max_innodb.result b/mysql-test/main/group_min_max_innodb.result index a2b06b0481b..d7edad83b80 100644 --- a/mysql-test/main/group_min_max_innodb.result +++ b/mysql-test/main/group_min_max_innodb.result @@ -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; diff --git a/mysql-test/main/group_min_max_innodb.test b/mysql-test/main/group_min_max_innodb.test index fcecbec41b3..33a3a8888a5 100644 --- a/mysql-test/main/group_min_max_innodb.test +++ b/mysql-test/main/group_min_max_innodb.test @@ -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; diff --git a/mysql-test/main/innodb_ext_key,covering,innodb,on.rdiff b/mysql-test/main/innodb_ext_key,covering,innodb,on.rdiff new file mode 100644 index 00000000000..0d8bcc6ce3c --- /dev/null +++ b/mysql-test/main/innodb_ext_key,covering,innodb,on.rdiff @@ -0,0 +1,20 @@ +--- ./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 diff --git a/mysql-test/main/innodb_ext_key,innodb,on,unoptimized.rdiff b/mysql-test/main/innodb_ext_key,innodb,on,unoptimized.rdiff new file mode 100644 index 00000000000..0d8bcc6ce3c --- /dev/null +++ b/mysql-test/main/innodb_ext_key,innodb,on,unoptimized.rdiff @@ -0,0 +1,20 @@ +--- ./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 diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 0049be0daf4..b353c1aab41 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -14669,13 +14669,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. @@ -14931,8 +14924,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 @@ -14954,12 +14946,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); } @@ -15005,34 +14991,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(); - /* - Check if this is the last group prefix. Notice that 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; + if (result != 0) break; - } - + /* + At this point this->record contains the current prefix in record format. + */ if (have_min) { min_res= next_min(); @@ -15061,8 +15033,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; diff --git a/sql/opt_range.h b/sql/opt_range.h index 3f9d29a4447..a355dbacd9d 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -1527,7 +1527,6 @@ private: 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 ...). */ From 13896f73dfe7fb206b3ed72e40ae9039e37bea19 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 7 Dec 2023 10:45:52 +1100 Subject: [PATCH 11/12] MDEV-28683 Spider: create conn on demand when direct delete We do this in 10.4 at the same place where in 10.5+ dml_init() is called which does the same thing, among other things. --- storage/spider/ha_spider.cc | 2 ++ .../spider/bugfix/t/mdev_28683.test | 29 +++++++++++++++++++ storage/spider/spd_trx.cc | 3 -- 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_28683.test diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 793fa45c12f..24ee6c5e902 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -10999,6 +10999,8 @@ int ha_spider::direct_delete_rows_init() DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_delete_rows_init()); } #endif + if (int error_num = spider_check_trx_and_get_conn(thd, this, TRUE)) + DBUG_RETURN(error_num); direct_update_init( thd, FALSE diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_28683.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_28683.test new file mode 100644 index 00000000000..30821d0f251 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_28683.test @@ -0,0 +1,29 @@ +--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 12701 +INSERT INTO t (SELECT 1 FROM t); +LOCK TABLES t WRITE CONCURRENT; +--error 12701 +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 # diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index b39a398376c..29b5497dd81 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -3720,9 +3720,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 ) { From 66fafdb9227dc39ed0dadec12435880b6b060b8e Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Thu, 7 Dec 2023 01:29:57 +0100 Subject: [PATCH 12/12] MDEV-32344: IST failed with ssl-mode=VERIFY_CA This commit fixes a bug where IST could be rejected in favor of SST when ssl-mode=VERIFY_CA and when mariabackup is used. It also contains a test and small code simplifications that will make it easier to find bugs in the future. --- .../r/galera_ist_mariabackup_verify_ca.result | 21 +++++++ .../r/galera_ist_rsync_verify_ca.result | 21 +++++++ .../t/galera_ist_mariabackup_verify_ca.cnf | 20 ++++++ .../t/galera_ist_mariabackup_verify_ca.test | 61 +++++++++++++++++++ .../galera/t/galera_ist_rsync_verify_ca.cnf | 17 ++++++ .../galera/t/galera_ist_rsync_verify_ca.test | 60 ++++++++++++++++++ scripts/wsrep_sst_mariabackup.sh | 42 +++++++------ scripts/wsrep_sst_rsync.sh | 25 ++++---- 8 files changed, 236 insertions(+), 31 deletions(-) create mode 100644 mysql-test/suite/galera/r/galera_ist_mariabackup_verify_ca.result create mode 100644 mysql-test/suite/galera/r/galera_ist_rsync_verify_ca.result create mode 100644 mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.cnf create mode 100644 mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.test create mode 100644 mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.cnf create mode 100644 mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.test diff --git a/mysql-test/suite/galera/r/galera_ist_mariabackup_verify_ca.result b/mysql-test/suite/galera/r/galera_ist_mariabackup_verify_ca.result new file mode 100644 index 00000000000..955d5af7827 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_ist_mariabackup_verify_ca.result @@ -0,0 +1,21 @@ +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; diff --git a/mysql-test/suite/galera/r/galera_ist_rsync_verify_ca.result b/mysql-test/suite/galera/r/galera_ist_rsync_verify_ca.result new file mode 100644 index 00000000000..51dfa7bcd18 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_ist_rsync_verify_ca.result @@ -0,0 +1,21 @@ +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; diff --git a/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.cnf b/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.cnf new file mode 100644 index 00000000000..f2187b83486 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.cnf @@ -0,0 +1,20 @@ +!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 diff --git a/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.test b/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.test new file mode 100644 index 00000000000..4e2d25b1770 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.test @@ -0,0 +1,61 @@ +--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 diff --git a/mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.cnf b/mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.cnf new file mode 100644 index 00000000000..9125f6708fe --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.cnf @@ -0,0 +1,17 @@ +!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 diff --git a/mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.test b/mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.test new file mode 100644 index 00000000000..d9f7bb152fc --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.test @@ -0,0 +1,60 @@ +--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 diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index 84742defc16..4e21270feb2 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -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 diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 3e63596bcbe..ade9bb491e5 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -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" -MAGIC_FILE="$WSREP_SST_OPT_DATA/rsync_sst_complete" +STUNNEL_CONF="$DATA/stunnel.conf" +STUNNEL_PID="$DATA/stunnel.pid" + +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