Commit c515b1d0 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.4 into 10.5

parents baff3ba6 205b0ce6
......@@ -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;
......@@ -770,18 +772,7 @@ ibx_get_one_option(const struct my_option *opt,
xtrabackup_compress = TRUE;
break;
case 'p':
if (argument)
{
char *start = argument;
my_free(opt_ibx_password);
opt_ibx_password= my_strdup(PSI_NOT_INSTRUMENTED,
argument, MYF(MY_FAE));
/* Destroy argument */
while (*argument)
*argument++= 'x';
if (*start)
start[1]=0 ;
}
opt_ibx_password= argument;
break;
}
return(0);
......
This diff is collapsed.
......@@ -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 my_getopt_value my_getopt_get_addr;
......
......@@ -174,6 +174,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,
......
connect con1,localhost,root,,;
SET DEBUG_DBUG='+d,mark_busy_mdev_22370';
FLUSH TABLES WITH READ LOCK;
connection default;
# restart
#
# 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
......@@ -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
......
......@@ -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
......
......@@ -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 .*
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
# 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
# Check if [mariadb-client] group is not loaded (MDEV-22894)
--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
--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
......@@ -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*;
......
......@@ -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
......
......@@ -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;
......
/*
Copyright (c) 2002, 2013, Oracle and/or its affiliates
Copyright (c) 2009, 2015, MariaDB
Copyright (c) 2009, 2020, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -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;
my_getopt_value my_getopt_get_addr= 0;
static void default_reporter(enum loglevel level, const char *format, ...)
......@@ -205,6 +211,7 @@ int handle_options(int *argc, char ***argv, const struct my_option *longopts,
DBUG_ASSERT(*argv);
(*argc)--; /* Skip the program name */
(*argv)++; /* --- || ---- */
if (my_handle_options_init_variables)
init_variables(longopts, init_one_value);
is_cmdline_arg= !is_file_marker(**argv);
......
......@@ -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 --mysqld-args \$WSREP_SST_OPT_MYSQLD 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"
......
......@@ -18,6 +18,7 @@
#include "log.h"
#include "sql_plugin.h"
#include <my_crypt.h>
#include <violite.h>
/* 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.",
......
......@@ -15942,15 +15942,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())
{
......
......@@ -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)
{
......@@ -2012,10 +2013,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;
......
......@@ -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);
......
......@@ -1448,7 +1448,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();
}
......
......@@ -158,7 +158,7 @@ btr_pcur_store_position(
ut_ad(index->is_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;
}
......
......@@ -840,14 +840,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++ % TRX_SYS_N_RSEGS;
undo tablespaces that are scheduled for truncation. */
static Atomic_counter<unsigned> rseg_slot;
unsigned slot = rseg_slot++ % TRX_SYS_N_RSEGS;
ut_d(if (trx_rseg_n_slots_debug) slot = 0);
trx_rseg_t* rseg;
......@@ -926,11 +921,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<unsigned> rseg_slot;
trx_rseg_t* rseg = trx_sys.temp_rsegs[
rseg_slot++ & (TRX_SYS_N_RSEGS - 1)];
ut_ad(!rseg->is_persistent());
......
......@@ -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(key_memory_vio_ssl_fd,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment