From 3b80d23d022f462c34cee2ec33cdc46162eb2656 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Sun, 2 Jun 2024 13:17:51 +0400 Subject: [PATCH 1/5] mtr --skip-not-found did not skip suites --skip-not-found switch tells mtr to skip not found tests instead of aborting. But it failed to skip the test if the suite name was not found. This problem also made the *last-N-failed builbot builders fail to run `mtr --skip-not-found` if the last commit removed a file in the mysql-test/include/ directory. This commit fixes it, now the not found test is properly skipped, no matter what component of the test name was not found: $ ./mtr main.foo --skip-not-found foo.main ... ============================================================================== TEST WORKER RESULT TIME (ms) or COMMENT -------------------------------------------------------------------------- foo.main [ skipped ] not found main.foo [ skipped ] not found -------------------------------------------------------------------------- --- mysql-test/lib/mtr_cases.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index c72717578cb..d9ab10b60f6 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -398,7 +398,8 @@ sub collect_suite_name($$) { my @dirs = my_find_dir(dirname($::glob_mysql_test_dir), ["mysql-test/suite", @plugin_suitedirs ], - $suitename); + $suitename, + $::opt_skip_not_found ? NOT_REQUIRED : undef); # # if $suitename contained wildcards, we'll have many suites and # their overlays here. Let's group them appropriately. From 90d376e01710fbc6f7e9eeef3f8c4653d5d4d82e Mon Sep 17 00:00:00 2001 From: Dave Gosselin Date: Mon, 13 May 2024 10:36:11 -0400 Subject: [PATCH 2/5] MDEV-34129 mariadb-install-db appears to hang on macOS Immediately close down the signal handler loop when we decide to break connections as it's the start of process termination anyway, and there's no need to wait once we've invoked break_connections. --- sql/mysqld.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index cfc16209251..a9960400c17 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2953,6 +2953,15 @@ static void start_signal_handler(void) DBUG_VOID_RETURN; } +/** Called only from signal_hand function. */ +static void* exit_signal_handler() +{ + my_thread_end(); + signal_thread_in_use= 0; + pthread_exit(0); // Safety + return nullptr; // Avoid compiler warnings +} + /** This threads handles all signals and alarms. */ /* ARGSUSED */ @@ -3013,10 +3022,7 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused))) if (abort_loop) { DBUG_PRINT("quit",("signal_handler: calling my_thread_end()")); - my_thread_end(); - signal_thread_in_use= 0; - pthread_exit(0); // Safety - return 0; // Avoid compiler warnings + return exit_signal_handler(); } switch (sig) { case SIGTERM: @@ -3035,6 +3041,7 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused))) PSI_CALL_delete_current_thread(); my_sigset(sig, SIG_IGN); break_connect_loop(); // MIT THREAD has a alarm thread + return exit_signal_handler(); } break; case SIGHUP: From 40dd5b8676c96593f0f234ec5ced7674fc4d01f6 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 10 Jun 2024 20:38:49 +0200 Subject: [PATCH 3/5] fix the test for --view --- mysql-test/main/func_json.test | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index 9abdded34d2..a1ac2368014 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -1155,7 +1155,9 @@ SELECT JSON_REMOVE('{"A": { "B": 1 }}', '$.A.B.C.D'); SET @save_collation_connection= @@collation_connection; SET collation_connection='utf16_bin'; +--disable_service_connection SELECT JSON_EXTRACT('{"a": 1,"b": 2}','$.a'); +--enable_service_connection SET @@collation_connection= @save_collation_connection; From d524cb5b3ddf4dfcaf01c989b1d6fc76be854e15 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 4 Jun 2024 14:07:12 +1000 Subject: [PATCH 4/5] MDEV-34002 Initialise fields in spider_db_handler Otherwise it may result in nonsensical values like 190 for a boolean. --- .../spider/mysql-test/spider/bugfix/r/mdev_34002.result | 9 +++++++++ .../spider/mysql-test/spider/bugfix/t/mdev_34002.test | 7 +++++++ storage/spider/spd_db_include.h | 7 ++----- 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 storage/spider/mysql-test/spider/bugfix/r/mdev_34002.result create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_34002.test diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_34002.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_34002.result new file mode 100644 index 00000000000..7e266156e0a --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_34002.result @@ -0,0 +1,9 @@ +INSTALL PLUGIN Spider SONAME 'ha_spider.so'; +CREATE TABLE t (c DATE, c2 VARCHAR(1025) CHARACTER SET utf8mb3, UNIQUE KEY k(c2)) ENGINE=SPIDER; +UPDATE t SET c='2'; +ERROR HY000: Unable to connect to foreign data source: localhost +drop table t; +Warnings: +Warning 1620 Plugin is busy and will be uninstalled on shutdown +Note 1305 PLUGIN SPIDER_ALLOC_MEM does not exist +Note 1305 PLUGIN SPIDER_WRAPPER_PROTOCOLS does not exist diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_34002.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_34002.test new file mode 100644 index 00000000000..575a306589d --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_34002.test @@ -0,0 +1,7 @@ +INSTALL PLUGIN Spider SONAME 'ha_spider.so'; +CREATE TABLE t (c DATE, c2 VARCHAR(1025) CHARACTER SET utf8mb3, UNIQUE KEY k(c2)) ENGINE=SPIDER; +--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE +UPDATE t SET c='2'; +drop table t; +--disable_query_log +--source ../../include/clean_up_spider.inc diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index 4f25b0a2fe1..0632a816995 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -1136,11 +1136,8 @@ public: ha_spider *spider; spider_db_share *db_share; int first_link_idx; -#ifdef SPIDER_HAS_GROUP_BY_HANDLER - SPIDER_LINK_IDX_CHAIN *link_idx_chain; -#endif - bool strict_group_by; - bool no_where_cond; + bool strict_group_by= false; + bool no_where_cond= false; spider_db_handler(ha_spider *spider, spider_db_share *db_share) : dbton_id(db_share->dbton_id), spider(spider), db_share(db_share), first_link_idx(-1) {} From f2eda615798d6d879a913a44c22d5dd0fc7ed8c9 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 10 Jun 2024 21:56:22 +0200 Subject: [PATCH 5/5] MDEV-33616 workaround libmariadb bug : mysql_errno = 0 on failed connection The bug can happens on macOS, if server closes the socket without sending error packet to client. Closing the socket on server side is legitimate, and happen e.g when write timeout occurs, perhaps also other situations. However mysqltest is not prepared to handle mysql_errno 0, and erroneously thinks connection was successfully established. The fix/workaround in mysqltest is to treat client failure with mysql_errno 0 the same as CR_SERVER_LOST (generic client-side communication error) The real fix in client library would ensure that mysql_errno is set on errors. --- client/mysqltest.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index fa542fe7787..7a31c6d6802 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -5908,14 +5908,20 @@ int connect_n_handle_errors(struct st_command *command, stay clear of trying to work out which exact user-limit was exceeded. */ + auto my_err= mysql_errno(con); + if(my_err == 0) + { + /* Workaround client library bug, not indicating connection error. */ + my_err= CR_SERVER_LOST; + } - if (((mysql_errno(con) == ER_TOO_MANY_USER_CONNECTIONS) || - (mysql_errno(con) == ER_USER_LIMIT_REACHED)) && + if (((my_err == ER_TOO_MANY_USER_CONNECTIONS) || + (my_err == ER_USER_LIMIT_REACHED)) && (failed_attempts++ < opt_max_connect_retries)) { int i; - i= match_expected_error(command, mysql_errno(con), mysql_sqlstate(con)); + i= match_expected_error(command, my_err, mysql_sqlstate(con)); if (i >= 0) goto do_handle_error; /* expected error, handle */ @@ -5925,9 +5931,9 @@ int connect_n_handle_errors(struct st_command *command, } do_handle_error: - var_set_errno(mysql_errno(con)); - handle_error(command, mysql_errno(con), mysql_error(con), - mysql_sqlstate(con), ds); + var_set_errno(my_err); + handle_error(command, my_err, mysql_error(con), + mysql_sqlstate(con), ds); return 0; /* Not connected */ }