From 2cd6afb08372dac6220f69fbb6b44d2d2e964cfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Sun, 14 Jun 2020 10:18:07 +0300 Subject: MDEV-22889: Disable innodb.innodb_force_recovery_rollback The test case that was added for MDEV-21217 (commit b68f1d847f1fc00eed795e20162effc8fbc4119b) should have only two possible outcomes for the locking SELECT statement: (1) The statement is blocked, and the test will eventually fail with a lock wait timeout. This is what I observed when the code fix for MDEV-21217 was missing. (2) The lock conflict will ensure that the statement will execute after the rollback has completed, and an empty table will be observed. This is the expected outcome with the recovery fix. What occasionally happens (in some of our CI environments only, so far) is that the locking SELECT will return all 1,000 rows of the table that had been inserted by the transaction that was never supposed to be committed. One possibility is that the transaction was unexpectedly committed when the server was killed. Let us disable the test until the reason of the failure has been determined and addressed. --- mysql-test/suite/innodb/disabled.def | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/suite/innodb/disabled.def b/mysql-test/suite/innodb/disabled.def index 35c941f8af7..4484417afce 100644 --- a/mysql-test/suite/innodb/disabled.def +++ b/mysql-test/suite/innodb/disabled.def @@ -11,3 +11,4 @@ ############################################################################## create-index-debug : MDEV-13680 InnoDB may crash when btr_page_alloc() fails +innodb_force_recovery_rollback : MDEV-22889 InnoDB occasionally breaks ACID -- cgit v1.2.1 From 9bdf35e90f36d9be8cc7591e2ed5e62feadc5515 Mon Sep 17 00:00:00 2001 From: Vlad Lesin Date: Mon, 8 Jun 2020 11:45:56 +0300 Subject: MDEV-18215: mariabackup does not report unknown command line options MDEV-21298: mariabackup doesn't read from the [mariadbd] and [mariadbd-X.Y] server option groups from configuration files MDEV-21301: mariabackup doesn't read [mariadb-backup] option group in configuration file All three issues require to change the same code, that is why their fixes are joined in one commit. The fix is in invoking load_defaults_or_exit() and handle_options() for backup-specific groups separately from client-server groups to let the last handle_options() call fail on unknown backup-specific options. The order of options procesing is the following: 1) Load server groups and process server options, ignore unknown options 2) Load client groups and process client options, ignore unknown options 3) Load backup groups and process client-server options, exit on unknown option 4) Process --mysqld-args command line options, ignore unknown options New global flag my_handle_options_init_variables was added to have ability to invoke handle_options() for the same allowed options set several times without re-initialising previously set option values. --password value destroying is moved from option processing callback to mariabackup's handle_options() function to have ability to invoke server's handle_options() several times for the same possible allowed options set. Galera invokes wsrep_sst_mariabackup.sh with mysqld command line options to configure mariabackup as close to the server as possible. It is not known what server options are supported by mariabackup when the script is invoked. That is why new mariabackup option "--mysqld-args" is added, all unknown options that follow this option will be silently ignored. wsrep_sst_mariabackup.sh was also changed to: - use "--mysqld-args" mariabackup option to pass mysqld options, - remove deprecated innobackupex mode, - remove unsupported mariabackup options: --encrypt --encrypt-key --rebuild-indexes --rebuild-threads --- extra/mariabackup/innobackupex.cc | 14 +- extra/mariabackup/xtrabackup.cc | 248 ++++++++++++++------- include/my_getopt.h | 1 + .../suite/mariabackup/apply-log-only-incr.test | 4 +- mysql-test/suite/mariabackup/apply-log-only.test | 2 +- mysql-test/suite/mariabackup/binlog.test | 2 +- .../mariabackup/incremental_ddl_before_backup.test | 2 +- .../mariabackup/incremental_ddl_during_backup.test | 2 +- mysql-test/suite/mariabackup/options_check.result | 6 + mysql-test/suite/mariabackup/options_check.test | 53 +++++ mysql-test/suite/mariabackup/undo_space_id.test | 2 +- .../suite/mariabackup/xb_fulltext_encrypted.test | 2 +- mysql-test/suite/mariabackup/xb_partition.test | 2 +- mysys/my_getopt.c | 9 +- scripts/wsrep_sst_mariabackup.sh | 38 +--- 15 files changed, 252 insertions(+), 135 deletions(-) create mode 100644 mysql-test/suite/mariabackup/options_check.result create mode 100644 mysql-test/suite/mariabackup/options_check.test diff --git a/extra/mariabackup/innobackupex.cc b/extra/mariabackup/innobackupex.cc index f0e9c06b355..bc944c18659 100644 --- a/extra/mariabackup/innobackupex.cc +++ b/extra/mariabackup/innobackupex.cc @@ -112,6 +112,8 @@ bool ibx_partial_backup = false; char *ibx_position_arg = NULL; char *ibx_backup_directory = NULL; +extern bool xb_opt_destroy_password; + /* copy of proxied xtrabackup options */ my_bool ibx_xb_close_files; const char *ibx_xtrabackup_compress_alg; @@ -771,17 +773,7 @@ ibx_get_one_option(int optid, xtrabackup_compress = TRUE; break; case 'p': - if (argument) - { - char *start = argument; - my_free(opt_ibx_password); - opt_ibx_password= my_strdup(argument, MYF(MY_FAE)); - /* Destroy argument */ - while (*argument) - *argument++= 'x'; - if (*start) - start[1]=0 ; - } + opt_ibx_password= argument; break; } return(0); diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 852ef4efe56..19058398258 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -118,6 +118,7 @@ my_bool xtrabackup_copy_back; my_bool xtrabackup_move_back; my_bool xtrabackup_decrypt_decompress; my_bool xtrabackup_print_param; +my_bool xtrabackup_mysqld_args; my_bool xtrabackup_export; @@ -833,7 +834,8 @@ enum options_xtrabackup OPT_LOCK_DDL_PER_TABLE, OPT_ROCKSDB_DATADIR, OPT_BACKUP_ROCKSDB, - OPT_XTRA_CHECK_PRIVILEGES + OPT_XTRA_CHECK_PRIVILEGES, + OPT_XTRA_MYSQLD_ARGS }; struct my_option xb_client_options[]= { @@ -1233,7 +1235,6 @@ struct my_option xb_client_options[]= { #define MYSQL_CLIENT #include "sslopt-longopts.h" #undef MYSQL_CLIENT - {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}}; uint xb_client_options_count = array_elements(xb_client_options); @@ -1450,6 +1451,13 @@ struct my_option xb_server_options[] = &opt_check_privileges, &opt_check_privileges, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 }, + {"mysqld-args", OPT_XTRA_MYSQLD_ARGS, + "All arguments that follow this argument are considered as server " + "options, and if some of them are not supported by mariabackup, they " + "will be ignored.", + (G_PTR *) &xtrabackup_mysqld_args, (G_PTR *) &xtrabackup_mysqld_args, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; @@ -1617,24 +1625,11 @@ end: return err; } +static const char *xb_client_default_groups[]= { + "client", "client-server", "client-mariadb", "mariadb-client", 0, 0, 0}; -static const char *xb_client_default_groups[]={ - "xtrabackup", "mariabackup", - "client", "client-server", - "client-mariadb", - 0, 0, 0 -}; - -static const char *xb_server_default_groups[]={ - "xtrabackup", "mariabackup", - "mysqld", "server", MYSQL_BASE_VERSION, - "mariadb", MARIADB_BASE_VERSION, - "client-server", - #ifdef WITH_WSREP - "galera", - #endif - 0, 0, 0 -}; +static const char *backup_default_groups[]= { + "xtrabackup", "mariabackup", "mariadb-backup", 0, 0, 0}; static void print_version(void) { @@ -1662,7 +1657,7 @@ GNU General Public License for more details.\n\ You can download full text of the license on http://www.gnu.org/licenses/gpl-2.0.txt\n"); printf("Usage: %s [--defaults-file=#] [--backup | --prepare | --copy-back | --move-back] [OPTIONS]\n",my_progname); - print_defaults("my", xb_server_default_groups); + print_defaults("my", load_default_groups); my_print_help(xb_client_options); my_print_help(xb_server_options); my_print_variables(xb_server_options); @@ -1798,15 +1793,7 @@ xb_get_one_option(int optid, } break; case 'p': - if (argument) - { - char *start= argument; - my_free(opt_password); - opt_password= my_strdup(argument, MYF(MY_FAE)); - while (*argument) *argument++= 'x'; // Destroy argument - if (*start) - start[1]=0 ; - } + opt_password = argument; break; case OPT_PROTOCOL: if (argument) @@ -5990,11 +5977,23 @@ void setup_error_messages() die("could not initialize error messages"); } -void -handle_options(int argc, char **argv, char ***argv_client, char ***argv_server) +/** Handle mariabackup options. The options are handled with the following +order: + +1) Load server groups and process server options, ignore unknown options +2) Load client groups and process client options, ignore unknown options +3) Load backup groups and process client-server options, exit on unknown option +4) Process --mysqld-args options, ignore unknown options + +@param[in] argc arguments count +@param[in] argv arguments array +@param[out] argv_server server options including loaded from server groups +@param[out] argv_client client options including loaded from client groups +@param[out] argv_backup backup options including loaded from backup groups */ +void handle_options(int argc, char **argv, char ***argv_server, + char ***argv_client, char ***argv_backup) { /* Setup some variables for Innodb.*/ - srv_operation = SRV_OPERATION_RESTORE; files_charset_info = &my_charset_utf8_general_ci; @@ -6021,49 +6020,64 @@ handle_options(int argc, char **argv, char ***argv_client, char ***argv_server) bool prepare = false; char conf_file[FN_REFLEN]; - int argc_client = argc; - int argc_server = argc; - - /* scan options for group and config file to load defaults from */ - for (i = 1; i < argc; i++) { - - char *optend = strcend(argv[i], '='); - - if (strncmp(argv[i], "--defaults-group", - optend - argv[i]) == 0) { - defaults_group = optend + 1; - append_defaults_group(defaults_group, - xb_server_default_groups, - array_elements(xb_server_default_groups)); - } - if (strncmp(argv[i], "--login-path", - optend - argv[i]) == 0) { - append_defaults_group(optend + 1, - xb_client_default_groups, - array_elements(xb_client_default_groups)); - } + // array_elements() will not work for load_defaults, as it is defined + // as external symbol, so let's use dynamic array to have ability to + // add new server default groups + std::vector server_default_groups; - if (!strncmp(argv[i], "--prepare", - optend - argv[i])) { - prepare = true; - } + for (const char **default_group= load_default_groups; *default_group; + ++default_group) + server_default_groups.push_back(*default_group); - if (!strncmp(argv[i], "--apply-log", - optend - argv[i])) { - prepare = true; - } + std::vector mysqld_args; + std::vector mariabackup_args; + mysqld_args.push_back(argv[0]); + mariabackup_args.push_back(argv[0]); - if (!strncmp(argv[i], "--target-dir", - optend - argv[i]) && *optend) { - target_dir = optend + 1; - } + /* scan options for group and config file to load defaults from */ + for (i= 1; i < argc; i++) + { + char *optend= strcend(argv[i], '='); + if (mysqld_args.size() > 1 || + strncmp(argv[i], "--mysqld-args", optend - argv[i]) == 0) + { + mysqld_args.push_back(argv[i]); + continue; + } + else + mariabackup_args.push_back(argv[i]); - if (!*optend && argv[i][0] != '-') { - target_dir = argv[i]; - } - } + if (strncmp(argv[i], "--defaults-group", optend - argv[i]) == 0) + { + defaults_group= optend + 1; + server_default_groups.push_back(defaults_group); + } + else if (strncmp(argv[i], "--login-path", optend - argv[i]) == 0) + { + append_defaults_group(optend + 1, xb_client_default_groups, + array_elements(xb_client_default_groups)); + } + else if (!strncmp(argv[i], "--prepare", optend - argv[i])) + { + prepare= true; + } + else if (!strncmp(argv[i], "--apply-log", optend - argv[i])) + { + prepare= true; + } + else if (!strncmp(argv[i], "--target-dir", optend - argv[i]) && + *optend) + { + target_dir= optend + 1; + } + else if (!*optend && argv[i][0] != '-') + { + target_dir= argv[i]; + } + } + server_default_groups.push_back(NULL); snprintf(conf_file, sizeof(conf_file), "my"); if (prepare && target_dir) { @@ -6079,10 +6093,16 @@ handle_options(int argc, char **argv, char ***argv_client, char ***argv_server) } } - *argv_client = argv; - *argv_server = argv; - load_defaults_or_exit(conf_file, xb_server_default_groups, - &argc_server, argv_server); + *argv_client= *argv_server= *argv_backup= &mariabackup_args[0]; + int argc_backup= static_cast(mariabackup_args.size()); + int argc_client= argc_backup; + int argc_server= argc_backup; + + /* 1) Load server groups and process server options, ignore unknown + options */ + + load_defaults_or_exit(conf_file, &server_default_groups[0], + &argc_server, argv_server); int n; for (n = 0; (*argv_server)[n]; n++) {}; @@ -6102,7 +6122,6 @@ handle_options(int argc, char **argv, char ***argv_client, char ***argv_server) optp->u_max_value = (G_PTR *) &global_max_value; } - /* Throw a descriptive error if --defaults-file or --defaults-extra-file is not the first command line argument */ for (int i = 2 ; i < argc ; i++) { @@ -6124,6 +6143,9 @@ handle_options(int argc, char **argv, char ***argv_client, char ***argv_server) xb_server_options, xb_get_one_option))) exit(ho_error); + /* 2) Load client groups and process client options, ignore unknown + options */ + load_defaults_or_exit(conf_file, xb_client_default_groups, &argc_client, argv_client); @@ -6131,8 +6153,6 @@ handle_options(int argc, char **argv, char ***argv_client, char ***argv_server) argc_client = n; if (innobackupex_mode && argc_client > 0) { - /* emulate innobackupex script */ - innobackupex_mode = true; if (!ibx_handle_options(&argc_client, argv_client)) { exit(EXIT_FAILURE); } @@ -6143,18 +6163,76 @@ handle_options(int argc, char **argv, char ***argv_client, char ***argv_server) xb_client_options, xb_get_one_option))) exit(ho_error); + /* 3) Load backup groups and process client-server options, exit on + unknown option */ + + load_defaults_or_exit(conf_file, backup_default_groups, &argc_backup, + argv_backup); + for (n= 0; (*argv_backup)[n]; n++) + { + }; + argc_backup= n; + + my_handle_options_init_variables = FALSE; + + if (argc_backup > 0 && + (ho_error= handle_options(&argc_backup, argv_backup, + xb_server_options, xb_get_one_option))) + exit(ho_error); + + /* Add back the program name handle_options removes */ + ++argc_backup; + --(*argv_backup); + + if (innobackupex_mode && argc_backup > 0 && + !ibx_handle_options(&argc_backup, argv_backup)) + exit(EXIT_FAILURE); + + my_getopt_skip_unknown = FALSE; + + if (argc_backup > 0 && + (ho_error= handle_options(&argc_backup, argv_backup, + xb_client_options, xb_get_one_option))) + exit(ho_error); + + if (opt_password) + { + char *argument= opt_password; + char *start= argument; + opt_password= my_strdup(opt_password, MYF(MY_FAE)); + while (*argument) + *argument++= 'x'; // Destroy argument + if (*start) + start[1]= 0; + } + + /* 4) Process --mysqld-args options, ignore unknown options */ + + my_getopt_skip_unknown = TRUE; + + int argc_mysqld = static_cast(mysqld_args.size()); + if (argc_mysqld > 1) + { + char **argv_mysqld= &mysqld_args[0]; + if ((ho_error= handle_options(&argc_mysqld, &argv_mysqld, + xb_server_options, xb_get_one_option))) + exit(ho_error); + } + + my_handle_options_init_variables = TRUE; + /* Reject command line arguments that don't look like options, i.e. are not of the form '-X' (single-character options) or '--option' (long options) */ - for (int i = 0 ; i < argc_client ; i++) { - const char * const opt = (*argv_client)[i]; + for (int i = 0 ; i < argc_backup ; i++) { + const char * const opt = (*argv_backup)[i]; if (strncmp(opt, "--", 2) && !(strlen(opt) == 2 && opt[0] == '-')) { bool server_option = true; - for (int j = 0; j < argc_server; j++) { - if (opt == (*argv_server)[j]) { + for (int j = 0; j < argc_backup; j++) { + if (opt == (*argv_backup)[j]) { server_option = false; break; } @@ -6175,7 +6253,9 @@ static int get_exepath(char *buf, size_t size, const char *argv0); /* ================= main =================== */ int main(int argc, char **argv) { - char **client_defaults, **server_defaults; + char **server_defaults; + char **client_defaults; + char **backup_defaults; if (get_exepath(mariabackup_exe,FN_REFLEN, argv[0])) strncpy(mariabackup_exe,argv[0], FN_REFLEN-1); @@ -6229,7 +6309,8 @@ int main(int argc, char **argv) mysql_mutex_init(key_LOCK_error_log, &LOCK_error_log, MY_MUTEX_INIT_FAST); - handle_options(argc, argv, &client_defaults, &server_defaults); + handle_options(argc, argv, &server_defaults, &client_defaults, + &backup_defaults); #ifndef DBUG_OFF if (dbug_option) { @@ -6246,8 +6327,9 @@ int main(int argc, char **argv) ibx_cleanup(); } - free_defaults(client_defaults); free_defaults(server_defaults); + free_defaults(client_defaults); + free_defaults(backup_defaults); #ifndef DBUG_OFF if (dbug_option) { diff --git a/include/my_getopt.h b/include/my_getopt.h index 72ce03d5654..f0cefb35b87 100644 --- a/include/my_getopt.h +++ b/include/my_getopt.h @@ -106,6 +106,7 @@ extern char *autoset_my_option; extern my_bool my_getopt_print_errors; extern my_bool my_getopt_skip_unknown; extern my_bool my_getopt_prefix_matching; +extern my_bool my_handle_options_init_variables; extern my_error_reporter my_getopt_error_reporter; extern int handle_options (int *argc, char ***argv, diff --git a/mysql-test/suite/mariabackup/apply-log-only-incr.test b/mysql-test/suite/mariabackup/apply-log-only-incr.test index 74ab680d840..c2d23c88a3e 100644 --- a/mysql-test/suite/mariabackup/apply-log-only-incr.test +++ b/mysql-test/suite/mariabackup/apply-log-only-incr.test @@ -36,7 +36,7 @@ connection default; --disable_result_log exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --ftwrl-wait-timeout=5 --ftwrl-wait-threshold=300 --ftwrl-wait-query-type=all --target-dir=$incremental_dir --incremental-basedir=$basedir ; -exec $XTRABACKUP --prepare --verbose --apply-log-only --target-dir=$basedir ; +exec $XTRABACKUP --prepare --verbose --target-dir=$basedir ; --enable_result_log let SEARCH_FILE=$MYSQLTEST_VARDIR/log/current_test; @@ -44,7 +44,7 @@ let SEARCH_FILE=$MYSQLTEST_VARDIR/log/current_test; --source include/search_pattern_in_file.inc --echo # expect NOT FOUND -exec $XTRABACKUP --prepare --verbose --apply-log-only --target-dir=$basedir --incremental-dir=$incremental_dir ; +exec $XTRABACKUP --prepare --verbose --target-dir=$basedir --incremental-dir=$incremental_dir ; --source include/search_pattern_in_file.inc --echo # expect NOT FOUND diff --git a/mysql-test/suite/mariabackup/apply-log-only.test b/mysql-test/suite/mariabackup/apply-log-only.test index 5a3c45f2914..7ffed0719f0 100644 --- a/mysql-test/suite/mariabackup/apply-log-only.test +++ b/mysql-test/suite/mariabackup/apply-log-only.test @@ -11,7 +11,7 @@ INSERT INTO t VALUES(1); exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir; --enable_result_log -exec $XTRABACKUP --prepare --apply-log-only --target-dir=$basedir ; +exec $XTRABACKUP --prepare --target-dir=$basedir ; let SEARCH_FILE=$MYSQLTEST_VARDIR/log/current_test; --let SEARCH_PATTERN= Rolled back recovered transaction diff --git a/mysql-test/suite/mariabackup/binlog.test b/mysql-test/suite/mariabackup/binlog.test index 998397bb495..b2f08c2d7bb 100644 --- a/mysql-test/suite/mariabackup/binlog.test +++ b/mysql-test/suite/mariabackup/binlog.test @@ -12,7 +12,7 @@ SHOW VARIABLES like 'log_bin'; exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir; --enable_result_log -exec $XTRABACKUP --prepare --binlog-info=1 --apply-log-only --target-dir=$basedir ; +exec $XTRABACKUP --prepare --binlog-info=1 --target-dir=$basedir ; let SEARCH_FILE=$MYSQLTEST_VARDIR/log/current_test; --let SEARCH_PATTERN= Last binlog file .*, position .* diff --git a/mysql-test/suite/mariabackup/incremental_ddl_before_backup.test b/mysql-test/suite/mariabackup/incremental_ddl_before_backup.test index 2136771b97e..f243ac1acd9 100644 --- a/mysql-test/suite/mariabackup/incremental_ddl_before_backup.test +++ b/mysql-test/suite/mariabackup/incremental_ddl_before_backup.test @@ -33,7 +33,7 @@ select count(*) from t7; exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir; --echo # XTRABACKUP PREPARE -exec $XTRABACKUP --apply-log-only --prepare --target-dir=$basedir; +exec $XTRABACKUP --prepare --target-dir=$basedir; --echo # XTRABACKUP INCREMENTAL PREPARE exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir; diff --git a/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test b/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test index 60780b13920..fdae90132cc 100644 --- a/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test +++ b/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test @@ -25,7 +25,7 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir --let after_load_tablespaces= --disable_result_log echo # Prepare full backup, apply incremental one; -exec $XTRABACKUP --apply-log-only --prepare --target-dir=$basedir; +exec $XTRABACKUP --prepare --target-dir=$basedir; exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir ; echo # Restore and check results; diff --git a/mysql-test/suite/mariabackup/options_check.result b/mysql-test/suite/mariabackup/options_check.result new file mode 100644 index 00000000000..da44f1dda5f --- /dev/null +++ b/mysql-test/suite/mariabackup/options_check.result @@ -0,0 +1,6 @@ +# Check for unknown options in command-line +# Check for unknown options in "mariabackup" group +# Check for unknown options in "xtrabackup" group +# Check for unknown options in "mariadb-backup" group +# Check for options overwriting +# Check if uknown options that follow --mysqld-args are ingored diff --git a/mysql-test/suite/mariabackup/options_check.test b/mysql-test/suite/mariabackup/options_check.test new file mode 100644 index 00000000000..f4f65fa7eae --- /dev/null +++ b/mysql-test/suite/mariabackup/options_check.test @@ -0,0 +1,53 @@ +--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup +--let $custom_cnf=$MYSQLTEST_VARDIR/tmp/custom_my.cnf + +--echo # Check for unknown options in command-line +--disable_result_log +--error 7 +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --unknown-option=xxx --target-dir=$targetdir; +--error 2 +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --unknown-option --target-dir=$targetdir; +--enable_result_log + +--echo # Check for unknown options in "mariabackup" group +--write_file $custom_cnf +[mariabackup] +unknown-option=XXX +EOF +--error 7 +exec $XTRABACKUP --defaults-file=$custom_cnf --backup --target-dir=$targetdir; +--remove_file $custom_cnf + +--echo # Check for unknown options in "xtrabackup" group +--write_file $custom_cnf +[xtrabackup] +unknown-option=XXX +EOF +--error 7 +exec $XTRABACKUP --defaults-file=$custom_cnf --backup --target-dir=$targetdir; +--remove_file $custom_cnf + +--echo # Check for unknown options in "mariadb-backup" group +--write_file $custom_cnf +[mariadb-backup] +unknown-option=XXX +EOF +--error 7 +exec $XTRABACKUP --defaults-file=$custom_cnf --backup --target-dir=$targetdir; +--remove_file $custom_cnf + +--echo # Check for options overwriting +--write_file $custom_cnf +[mariadbd] +innodb-flush-method=O_DIRECT + +[mariabackup] +innodb-flush-method=blablabla +EOF +--error 13 +exec $XTRABACKUP --defaults-file=$custom_cnf --backup --target-dir=$targetdir; +--remove_file $custom_cnf + +--echo # Check if uknown options that follow --mysqld-args are ingored +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --mysqld-args --unknown-option; +--rmdir $targetdir diff --git a/mysql-test/suite/mariabackup/undo_space_id.test b/mysql-test/suite/mariabackup/undo_space_id.test index 8adeb18e5a7..e903a0ad4c5 100644 --- a/mysql-test/suite/mariabackup/undo_space_id.test +++ b/mysql-test/suite/mariabackup/undo_space_id.test @@ -17,7 +17,7 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir list_files $basedir undo*; --echo # xtrabackup prepare -exec $XTRABACKUP --prepare --apply-log-only --target-dir=$basedir; +exec $XTRABACKUP --prepare --target-dir=$basedir; --echo # Display undo log files from targer directory list_files $basedir undo*; diff --git a/mysql-test/suite/mariabackup/xb_fulltext_encrypted.test b/mysql-test/suite/mariabackup/xb_fulltext_encrypted.test index d5a5003c11a..f7b72b5ccea 100644 --- a/mysql-test/suite/mariabackup/xb_fulltext_encrypted.test +++ b/mysql-test/suite/mariabackup/xb_fulltext_encrypted.test @@ -16,7 +16,7 @@ let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; --disable_result_log exec $INNOBACKUPEX --defaults-file=$MYSQLTEST_VARDIR/my.cnf --no-timestamp $targetdir; -exec $INNOBACKUPEX --apply-log --rebuild-indexes --rebuild-threads=2 $targetdir; +exec $INNOBACKUPEX --apply-log $targetdir; --source include/restart_and_restore.inc --enable_result_log diff --git a/mysql-test/suite/mariabackup/xb_partition.test b/mysql-test/suite/mariabackup/xb_partition.test index e6f8c5d996f..3d027b67fc1 100644 --- a/mysql-test/suite/mariabackup/xb_partition.test +++ b/mysql-test/suite/mariabackup/xb_partition.test @@ -38,7 +38,7 @@ INSERT INTO isam_p VALUES (1), (101), (201), (301); let $targetdir=$MYSQLTEST_VARDIR/tmp; --disable_result_log -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --no-timestamp --backup --target-dir=$targetdir/full; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir/full; --enable_result_log DROP TABLE t1; diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 7d539cd44fe..c4f83475f7b 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -79,6 +79,12 @@ my_bool my_getopt_skip_unknown= 0; */ my_bool my_getopt_prefix_matching= 1; +/* + This is a flag that can be set in client programs. 1 means that + handle_options() will not initialize options to default values. +*/ +my_bool my_handle_options_init_variables = 1; + static void default_reporter(enum loglevel level, const char *format, ...) { @@ -212,7 +218,8 @@ int handle_options(int *argc, char ***argv, DBUG_ASSERT(argv && *argv); (*argc)--; /* Skip the program name */ (*argv)++; /* --- || ---- */ - init_variables(longopts, init_one_value); + if (my_handle_options_init_variables) + init_variables(longopts, init_one_value); /* Search for args_separator, if found, then the first part of the diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index 9aadcc0bc9b..a76a3b781e4 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -56,8 +56,6 @@ sfmt="tar" strmcmd="" tfmt="" tcmd="" -rebuild=0 -rebuildcmd="" payload=0 pvformat="-F '%N => Rate:%r Avg:%a Elapsed:%t %e Bytes: %b %p' " pvopts="-f -i 10 -N $WSREP_SST_OPT_ROLE " @@ -339,7 +337,6 @@ read_cnf() encrypt=$(parse_cnf sst encrypt 0) sockopt=$(parse_cnf sst sockopt "") progress=$(parse_cnf sst progress "") - rebuild=$(parse_cnf sst rebuild 0) ttime=$(parse_cnf sst time 0) cpat=$(parse_cnf sst cpat '.*galera\.cache$\|.*sst_in_progress$\|.*\.sst$\|.*gvwstate\.dat$\|.*grastate\.dat$\|.*\.err$\|.*\.log$\|.*RPM_UPGRADE_MARKER$\|.*RPM_UPGRADE_HISTORY$') [[ $OS == "FreeBSD" ]] && cpat=$(parse_cnf sst cpat '.*galera\.cache$|.*sst_in_progress$|.*\.sst$|.*gvwstate\.dat$|.*grastate\.dat$|.*\.err$|.*\.log$|.*RPM_UPGRADE_MARKER$|.*RPM_UPGRADE_HISTORY$') @@ -708,7 +705,7 @@ if [[ ${FORCE_FTWRL:-0} -eq 1 ]];then iopts+=" --no-backup-locks " fi -INNOEXTRA=$WSREP_SST_OPT_MYSQLD +INNOEXTRA= INNODB_DATA_HOME_DIR=${INNODB_DATA_HOME_DIR:-""} # Try to set INNODB_DATA_HOME_DIR from the command line: @@ -754,9 +751,9 @@ if [[ $ssyslog -eq 1 ]];then logger -p daemon.info -t ${ssystag}wsrep-sst-$WSREP_SST_OPT_ROLE "$@" } - INNOAPPLY="${INNOBACKUPEX_BIN} --innobackupex $disver $iapts \$INNOEXTRA --apply-log \$rebuildcmd \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-apply" - INNOMOVE="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-move" - INNOBACKUP="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2> >(logger -p daemon.err -t ${ssystag}innobackupex-backup)" + INNOAPPLY="${INNOBACKUPEX_BIN} --prepare $disver $iapts \$INNOEXTRA --target-dir=\${DATA} --mysqld-args \$WSREP_SST_OPT_MYSQLD 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-apply" + INNOMOVE="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} --move-back $disver $impts --force-non-empty-directories --target-dir=\${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-move" + INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} --backup $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt --target-dir=\$itmpdir --mysqld-args \$WSREP_SST_OPT_MYSQLD 2> >(logger -p daemon.err -t ${ssystag}innobackupex-backup)" fi else @@ -818,9 +815,9 @@ then fi - INNOAPPLY="${INNOBACKUPEX_BIN} --innobackupex $disver $iapts \$INNOEXTRA --apply-log \$rebuildcmd \${DATA} &> ${INNOAPPLYLOG}" - INNOMOVE="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} &> ${INNOMOVELOG}" - INNOBACKUP="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2> ${INNOBACKUPLOG}" + INNOAPPLY="${INNOBACKUPEX_BIN} --prepare $disver $iapts \$INNOEXTRA --target-dir=\${DATA} --mysqld-args \$WSREP_SST_OPT_MYSQLD &> ${INNOAPPLYLOG}" + INNOMOVE="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} --move-back $disver $impts --move-back --force-non-empty-directories --target-dir=\${DATA} &> ${INNOMOVELOG}" + INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} --backup $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt --target-dir=\$itmpdir 2> ${INNOBACKUPLOG}" fi get_stream @@ -862,15 +859,6 @@ then INNOEXTRA+=" --password=" fi - get_keys - if [[ $encrypt -eq 1 ]];then - if [[ -n $ekey ]];then - INNOEXTRA+=" --encrypt=$ealgo --encrypt-key=$ekey" - else - INNOEXTRA+=" --encrypt=$ealgo --encrypt-key-file=$ekeyfile" - fi - fi - check_extra wsrep_log_info "Streaming GTID file before SST" @@ -1091,18 +1079,6 @@ then exit 2 fi - # Rebuild indexes for compact backups - if grep -q 'compact = 1' ${DATA}/xtrabackup_checkpoints;then - wsrep_log_info "Index compaction detected" - rebuild=1 - fi - - if [[ $rebuild -eq 1 ]];then - nthreads=$(parse_cnf xtrabackup rebuild-threads $nproc) - wsrep_log_info "Rebuilding during prepare with $nthreads threads" - rebuildcmd="--rebuild-indexes --rebuild-threads=$nthreads" - fi - if test -n "$(find ${DATA} -maxdepth 1 -type f -name '*.qp' -print -quit)";then wsrep_log_info "Compressed qpress files found" -- cgit v1.2.1 From 49ac606a75d2f4d2898d0d5638354493e12b5dc0 Mon Sep 17 00:00:00 2001 From: Alexey Yurchenko Date: Sun, 14 Jun 2020 22:13:45 +0300 Subject: Fix include statements in galera_ipv6_mariabackup_section and galera_ipv6_mariabackup MTR tests --- mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test | 2 +- mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test index 7f73e36c0b8..d6b97f939f2 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test @@ -1,7 +1,7 @@ --source include/galera_cluster.inc --source include/check_ipv6.inc --source include/have_innodb.inc ---source include/have_mariabackup.inc +--source ../galera/include/have_mariabackup.inc # Confirm that initial handshake happened over ipv6 diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test index fd76c3586ca..e9425bcffdf 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test @@ -1,7 +1,7 @@ --source include/galera_cluster.inc --source include/check_ipv6.inc --source include/have_innodb.inc ---source include/have_mariabackup.inc +--source ../galera/include/have_mariabackup.inc # Confirm that initial handshake happened over ipv6 -- cgit v1.2.1 From 0128e13e6218fab10e247bc213e652a0faedd75a Mon Sep 17 00:00:00 2001 From: MikkoJaakola Date: Mon, 15 Jun 2020 16:39:41 +0300 Subject: MDEV-21759 galera.galera_parallel_autoinc_manytrx sporadic failures. The galera.galera_parallel_autoinc_manytrx mtr test opens and runs test scenario through 3 connections to node 1 and one connection to node 2. In the test initialization phase, the test creates two tables 't1' and 'ten' and then creates a stored procedure 'p1' to operate on these tables. These 3 create DDL statements are issued through same connection to node 1. In the next test phase, the mtr script uses send command to launch the call for the p1 stored procedure through all 3 connections to node 1 and through one connection to node 2. As the mtr send command is asynchronous, this test phase is non blocking and fast operation. Now, if the replication between nodes is slow, it may happen that the initialization phase DDL statements have not been received or have not been fully applied in node 2. Therefore there is no guarantee that the test tables and the stored procedure have been created in node 2. Yet, the test is trying to call p1 in node 2. In the failure case error logs, there is error message "MTR failed: query 'reap' failed: 1305: PROCEDURE test.p1 does not exist" The reap command through connection to node 2, is the first place where test execution may observe that test tables and/or stored procedure are not yet created in node 2. The fix in this commit adds a wait condition in connection to node 2, to wait until the stored procedure is created before calling the stored procedure. The wait is implemented by looking in information_schema.routines for the p1 stored procedure. --- mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result | 2 ++ mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test | 2 ++ 2 files changed, 4 insertions(+) diff --git a/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result b/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result index 88cb6cacc07..e09e34274dd 100644 --- a/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result +++ b/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result @@ -18,6 +18,8 @@ COMMIT; SET current_num = current_num + 1; END WHILE; END| +call p1(1000); +connection node_1; connection node_1a; connection node_1b; connection node_2; diff --git a/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test b/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test index b82a160657d..587fbe10fe4 100644 --- a/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test +++ b/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test @@ -57,6 +57,8 @@ send call p1(1000); --connection node_2 --disable_query_log +--let $wait_condition = select count(*)=1 from information_schema.routines WHERE routine_name='p1'; +--source include/wait_condition.inc send call p1(1000); --connection node_1 -- cgit v1.2.1 From 592a10d0799807b19ee68ff6c391ee52d564b822 Mon Sep 17 00:00:00 2001 From: Sachin Date: Fri, 22 May 2020 22:44:37 +0530 Subject: MDEV-22370 safe_mutex: Trying to lock uninitialized mutex at /data/src/10.4-bug/sql/rpl_parallel.cc, line 470 upon shutdown during FTWRL Problem:- When we issue FTWRL with shutdown in parallel, there is race between FTWRL and shutdown. Shutdown might destroy the mutex (pool->LOCK_rpl_thread_pool) before FTWRL can lock it. So we can get crash on FTWRL thread Solution:- mysql_mutex_destroy(pool->LOCK_rpl_thread_pool) should wait for FTWRL thread to complete its work , and then destroy. So slave_prepare_for_shutdown will just deactivate the pool, and mutex is destroyed later in end_slave() --- mysql-test/main/mdev_22370.result | 5 +++++ mysql-test/main/mdev_22370.test | 17 +++++++++++++++++ sql/rpl_parallel.cc | 15 +++++++++++++++ sql/rpl_parallel.h | 2 ++ sql/slave.cc | 2 +- 5 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 mysql-test/main/mdev_22370.result create mode 100644 mysql-test/main/mdev_22370.test diff --git a/mysql-test/main/mdev_22370.result b/mysql-test/main/mdev_22370.result new file mode 100644 index 00000000000..c1cb60aa106 --- /dev/null +++ b/mysql-test/main/mdev_22370.result @@ -0,0 +1,5 @@ +connect con1,localhost,root,,; +SET DEBUG_DBUG='+d,mark_busy_mdev_22370'; +FLUSH TABLES WITH READ LOCK; +connection default; +# restart diff --git a/mysql-test/main/mdev_22370.test b/mysql-test/main/mdev_22370.test new file mode 100644 index 00000000000..86bc527ebc0 --- /dev/null +++ b/mysql-test/main/mdev_22370.test @@ -0,0 +1,17 @@ +# +# MDEV-22370 safe_mutex: Trying to lock uninitialized mutex at +# /data/src/10.4-bug/sql/rpl_parallel.cc, line 470 upon shutdown during FTWRL +# +# Purpose of this test case to test crash while FTWRL and shutdown is in race +# condition +# Shutdown can execute first and destroy the mutex making mutex_lock in pool_mark_busy +# to crash + +--source include/have_debug.inc +--connect (con1,localhost,root,,) +SET DEBUG_DBUG='+d,mark_busy_mdev_22370'; +--send + FLUSH TABLES WITH READ LOCK; + +--connection default +--source include/restart_mysqld.inc diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc index 88e036d4481..7c0e96bc8ed 100644 --- a/sql/rpl_parallel.cc +++ b/sql/rpl_parallel.cc @@ -467,6 +467,7 @@ pool_mark_busy(rpl_parallel_thread_pool *pool, THD *thd) So we protect the infrequent operations of FLUSH TABLES WITH READ LOCK and pool size changes with this condition wait. */ + DBUG_EXECUTE_IF("mark_busy_mdev_22370",my_sleep(1000000);); mysql_mutex_lock(&pool->LOCK_rpl_thread_pool); if (thd) { @@ -2010,10 +2011,24 @@ rpl_parallel_thread_pool::init(uint32 size) void rpl_parallel_thread_pool::destroy() +{ + deactivate(); + destroy_cond_mutex(); +} + +void +rpl_parallel_thread_pool::deactivate() { if (!inited) return; rpl_parallel_change_thread_count(this, 0, 1); +} + +void +rpl_parallel_thread_pool::destroy_cond_mutex() +{ + if (!inited) + return; mysql_mutex_destroy(&LOCK_rpl_thread_pool); mysql_cond_destroy(&COND_rpl_thread_pool); inited= false; diff --git a/sql/rpl_parallel.h b/sql/rpl_parallel.h index 4579d0da9bc..0fa28e32291 100644 --- a/sql/rpl_parallel.h +++ b/sql/rpl_parallel.h @@ -244,6 +244,8 @@ struct rpl_parallel_thread_pool { rpl_parallel_thread_pool(); int init(uint32 size); void destroy(); + void deactivate(); + void destroy_cond_mutex(); struct rpl_parallel_thread *get_thread(rpl_parallel_thread **owner, rpl_parallel_entry *entry); void release_thread(rpl_parallel_thread *rpt); diff --git a/sql/slave.cc b/sql/slave.cc index 31025b835b2..1fa83bd6bfa 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1445,7 +1445,7 @@ void slave_prepare_for_shutdown() mysql_mutex_unlock(&LOCK_active_mi); // It's safe to destruct worker pool now when // all driver threads are gone. - global_rpl_thread_pool.destroy(); + global_rpl_thread_pool.deactivate(); stop_slave_background_thread(); } -- cgit v1.2.1 From a0d598a4d220fc3845cdee9c8b46ca10b4c1093e Mon Sep 17 00:00:00 2001 From: Krunal Bauskar Date: Thu, 4 Jun 2020 18:37:18 +0800 Subject: MDEV-22794: Avoid potential rollback segment contention with increased scalability through even distribution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rollback segments are allocated to transactions in round-robin fashion. This is controlled by incrementing a static-scope counter named rseg_slot. Said logic is not protected by any mutex or use of atomic for the counter. This potentially can cause the same rollback segment to get allocated to N different transactions (requesting allocation at the same time). While this is not an issue as a rollback segment can host multiple transactions from contention (performance) perspective it is better to allocate these rollback segments in round-robin fashion. Fix for the said issue ports use of atomic for the said counter that would ensure the original design semantic (even distribution through round-robin) is retained. --- storage/innobase/trx/trx0trx.cc | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index c61eba8f421..1741ae37cb4 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -842,14 +842,9 @@ static trx_rseg_t* trx_assign_rseg_low() /* Choose a rollback segment evenly distributed between 0 and innodb_undo_logs-1 in a round-robin fashion, skipping those - undo tablespaces that are scheduled for truncation. - - Because rseg_slot is not protected by atomics or any mutex, race - conditions are possible, meaning that multiple transactions - that start modifications concurrently will write their undo - log to the same rollback segment. */ - static ulong rseg_slot; - ulint slot = rseg_slot++ % srv_undo_logs; + undo tablespaces that are scheduled for truncation. */ + static Atomic_counter rseg_slot; + ulong slot = ulong{rseg_slot++} % srv_undo_logs; trx_rseg_t* rseg; #ifdef UNIV_DEBUG @@ -941,11 +936,8 @@ trx_t::assign_temp_rseg() compile_time_assert(ut_is_2pow(TRX_SYS_N_RSEGS)); /* Choose a temporary rollback segment between 0 and 127 - in a round-robin fashion. Because rseg_slot is not protected by - atomics or any mutex, race conditions are possible, meaning that - multiple transactions that start modifications concurrently - will write their undo log to the same rollback segment. */ - static ulong rseg_slot; + in a round-robin fashion. */ + static Atomic_counter rseg_slot; trx_rseg_t* rseg = trx_sys.temp_rsegs[ rseg_slot++ & (TRX_SYS_N_RSEGS - 1)]; ut_ad(!rseg->is_persistent()); -- cgit v1.2.1 From 9c577c2b9004a3afbff013a03794ffdfff088ed4 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 16 Jun 2020 21:01:16 +0200 Subject: MDEV-22917 wolfssl might crash at startup when both SSL and encryption plugin are enabled Make sure to initialize SSL early enough, when encryption plugins is loaded --- include/violite.h | 2 ++ sql/encryption.cc | 3 +++ vio/viosslfactories.c | 4 ++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/violite.h b/include/violite.h index 34f59f2e598..9a0e995133d 100644 --- a/include/violite.h +++ b/include/violite.h @@ -171,6 +171,8 @@ struct st_VioSSLFd int sslaccept(struct st_VioSSLFd*, Vio *, long timeout, unsigned long *errptr); int sslconnect(struct st_VioSSLFd*, Vio *, long timeout, unsigned long *errptr); +void vio_check_ssl_init(); + struct st_VioSSLFd *new_VioSSLConnectorFd(const char *key_file, const char *cert_file, const char *ca_file, const char *ca_path, diff --git a/sql/encryption.cc b/sql/encryption.cc index fc07623883e..9c38713fdfa 100644 --- a/sql/encryption.cc +++ b/sql/encryption.cc @@ -18,6 +18,7 @@ #include "log.h" #include "sql_plugin.h" #include +#include /* there can be only one encryption plugin enabled */ static plugin_ref encryption_manager= 0; @@ -63,6 +64,8 @@ int initialize_encryption_plugin(st_plugin_int *plugin) if (encryption_manager) return 1; + vio_check_ssl_init(); + if (plugin->plugin->init && plugin->plugin->init(plugin)) { sql_print_error("Plugin '%s' init function returned error.", diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c index 4a31ebd1798..80d1e55f358 100644 --- a/vio/viosslfactories.c +++ b/vio/viosslfactories.c @@ -150,7 +150,7 @@ vio_set_cert_stuff(SSL_CTX *ctx, const char *cert_file, const char *key_file, } -static void check_ssl_init() +void vio_check_ssl_init() { if (!ssl_algorithms_added) { @@ -243,7 +243,7 @@ new_VioSSLFd(const char *key_file, const char *cert_file, crl_file ? crl_file : "NULL", crl_path ? crl_path : "NULL")); - check_ssl_init(); + vio_check_ssl_init(); if (!(ssl_fd= ((struct st_VioSSLFd*) my_malloc(sizeof(struct st_VioSSLFd),MYF(0))))) -- cgit v1.2.1 From b7324e133f569acde8622429425f6e608c4d88a1 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Wed, 17 Jun 2020 19:30:19 +0300 Subject: Remove redundant code in opt_range.cc: print_key_value() --- sql/opt_range.cc | 9 --------- 1 file changed, 9 deletions(-) diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 66c870dd2ac..690657616b8 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -15926,15 +15926,6 @@ static void print_key_value(String *out, const KEY_PART_INFO *key_part, { field= key_part->field; store_length= key_part->store_length; - if (field->flags & BLOB_FLAG) - { - // Byte 0 of a nullable key is the null-byte. If set, key is NULL. - if (field->real_maybe_null() && *key) - { - out->append(STRING_WITH_LEN("NULL")); - goto next; - } - } if (field->real_maybe_null()) { -- cgit v1.2.1 From d33c9ca1b012f8a723f4f712c1d8fb71577c5670 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Wed, 17 Jun 2020 22:03:27 +0530 Subject: MDEV-22902 Assertion `!page_has_siblings(block->frame)' failed in btr_pcur_store_position - There is a possiblity that metadata record is the only record in the leftmost leaf page. So change the assertion to check only previous page. --- storage/innobase/btr/btr0pcur.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc index 230a9b4914f..37444ee974d 100644 --- a/storage/innobase/btr/btr0pcur.cc +++ b/storage/innobase/btr/btr0pcur.cc @@ -154,7 +154,7 @@ before_first: ut_ad(index->table->instant); ut_ad(page_get_n_recs(block->frame) == 1); ut_ad(page_is_leaf(block->frame)); - ut_ad(!page_has_siblings(block->frame)); + ut_ad(!page_has_prev(block->frame)); cursor->rel_pos = BTR_PCUR_AFTER_LAST_IN_TREE; return; } -- cgit v1.2.1 From 01ed61402751657976fc5895e1d0d6fa94f17bf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 18 Jun 2020 12:13:31 +0300 Subject: Fix the test mariabackup.mdev-14447 The test mariabackup.mdev-14447 started failing due to the option --apply-log-only that became invalid since commit 9bdf35e90f36d9be8cc7591e2ed5e62feadc5515 and had been removed in commit 8c71c6aa8b9f4c78cfa164fad1d324ba0cf9b888. --- mysql-test/suite/mariabackup/mdev-14447.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/mariabackup/mdev-14447.test b/mysql-test/suite/mariabackup/mdev-14447.test index 17f78b4d1c9..7877a7805e1 100644 --- a/mysql-test/suite/mariabackup/mdev-14447.test +++ b/mysql-test/suite/mariabackup/mdev-14447.test @@ -30,9 +30,9 @@ remove_file $backuplog; --disable_result_log echo # Prepare full backup, apply incremental one; -exec $XTRABACKUP --prepare --verbose --apply-log-only --target-dir=$basedir; +exec $XTRABACKUP --prepare --verbose --target-dir=$basedir; -exec $XTRABACKUP --prepare --verbose --apply-log-only --target-dir=$basedir --incremental-dir=$incremental_dir ; +exec $XTRABACKUP --prepare --verbose --target-dir=$basedir --incremental-dir=$incremental_dir ; echo # Restore and check results; let $targetdir=$basedir; -- cgit v1.2.1 From 0121a9e0bb9b65963c676ccf7ef2eb50cabad8da Mon Sep 17 00:00:00 2001 From: Vlad Lesin Date: Tue, 16 Jun 2020 11:21:28 +0300 Subject: MDEV-18215: mariabackup does not report unknown command line options Post-push fix: add mysqd options in backup string in mariabackup sst script for the case of logging not in syslog. --- scripts/wsrep_sst_mariabackup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index a76a3b781e4..1991fe4dd8d 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -817,7 +817,7 @@ fi INNOAPPLY="${INNOBACKUPEX_BIN} --prepare $disver $iapts \$INNOEXTRA --target-dir=\${DATA} --mysqld-args \$WSREP_SST_OPT_MYSQLD &> ${INNOAPPLYLOG}" INNOMOVE="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} --move-back $disver $impts --move-back --force-non-empty-directories --target-dir=\${DATA} &> ${INNOMOVELOG}" - INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} --backup $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt --target-dir=\$itmpdir 2> ${INNOBACKUPLOG}" + INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} --backup $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt --target-dir=\$itmpdir --mysqld-args \$WSREP_SST_OPT_MYSQLD 2> ${INNOBACKUPLOG}" fi get_stream -- cgit v1.2.1 From 205b0ce6ad21dbafe8def505307b4922398db5b2 Mon Sep 17 00:00:00 2001 From: Vlad Lesin Date: Tue, 16 Jun 2020 12:02:13 +0300 Subject: MDEV-22894: Mariabackup should not read [mariadb-client] option group from configuration files --- extra/mariabackup/xtrabackup.cc | 2 +- mysql-test/suite/mariabackup/options_check.result | 1 + mysql-test/suite/mariabackup/options_check.test | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 19058398258..3946879415d 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -1626,7 +1626,7 @@ end: } static const char *xb_client_default_groups[]= { - "client", "client-server", "client-mariadb", "mariadb-client", 0, 0, 0}; + "client", "client-server", "client-mariadb", 0, 0, 0}; static const char *backup_default_groups[]= { "xtrabackup", "mariabackup", "mariadb-backup", 0, 0, 0}; diff --git a/mysql-test/suite/mariabackup/options_check.result b/mysql-test/suite/mariabackup/options_check.result index da44f1dda5f..6b9925a0a8e 100644 --- a/mysql-test/suite/mariabackup/options_check.result +++ b/mysql-test/suite/mariabackup/options_check.result @@ -4,3 +4,4 @@ # Check for unknown options in "mariadb-backup" group # Check for options overwriting # Check if uknown options that follow --mysqld-args are ingored +# Check if [mariadb-client] group is not loaded (MDEV-22894) diff --git a/mysql-test/suite/mariabackup/options_check.test b/mysql-test/suite/mariabackup/options_check.test index f4f65fa7eae..7483453d19b 100644 --- a/mysql-test/suite/mariabackup/options_check.test +++ b/mysql-test/suite/mariabackup/options_check.test @@ -51,3 +51,14 @@ exec $XTRABACKUP --defaults-file=$custom_cnf --backup --target-dir=$targetdir; --echo # Check if uknown options that follow --mysqld-args are ingored exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --mysqld-args --unknown-option; --rmdir $targetdir + +--echo # Check if [mariadb-client] group is not loaded (MDEV-22894) +--copy_file $MYSQLTEST_VARDIR/my.cnf $custom_cnf +--append_file $custom_cnf +[mariadb-client] +user=bla +password=bla +EOF +exec $XTRABACKUP --defaults-file=$custom_cnf --backup --target-dir=$targetdir; +--remove_file $custom_cnf +--rmdir $targetdir -- cgit v1.2.1