Commit 9bdf35e9 authored by Vlad Lesin's avatar Vlad Lesin

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
parent ceaa8b64
......@@ -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);
......
......@@ -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 @@ static int prepare_export()
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<const char *> 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<char *> mysqld_args;
std::vector<char *> 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<int>(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<int>(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) {
......
......@@ -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,
......
......@@ -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;
......
# 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
--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
......@@ -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;
......
......@@ -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
......
......@@ -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"
......
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