diff options
author | Sergei Golubchik <serg@mariadb.org> | 2014-09-26 15:54:42 +0200 |
---|---|---|
committer | Daniel Black <grooverdan@users.sourceforge.net> | 2018-01-14 22:48:02 +1100 |
commit | 943c62a5d4729786cb310f4a6af226184eb26196 (patch) | |
tree | 7809f173f5e8d923b95ee139bac243ec2ce15196 /sql/wsrep_sst.cc | |
parent | d7b2bc98bf55dded58e4d5d4a19e4aa48b30b26b (diff) | |
download | mariadb-git-943c62a5d4729786cb310f4a6af226184eb26196.tar.gz |
Backport 4bb49d84a9df, correct handling on defaults[-extra]-file is SST scripts
(from 10.1 to 10.0-galera)
This conflicted signficantly with 7d550c76be13c58551e203f4eeb4f87ebd58ba4b
which added --defaults-group-suffix support.
Took the approach of 4bb49d84a9df and adapted the
--defaults-group-suffix handling to be consistent.
The following changes as follows:
SST scripts now use $MY_PRINT_DEFAULTS rather than the lowercase for
consistency and this include all required --default arguements.
Backport/merge by Daniel Black <daniel@linux.vnet.ibm.com>
Diffstat (limited to 'sql/wsrep_sst.cc')
-rw-r--r-- | sql/wsrep_sst.cc | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index e4ec1adb35f..ca5dcd91216 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -30,8 +30,10 @@ #include <cstdio> #include <cstdlib> -extern const char wsrep_defaults_file[]; -extern const char wsrep_defaults_group_suffix[]; +static char wsrep_defaults_file[FN_REFLEN * 2 + 10 + 30 + + sizeof(WSREP_SST_OPT_CONF) + + sizeof(WSREP_SST_OPT_CONF_SUFFIX) + + sizeof(WSREP_SST_OPT_CONF_EXTRA)] = {0}; const char* wsrep_sst_method = WSREP_SST_DEFAULT; const char* wsrep_sst_receive_address = WSREP_SST_ADDRESS_AUTO; @@ -61,6 +63,28 @@ 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_CONF_EXTRA, " '", my_defaults_extra_file, "' ", NULL); + + if (my_defaults_group_suffix) + ptr= strxnmov(ptr, end - ptr, + WSREP_SST_OPT_CONF_SUFFIX, " '", my_defaults_group_suffix, "' ", NULL); + } +} + + // TODO: Improve address verification. static bool sst_receive_address_check (const char* str) { @@ -512,17 +536,18 @@ 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 " WSREP_SST_OPT_ROLE" 'joiner' " WSREP_SST_OPT_ADDR" '%s' " WSREP_SST_OPT_DATA" '%s' " - WSREP_SST_OPT_CONF" '%s' " - WSREP_SST_OPT_CONF_SUFFIX" '%s' " + " %s " WSREP_SST_OPT_PARENT" '%d'" " %s '%s' ", method, addr_in, mysql_real_data_home, - wsrep_defaults_file, wsrep_defaults_group_suffix, + wsrep_defaults_file, (int)getpid(), binlog_opt, binlog_opt_val); my_free(binlog_opt_val); @@ -785,12 +810,14 @@ static int sst_donate_mysqldump (const char* addr, if (!bypass && wsrep_sst_donor_rejects_queries) sst_reject_queries(TRUE); + make_wsrep_defaults_file(); + int ret= snprintf (cmd_str(), cmd_len, "wsrep_sst_mysqldump " WSREP_SST_OPT_ADDR" '%s' " WSREP_SST_OPT_LPORT" '%u' " WSREP_SST_OPT_SOCKET" '%s' " - WSREP_SST_OPT_CONF" '%s' " + " '%s' " WSREP_SST_OPT_GTID" '%s:%lld'" "%s", addr, mysqld_port, mysqld_unix_port, @@ -1091,19 +1118,20 @@ 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' " WSREP_SST_OPT_ADDR" '%s' " WSREP_SST_OPT_SOCKET" '%s' " WSREP_SST_OPT_DATA" '%s' " - WSREP_SST_OPT_CONF" '%s' " - WSREP_SST_OPT_CONF_SUFFIX" '%s' " + " %s " " %s '%s' " WSREP_SST_OPT_GTID" '%s:%lld'" "%s", method, addr, mysqld_unix_port, mysql_real_data_home, - wsrep_defaults_file, wsrep_defaults_group_suffix, + wsrep_defaults_file, binlog_opt, binlog_opt_val, uuid, (long long) seqno, bypass ? " " WSREP_SST_OPT_BYPASS : ""); |