From d890aca6b5c6fcf45873ca8ac96d71d3ef3e2da3 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 8 Sep 2023 14:09:37 +0200 Subject: [PATCH 1/8] "un-skip" more skipped tests * version_compile_os can be "linux-systemd", not equal to "Linux" * main.no-threads forces no-threads scheduler, a check whether it has one_thread_per_connection is guaranteed to fail. --- mysql-test/include/linux.inc | 2 +- mysql-test/main/{no-threads-master.opt => no-threads.opt} | 0 mysql-test/main/no-threads.test | 1 - mysql-test/suite/plugins/t/show_all_plugins.test | 2 +- 4 files changed, 2 insertions(+), 3 deletions(-) rename mysql-test/main/{no-threads-master.opt => no-threads.opt} (100%) diff --git a/mysql-test/include/linux.inc b/mysql-test/include/linux.inc index f24832ca476..cc126ff1d73 100644 --- a/mysql-test/include/linux.inc +++ b/mysql-test/include/linux.inc @@ -1,4 +1,4 @@ -if (`select convert(@@version_compile_os using latin1) LIKE 'Linux' = 0`) +if (`select @@version_compile_os not LIKE 'Linux%'`) { skip Need Linux; } diff --git a/mysql-test/main/no-threads-master.opt b/mysql-test/main/no-threads.opt similarity index 100% rename from mysql-test/main/no-threads-master.opt rename to mysql-test/main/no-threads.opt diff --git a/mysql-test/main/no-threads.test b/mysql-test/main/no-threads.test index c1a608a57e6..8235ff67284 100644 --- a/mysql-test/main/no-threads.test +++ b/mysql-test/main/no-threads.test @@ -2,7 +2,6 @@ # an additional util connection and other statistics data -- source include/no_view_protocol.inc ---source include/one_thread_per_connection.inc # # Test the --thread-handler=no-threads option # diff --git a/mysql-test/suite/plugins/t/show_all_plugins.test b/mysql-test/suite/plugins/t/show_all_plugins.test index 77723d32170..171bcc93bbd 100644 --- a/mysql-test/suite/plugins/t/show_all_plugins.test +++ b/mysql-test/suite/plugins/t/show_all_plugins.test @@ -1,7 +1,7 @@ +--source include/have_udf.inc if (!$DIALOG_EXAMPLES_SO) { skip requires dialog_examples.so; } if (!$HA_EXAMPLE_SO) { skip requires ha_examples.so; } if (!$LIBDAEMON_EXAMPLE_SO) { skip requires libdaemon_examples.so; } -if (!$UDF_EXAMPLE_SO) { skip requires udf_example.so; } if (!$EXAMPLE_KEY_MANAGEMENT_SO) { skip requires example_key_management.so; } if (`SELECT VERSION() LIKE '%embedded%'`) { skip Disabled for embedded until MDEV-8664 is resolved; } From 632a503ce7726547d8d858ae89fc3833ff95fe83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 23 Aug 2023 11:27:13 +0300 Subject: [PATCH 2/8] MDEV-29861 : Galera "notify" test cases hang Problem was that if wsrep_notify_cmd was set it was called with a new status "joined" it tries to connect to the server to update some table, but the server isn't initialized yet, it's not listening for connections. So the server waits for the script to finish, script waits for mariadb client to connect, and the client cannot connect, because the server isn't listening. Fix is to call script only when Galera has already formed a view or when it is synched or donor. This fix also enables following test cases: * galera.MW-284 * galera.galera_binlog_checksum * galera_var_notify_ssl_ipv6 Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera/disabled.def | 4 ---- sql/wsrep_notify.cc | 7 +++++++ sql/wsrep_utils.h | 6 +++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 7bd12ba7514..b70ab461aaa 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -13,10 +13,6 @@ galera_as_slave_ctas : MDEV-28378 timeout galera_pc_recovery : MDEV-25199 cluster fails to start up galera_sst_encrypted : MDEV-29876 Galera test failure on galera_sst_encrypted -galera.MW-284 : MDEV-29861 Galera test case hangs -galera.galera_binlog_checksum : MDEV-29861 Galera test case hangs -galera_var_notify_ssl_ipv6 : MDEV-29861 Galera test case hangs -galera_var_notify_cmd: MDEV-29861 Galera test case hangs galera_var_node_address : MDEV-20485 Galera test failure MDEV-26575 : MDEV-29878 Galera test failure on MDEV-26575 galera_bf_abort_group_commit : MDEV-30855 PR to remove the test exists diff --git a/sql/wsrep_notify.cc b/sql/wsrep_notify.cc index d2d08e92ae7..b4e4de1ef0d 100644 --- a/sql/wsrep_notify.cc +++ b/sql/wsrep_notify.cc @@ -21,6 +21,13 @@ void wsrep_notify_status(enum wsrep::server_state::state status, const wsrep::view* view) { + if (!view) + { + WSREP_DEBUG("wsrep_notify_status server not yet ready : wsrep_ready=%d status %d", + wsrep_ready, (int)status); + return; + } + if (!wsrep_notify_cmd || 0 == strlen(wsrep_notify_cmd)) { WSREP_INFO("wsrep_notify_cmd is not defined, skipping notification."); diff --git a/sql/wsrep_utils.h b/sql/wsrep_utils.h index 743e8d1fb70..d34b15e3b09 100644 --- a/sql/wsrep_utils.h +++ b/sql/wsrep_utils.h @@ -189,7 +189,11 @@ public: void set(enum wsrep::server_state::state status) { - wsrep_notify_status(status); + if (status == wsrep::server_state::s_donor || + status == wsrep::server_state::s_synced) + wsrep_notify_status(status, &view_); + else + wsrep_notify_status(status); lock(); status_= status; From fee138a1233d7a74658eaf2a830a3c11da654253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 24 Aug 2023 09:01:15 +0300 Subject: [PATCH 3/8] MDEV-31988 : galera_partition test: assertion due to unallowed state transition Test case is starting too many servers that are not really needed for original problem testing. This fix reduces number of servers to make test case smaller and more robust. Signed-off-by: Julius Goryavsky --- .../suite/galera/r/galera_partition.result | 25 +++-------- .../suite/galera/t/galera_partition.cnf | 22 --------- .../suite/galera/t/galera_partition.test | 45 +++++++------------ 3 files changed, 22 insertions(+), 70 deletions(-) delete mode 100644 mysql-test/suite/galera/t/galera_partition.cnf diff --git a/mysql-test/suite/galera/r/galera_partition.result b/mysql-test/suite/galera/r/galera_partition.result index 0e8894794d7..7b4d6e41054 100644 --- a/mysql-test/suite/galera/r/galera_partition.result +++ b/mysql-test/suite/galera/r/galera_partition.result @@ -3,8 +3,6 @@ connection node_1; connection node_1; call mtr.add_suppression("WSREP: RSU failed due to pending transactions, schema: test, query ALTER.*"); call mtr.add_suppression("WSREP: ALTER TABLE isolation failure"); -connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; -connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4; connection node_1; CREATE TABLE t1( id bigint unsigned NOT NULL AUTO_INCREMENT, @@ -396,33 +394,24 @@ insert into t1 (id, dt) values (350, '2010-12-17 00:00:00'); SELECT COUNT(*) FROM t1; COUNT(*) 350 -connection node_2; -call mtr.add_suppression("WSREP: Sending JOIN failed:"); -call p1(10); -connection node_3; -call mtr.add_suppression("WSREP: Sending JOIN failed:"); -call p1(10); -connection node_4; -call mtr.add_suppression("WSREP: Sending JOIN failed:"); -call p1(10); connection node_1; +call p1(10);; +connection node_2; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2a; SET SESSION wsrep_OSU_method='RSU'; -SELECT @@wsrep_OSU_method; -@@wsrep_OSU_method -RSU SET SESSION sql_log_bin = 0; ALTER TABLE t1 DROP PARTITION rx2009xx; ALTER TABLE t1 DROP PARTITION rx201004; ALTER TABLE t1 DROP PARTITION rx201008; SET SESSION wsrep_OSU_METHOD='TOI'; +SET SESSION sql_log_bin = 1; SELECT @@wsrep_OSU_method; @@wsrep_OSU_method TOI connection node_2; -connection node_3; -connection node_4; +disconnect node_2a; +connection node_1; connection node_1; DROP TABLE t1; DROP PROCEDURE p1; -disconnect node_3; -disconnect node_4; diff --git a/mysql-test/suite/galera/t/galera_partition.cnf b/mysql-test/suite/galera/t/galera_partition.cnf deleted file mode 100644 index 525eece04ab..00000000000 --- a/mysql-test/suite/galera/t/galera_partition.cnf +++ /dev/null @@ -1,22 +0,0 @@ -!include ../galera_4nodes.cnf - -[mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M;gmcast.segment=1' -wsrep_slave_threads=10 -wsrep_debug=1 - -[mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M;gmcast.segment=1' -wsrep_slave_threads=10 -wsrep_debug=1 - -[mysqld.3] -wsrep_provider_options='base_port=@mysqld.3.#galera_port;gcache.size=10M;gmcast.segment=2' -wsrep_slave_threads=10 -wsrep_debug=1 - -[mysqld.4] -wsrep_provider_options='base_port=@mysqld.4.#galera_port;gcache.size=10M;gmcast.segment=3' -wsrep_slave_threads=10 -wsrep_debug=1 - diff --git a/mysql-test/suite/galera/t/galera_partition.test b/mysql-test/suite/galera/t/galera_partition.test index 3de45d54000..269291311f1 100644 --- a/mysql-test/suite/galera/t/galera_partition.test +++ b/mysql-test/suite/galera/t/galera_partition.test @@ -1,17 +1,15 @@ --source include/galera_cluster.inc --source include/have_partition.inc --source include/big_test.inc +--source include/force_restart.inc --connection node_1 call mtr.add_suppression("WSREP: RSU failed due to pending transactions, schema: test, query ALTER.*"); call mtr.add_suppression("WSREP: ALTER TABLE isolation failure"); ---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 ---connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 - --connection node_1 ---let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; --source include/wait_condition.inc CREATE TABLE t1( @@ -408,50 +406,37 @@ insert into t1 (id, dt) values (350, '2010-12-17 00:00:00'); SELECT COUNT(*) FROM t1; ---connection node_2 -call mtr.add_suppression("WSREP: Sending JOIN failed:"); -send call p1(10); - ---connection node_3 -call mtr.add_suppression("WSREP: Sending JOIN failed:"); -send call p1(10); - ---connection node_4 -call mtr.add_suppression("WSREP: Sending JOIN failed:"); -send call p1(10); - --connection node_1 +--send call p1(10); + +--connection node_2 + +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connection node_2a SET SESSION wsrep_OSU_method='RSU'; -SELECT @@wsrep_OSU_method; SET SESSION sql_log_bin = 0; ---error 0,ER_LOCK_DEADLOCK +--error 0,ER_LOCK_DEADLOCK,ER_LOCK_WAIT_TIMEOUT ALTER TABLE t1 DROP PARTITION rx2009xx; ---error 0,ER_LOCK_DEADLOCK +--error 0,ER_LOCK_DEADLOCK,ER_LOCK_WAIT_TIMEOUT ALTER TABLE t1 DROP PARTITION rx201004; ---error 0,ER_LOCK_DEADLOCK +--error 0,ER_LOCK_DEADLOCK,ER_LOCK_WAIT_TIMEOUT ALTER TABLE t1 DROP PARTITION rx201008; SET SESSION wsrep_OSU_METHOD='TOI'; +SET SESSION sql_log_bin = 1; SELECT @@wsrep_OSU_method; --connection node_2 ---error 0,ER_LOCK_DEADLOCK -reap; +--disconnect node_2a ---connection node_3 ---error 0,ER_LOCK_DEADLOCK -reap; - ---connection node_4 ---error 0,ER_LOCK_DEADLOCK +--connection node_1 +--error 0,ER_LOCK_DEADLOCK,ER_LOCK_WAIT_TIMEOUT reap; --connection node_1 DROP TABLE t1; DROP PROCEDURE p1; ---disconnect node_3 ---disconnect node_4 From ef4b59fa5c28c4e59a2c0e538f2fa8a62fcf59b3 Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Fri, 1 Sep 2023 15:04:08 +0200 Subject: [PATCH 4/8] MDEV-32051 Failed to insert streaming client - Deterministic test to reproduce the warning - Update wsrep-lib to fix the issue Signed-off-by: Julius Goryavsky --- .../suite/galera_sr/r/MDEV-32051.result | 38 ++++++++++ mysql-test/suite/galera_sr/t/MDEV-32051.test | 72 +++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 mysql-test/suite/galera_sr/r/MDEV-32051.result create mode 100644 mysql-test/suite/galera_sr/t/MDEV-32051.test diff --git a/mysql-test/suite/galera_sr/r/MDEV-32051.result b/mysql-test/suite/galera_sr/r/MDEV-32051.result new file mode 100644 index 00000000000..2328bdb57b0 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/MDEV-32051.result @@ -0,0 +1,38 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +connection node_1; +SET SESSION wsrep_trx_fragment_size=1; +SET DEBUG_SYNC='wsrep_before_certification SIGNAL before_fragment WAIT_FOR continue'; +INSERT INTO t1 VALUES (2); +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1a; +SET SESSION wsrep_sync_wait=0; +SET DEBUG_SYNC='now WAIT_FOR before_fragment'; +SET GLOBAL wsrep_provider_options = 'dbug=d,before_replicate_sync'; +SET DEBUG_SYNC='now SIGNAL continue'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET DEBUG_SYNC='RESET'; +connection node_2; +TRUNCATE TABLE t1; +connection node_1a; +SET GLOBAL wsrep_provider_options = 'signal=before_replicate_sync'; +SET GLOBAL wsrep_provider_options = 'dbug='; +connection node_1; +SELECT * FROM t1; +f1 +2 +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; +COUNT(*) +0 +connection node_2; +SELECT * FROM t1; +f1 +2 +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; +COUNT(*) +0 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/MDEV-32051.test b/mysql-test/suite/galera_sr/t/MDEV-32051.test new file mode 100644 index 00000000000..bfdea3f13e7 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/MDEV-32051.test @@ -0,0 +1,72 @@ +# +# MDEV-32051 : Failed to insert streaming client +# +# Test outline: +# To reproduce we need a autocommit INSERT with streaming enabled, +# and a conflicting TRUNCATE. +# The INSERT is BF aborted by TRUNCATE during replication of the commit +# fragment, so that the INSERT must be rolled back replayed. During +# replay it fails certification, finally the statement is retried and +# succeeds. If bug is present, the streaming client for the INSERT does +# not get deleted after replay, causing the warning (or assert in debug builds) +# when retrying attempts to create the same streaming client with the same id. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/galera_have_debug_sync.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); + +# +# Issue an INSERT and block it right before certification +# of the commit fragment. This is needed to setup for +# before_replicate_sync in galera, to make sure we catch +# the commit fragment. +# +--connection node_1 +SET SESSION wsrep_trx_fragment_size=1; +SET DEBUG_SYNC='wsrep_before_certification SIGNAL before_fragment WAIT_FOR continue'; +--send INSERT INTO t1 VALUES (2) + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +SET SESSION wsrep_sync_wait=0; +SET DEBUG_SYNC='now WAIT_FOR before_fragment'; +--let galera_sync_point = before_replicate_sync +--source include/galera_set_sync_point.inc +SET DEBUG_SYNC='now SIGNAL continue'; +--source include/galera_wait_sync_point.inc +SET DEBUG_SYNC='RESET'; + +# +# Commit fragment of INSERT is now parked in galera side +# before replication. Issue the conflicting DDL +# +--connection node_2 +TRUNCATE TABLE t1; + +--connection node_1a +--source include/galera_signal_sync_point.inc +--source include/galera_clear_sync_point.inc + +# INSERT is first aborted, but ultimately succeeds because of wsrep_autocommit_retry +# If bug is present: +# [Warning] WSREP: Failed to insert streaming client +# server_state.cpp:1152: void wsrep::server_state::start_streaming_client(wsrep::client_state*): Assertion `0' failed. +--connection node_1 +--reap + +SELECT * FROM t1; +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; + +--connection node_2 + +SELECT * FROM t1; +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; + + +DROP TABLE t1; From 1adfdfbd9004848a12c2033093afad88fb243447 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 12 Sep 2023 00:38:48 +0200 Subject: [PATCH 5/8] galera: wsrep-lib sumbodule update --- wsrep-lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wsrep-lib b/wsrep-lib index 173693f2eeb..151d4f8591d 160000 --- a/wsrep-lib +++ b/wsrep-lib @@ -1 +1 @@ -Subproject commit 173693f2eeb61054424233fe85fde4086bed36be +Subproject commit 151d4f8591d26068afda997fb0d1f66b2f7f1964 From 5fe8d0d559eec0ec04a9d8ef679fa9c4eb308ff6 Mon Sep 17 00:00:00 2001 From: Oleg Smirnov Date: Wed, 12 Jul 2023 19:50:20 +0700 Subject: [PATCH 6/8] MDEV-31315 Add client_ed25519.dll to the list of plugins shipped with HeidiSQL There is a list of plugins in the WiX configuration file for HeidiSQL, and the installer only installs DLLs from that list although the HeidiSQL portable archive may include other plugins. This commit adds client_ed25519.dll to this list and also rearranges the list alphabetically, so it is easier to verify its contents --- win/packaging/heidisql.wxi.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/packaging/heidisql.wxi.in b/win/packaging/heidisql.wxi.in index 831efb6971f..03d5b579651 100644 --- a/win/packaging/heidisql.wxi.in +++ b/win/packaging/heidisql.wxi.in @@ -8,7 +8,7 @@ Win64="no" /> - + From 1831f8e4d7c098c51e9fe3174709f8e78456dba7 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 6 Jul 2023 16:47:39 +1000 Subject: [PATCH 7/8] MDEV-31369 Disable TLS v1.0 and 1.1 for MariaDB Remove TLSv1.1 from the default tls_version system variable. Output a warning if TLSv1.0 or TLSv1.1 are selected. Thanks Tingyao Nian for the feature request. --- mysql-test/main/ssl_cipher.result | 2 ++ mysql-test/main/ssl_cipher.test | 6 ++++++ mysql-test/main/tls_version.result | 2 ++ mysql-test/main/tls_version.test | 5 +++++ mysql-test/main/tls_version1.result | 2 ++ mysql-test/main/tls_version1.test | 5 +++++ sql/mysqld.cc | 2 ++ sql/sys_vars.cc | 2 +- 8 files changed, 25 insertions(+), 1 deletion(-) diff --git a/mysql-test/main/ssl_cipher.result b/mysql-test/main/ssl_cipher.result index bd5b34347fe..9308f0f9833 100644 --- a/mysql-test/main/ssl_cipher.result +++ b/mysql-test/main/ssl_cipher.result @@ -66,3 +66,5 @@ Variable_name Value Ssl_cipher_list AES128-SHA disconnect ssl_con; connection default; +call mtr.add_suppression("TLSv1.0 and TLSv1.1 are insecure"); +FOUND 2 /TLSv1.0 and TLSv1.1 are insecure/ in mysqld.1.err diff --git a/mysql-test/main/ssl_cipher.test b/mysql-test/main/ssl_cipher.test index 2ca18df1f20..3a54aca5145 100644 --- a/mysql-test/main/ssl_cipher.test +++ b/mysql-test/main/ssl_cipher.test @@ -101,3 +101,9 @@ SHOW STATUS LIKE 'Ssl_cipher'; SHOW STATUS LIKE 'Ssl_cipher_list'; disconnect ssl_con; connection default; + +# MDEV-31369 Disable TLS v1.0 and 1.1 for MariaDB +call mtr.add_suppression("TLSv1.0 and TLSv1.1 are insecure"); +--let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err +--let SEARCH_PATTERN= TLSv1.0 and TLSv1.1 are insecure +--source include/search_pattern_in_file.inc diff --git a/mysql-test/main/tls_version.result b/mysql-test/main/tls_version.result index d1b20a121fe..3d9565983e8 100644 --- a/mysql-test/main/tls_version.result +++ b/mysql-test/main/tls_version.result @@ -12,3 +12,5 @@ Variable_name Value Ssl_version TLSv1.2 @@tls_version TLSv1.1,TLSv1.2 +call mtr.add_suppression("TLSv1.0 and TLSv1.1 are insecure"); +FOUND 1 /TLSv1.0 and TLSv1.1 are insecure/ in mysqld.1.err diff --git a/mysql-test/main/tls_version.test b/mysql-test/main/tls_version.test index 875fed19821..50448f898e9 100644 --- a/mysql-test/main/tls_version.test +++ b/mysql-test/main/tls_version.test @@ -22,3 +22,8 @@ # finally list available protocols --exec $MYSQL --host=localhost --ssl -e "select @@tls_version;" +call mtr.add_suppression("TLSv1.0 and TLSv1.1 are insecure"); +--let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err +--let SEARCH_PATTERN= TLSv1.0 and TLSv1.1 are insecure +--source include/search_pattern_in_file.inc + diff --git a/mysql-test/main/tls_version1.result b/mysql-test/main/tls_version1.result index 8333bfec159..caabed832cb 100644 --- a/mysql-test/main/tls_version1.result +++ b/mysql-test/main/tls_version1.result @@ -4,3 +4,5 @@ Variable_name Value Ssl_version TLSv1 @@tls_version TLSv1.0 +call mtr.add_suppression("TLSv1.0 and TLSv1.1 are insecure"); +FOUND 1 /TLSv1.0 and TLSv1.1 are insecure/ in mysqld.1.err diff --git a/mysql-test/main/tls_version1.test b/mysql-test/main/tls_version1.test index d38de876ba3..788284c36df 100644 --- a/mysql-test/main/tls_version1.test +++ b/mysql-test/main/tls_version1.test @@ -10,3 +10,8 @@ --exec $MYSQL --host=localhost --ssl --tls_version=TLSv1.0 -e "show status like 'ssl_version';" --exec $MYSQL --host=localhost --ssl -e "select @@tls_version;" +call mtr.add_suppression("TLSv1.0 and TLSv1.1 are insecure"); +--let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err +--let SEARCH_PATTERN= TLSv1.0 and TLSv1.1 are insecure +--source include/search_pattern_in_file.inc + diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 2a8e4b4c16b..93e9ac54550 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4500,6 +4500,8 @@ static int init_common_variables() return 1; } + if (tls_version & (VIO_TLSv1_0 + VIO_TLSv1_1)) + sql_print_warning("TLSv1.0 and TLSv1.1 are insecure and should not be used for tls_version"); #ifdef WITH_WSREP /* diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 47ffe467a8c..a2101b94a24 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -3623,7 +3623,7 @@ static Sys_var_set Sys_tls_version( "TLS protocol version for secure connections.", READ_ONLY GLOBAL_VAR(tls_version), CMD_LINE(REQUIRED_ARG), tls_version_names, - DEFAULT(VIO_TLSv1_1 | VIO_TLSv1_2 | VIO_TLSv1_3)); + DEFAULT(VIO_TLSv1_2 | VIO_TLSv1_3)); static Sys_var_mybool Sys_standard_compliant_cte( "standard_compliant_cte", From 1407f99963481d2c59c109642a6ed81a1ae201b4 Mon Sep 17 00:00:00 2001 From: Brandon Nesterenko Date: Wed, 13 Sep 2023 09:09:41 -0600 Subject: [PATCH 8/8] MDEV-31177: SHOW SLAVE STATUS Last_SQL_Errno Race Condition on Errored Slave Restart The SQL thread and a user connection executing SHOW SLAVE STATUS have a race condition on Last_SQL_Errno, such that a slave which previously errored and stopped, on its next start, SHOW SLAVE STATUS can show that the SQL Thread is running while the previous error is also showing. The fix is to move when the last error is cleared when the SQL thread starts to occur before setting the status of Slave_SQL_Running. Thanks to Kristian Nielson for his work diagnosing the problem! Reviewed By: ============ Andrei Elkin Kristian Nielson --- .../r/rpl_sql_thd_start_errno_cleared.result | 48 ++++++++++ .../t/rpl_sql_thd_start_errno_cleared.test | 93 +++++++++++++++++++ sql/slave.cc | 34 ++++--- 3 files changed, 164 insertions(+), 11 deletions(-) create mode 100644 mysql-test/suite/rpl/r/rpl_sql_thd_start_errno_cleared.result create mode 100644 mysql-test/suite/rpl/t/rpl_sql_thd_start_errno_cleared.test diff --git a/mysql-test/suite/rpl/r/rpl_sql_thd_start_errno_cleared.result b/mysql-test/suite/rpl/r/rpl_sql_thd_start_errno_cleared.result new file mode 100644 index 00000000000..b14f7b01541 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_sql_thd_start_errno_cleared.result @@ -0,0 +1,48 @@ +include/master-slave.inc +[connection master] +connection master; +create table t1 (a int primary key, b int) engine=innodb; +insert t1 values (1,1); +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +include/stop_slave.inc +set @save_innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout; +set @save_slave_trans_retries= @@global.slave_transaction_retries; +set @@global.innodb_lock_wait_timeout= 1; +set @@global.slave_transaction_retries= 0; +connection master; +update t1 set b=b+10 where a=1; +include/save_master_gtid.inc +connection slave1; +BEGIN; +SELECT * FROM t1 WHERE a=1 FOR UPDATE; +a b +1 1 +connection slave; +include/start_slave.inc +include/wait_for_slave_sql_error.inc [errno=1205] +connection slave1; +ROLLBACK; +connection slave; +set @save_dbug = @@global.debug_dbug; +set @@global.debug_dbug= "+d,delay_sql_thread_after_release_run_lock"; +include/start_slave.inc +set debug_sync= "now wait_for sql_thread_run_lock_released"; +# Validating that the SQL thread is running.. +# ..success +# Validating that Last_SQL_Errno is cleared.. +# ..success +set debug_sync= "now signal sql_thread_continue"; +set @@global.debug_dbug= @saved_dbug; +set debug_sync= "RESET"; +# Cleanup +connection master; +drop table t1; +connection slave; +include/stop_slave.inc +set @@global.innodb_lock_wait_timeout= @save_innodb_lock_wait_timeout; +set @@global.slave_transaction_retries= @save_slave_trans_retries; +include/start_slave.inc +include/rpl_end.inc +# End of rpl_sql_thd_start_errno_cleared.test diff --git a/mysql-test/suite/rpl/t/rpl_sql_thd_start_errno_cleared.test b/mysql-test/suite/rpl/t/rpl_sql_thd_start_errno_cleared.test new file mode 100644 index 00000000000..f6dcfd91409 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_sql_thd_start_errno_cleared.test @@ -0,0 +1,93 @@ +# +# Ensure that when the slave restarts, the last error code displayed by +# SHOW SLAVE STATUS is cleared before Slave_SQL_Running is set. +# +# To ensure that, this test uses the debug_sync mechanism to pause an errored +# and restarting slave's SQL thread after it has set its running state to YES, +# and then ensures that Last_SQL_Errno is 0. The slave error is a forced innodb +# row lock timeout. +# +# +# References +# MDEV-31177: SHOW SLAVE STATUS Last_SQL_Errno Race Condition on Errored +# Slave Restart +# +source include/have_binlog_format_row.inc; +source include/have_innodb.inc; +source include/have_debug.inc; +source include/have_debug_sync.inc; +source include/master-slave.inc; + +--connection master +create table t1 (a int primary key, b int) engine=innodb; +insert t1 values (1,1); +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc +set @save_innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout; +set @save_slave_trans_retries= @@global.slave_transaction_retries; +set @@global.innodb_lock_wait_timeout= 1; +set @@global.slave_transaction_retries= 0; + +--connection master +update t1 set b=b+10 where a=1; +--source include/save_master_gtid.inc + +--connection slave1 +BEGIN; +--eval SELECT * FROM t1 WHERE a=1 FOR UPDATE + +--connection slave +--source include/start_slave.inc + +--let $slave_sql_errno= 1205 +--source include/wait_for_slave_sql_error.inc + +--connection slave1 +ROLLBACK; + +--connection slave +set @save_dbug = @@global.debug_dbug; +set @@global.debug_dbug= "+d,delay_sql_thread_after_release_run_lock"; +--source include/start_slave.inc +set debug_sync= "now wait_for sql_thread_run_lock_released"; + +--let $sql_running = query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, 1) +--echo # Validating that the SQL thread is running.. +if (`SELECT strcmp("$sql_running", "YES") != 0`) +{ + --echo # ..failed + --echo # Slave_SQL_Running: $sql_running + --die Slave SQL thread is not running +} +--echo # ..success + +--let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1) +--echo # Validating that Last_SQL_Errno is cleared.. +if ($last_error) +{ + --echo # ..failed + --echo # Last_SQL_Errno: $last_error + --die SHOW SLAVE STATUS shows the error from the last session on startup +} +--echo # ..success + +set debug_sync= "now signal sql_thread_continue"; + +set @@global.debug_dbug= @saved_dbug; +set debug_sync= "RESET"; + +--echo # Cleanup +--connection master +drop table t1; + +--connection slave +--source include/stop_slave.inc +set @@global.innodb_lock_wait_timeout= @save_innodb_lock_wait_timeout; +set @@global.slave_transaction_retries= @save_slave_trans_retries; +--source include/start_slave.inc + +--source include/rpl_end.inc +--echo # End of rpl_sql_thd_start_errno_cleared.test diff --git a/sql/slave.cc b/sql/slave.cc index cdb16f873c3..44fcb93a3a9 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -5236,6 +5236,19 @@ pthread_handler_t handle_slave_sql(void *arg) DBUG_ASSERT(rli->inited); DBUG_ASSERT(rli->mi == mi); + + /* + Reset errors for a clean start (otherwise, if the master is idle, the SQL + thread may execute no Query_log_event, so the error will remain even + though there's no problem anymore). Do not reset the master timestamp + (imagine the slave has caught everything, the STOP SLAVE and START SLAVE: + as we are not sure that we are going to receive a query, we want to + remember the last master timestamp (to say how many seconds behind we are + now. + But the master timestamp is reset by RESET SLAVE & CHANGE MASTER. + */ + rli->clear_error(); + mysql_mutex_lock(&rli->run_lock); DBUG_ASSERT(!rli->slave_running); errmsg= 0; @@ -5310,17 +5323,16 @@ pthread_handler_t handle_slave_sql(void *arg) mysql_mutex_unlock(&rli->run_lock); mysql_cond_broadcast(&rli->start_cond); - /* - Reset errors for a clean start (otherwise, if the master is idle, the SQL - thread may execute no Query_log_event, so the error will remain even - though there's no problem anymore). Do not reset the master timestamp - (imagine the slave has caught everything, the STOP SLAVE and START SLAVE: - as we are not sure that we are going to receive a query, we want to - remember the last master timestamp (to say how many seconds behind we are - now. - But the master timestamp is reset by RESET SLAVE & CHANGE MASTER. - */ - rli->clear_error(); +#ifdef ENABLED_DEBUG_SYNC + DBUG_EXECUTE_IF("delay_sql_thread_after_release_run_lock", { + const char act[]= "now " + "signal sql_thread_run_lock_released " + "wait_for sql_thread_continue"; + DBUG_ASSERT(debug_sync_service); + DBUG_ASSERT(!debug_sync_set_action(current_thd, STRING_WITH_LEN(act))); + };); +#endif + rli->parallel.reset(); //tell the I/O thread to take relay_log_space_limit into account from now on