summaryrefslogtreecommitdiff
path: root/sql/wsrep_sst.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2014-09-26 15:54:42 +0200
committerSergei Golubchik <serg@mariadb.org>2014-10-01 23:38:27 +0200
commit4bb49d84a9df8c3f29683bfe8503a575bc0ab84b (patch)
tree0c96f130ed7767063af8587809bce1f5d5ddc141 /sql/wsrep_sst.cc
parentdc113e2765c19cc3b1dff7c6141701411c93ce42 (diff)
downloadmariadb-git-4bb49d84a9df8c3f29683bfe8503a575bc0ab84b.tar.gz
correct handling on defaults[-extra]-file is SST scripts
pass --defaults-file and --defaults-extra-file (whatever was specified, or none) from mysqld down to SST scripts. parse these options in SST scripts and pass them down to mysqldump, my_print_defaults, and xtrabackup
Diffstat (limited to 'sql/wsrep_sst.cc')
-rw-r--r--sql/wsrep_sst.cc33
1 files changed, 29 insertions, 4 deletions
diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc
index c122d88f7cc..17943308c37 100644
--- a/sql/wsrep_sst.cc
+++ b/sql/wsrep_sst.cc
@@ -29,7 +29,9 @@
#include <cstdio>
#include <cstdlib>
-extern const char wsrep_defaults_file[];
+char wsrep_defaults_file[FN_REFLEN * 2 + 10 +
+ sizeof(WSREP_SST_OPT_CONF) +
+ sizeof(WSREP_SST_OPT_EXTRA_CONF)] = {0};
const char* wsrep_sst_method = WSREP_SST_DEFAULT;
const char* wsrep_sst_receive_address = WSREP_SST_ADDRESS_AUTO;
@@ -59,6 +61,24 @@ bool wsrep_sst_method_update (sys_var *self, THD* thd, enum_var_type type)
return 0;
}
+
+static void make_wsrep_defaults_file()
+{
+ if (!wsrep_defaults_file[0])
+ {
+ char *ptr= wsrep_defaults_file;
+ char *end= ptr + sizeof(wsrep_defaults_file);
+ if (my_defaults_file)
+ ptr= strxnmov(ptr, end - ptr,
+ WSREP_SST_OPT_CONF, " '", my_defaults_file, "' ", NULL);
+
+ if (my_defaults_extra_file)
+ ptr= strxnmov(ptr, end - ptr,
+ WSREP_SST_OPT_EXTRA_CONF, " '", my_defaults_extra_file, "' ", NULL);
+ }
+}
+
+
// TODO: Improve address verification.
static bool sst_receive_address_check (const char* str)
{
@@ -455,6 +475,7 @@ static ssize_t sst_prepare_other (const char* method,
}
if (strlen(binlog_opt_val)) binlog_opt= WSREP_SST_OPT_BINLOG;
+ make_wsrep_defaults_file();
ret= snprintf (cmd_str, cmd_len,
"wsrep_sst_%s "
@@ -462,7 +483,7 @@ static ssize_t sst_prepare_other (const char* method,
WSREP_SST_OPT_ADDR" '%s' "
WSREP_SST_OPT_AUTH" '%s' "
WSREP_SST_OPT_DATA" '%s' "
- WSREP_SST_OPT_CONF" '%s' "
+ " %s "
WSREP_SST_OPT_PARENT" '%d'"
" %s '%s' ",
method, addr_in, (sst_auth_real) ? sst_auth_real : "",
@@ -754,6 +775,8 @@ static int sst_donate_mysqldump (const char* addr,
if (!bypass && wsrep_sst_donor_rejects_queries) sst_reject_queries(TRUE);
+ make_wsrep_defaults_file();
+
snprintf (cmd_str, cmd_len,
"wsrep_sst_mysqldump "
WSREP_SST_OPT_USER" '%s' "
@@ -762,7 +785,7 @@ static int sst_donate_mysqldump (const char* addr,
WSREP_SST_OPT_PORT" '%s' "
WSREP_SST_OPT_LPORT" '%u' "
WSREP_SST_OPT_SOCKET" '%s' "
- WSREP_SST_OPT_CONF" '%s' "
+ " %s "
WSREP_SST_OPT_GTID" '%s:%lld'"
"%s",
user, pswd, host, port, mysqld_port, mysqld_unix_port,
@@ -1027,6 +1050,8 @@ static int sst_donate_other (const char* method,
}
if (strlen(binlog_opt_val)) binlog_opt= WSREP_SST_OPT_BINLOG;
+ make_wsrep_defaults_file();
+
ret= snprintf (cmd_str, cmd_len,
"wsrep_sst_%s "
WSREP_SST_OPT_ROLE" 'donor' "
@@ -1034,7 +1059,7 @@ static int sst_donate_other (const char* method,
WSREP_SST_OPT_AUTH" '%s' "
WSREP_SST_OPT_SOCKET" '%s' "
WSREP_SST_OPT_DATA" '%s' "
- WSREP_SST_OPT_CONF" '%s' "
+ " %s "
" %s '%s' "
WSREP_SST_OPT_GTID" '%s:%lld'"
"%s",