summaryrefslogtreecommitdiff
path: root/sql/wsrep_sst.cc
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2018-06-26 12:56:19 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2018-09-05 10:34:36 +0300
commitb44b9f71bd86076746d21babb17949c1a710343c (patch)
tree8846d0871149780773d07fe0f8f59393e02e4132 /sql/wsrep_sst.cc
parent4caf3e08a853e413b4a08c1bf93cf737266a1451 (diff)
downloadmariadb-git-b44b9f71bd86076746d21babb17949c1a710343c.tar.gz
MDEV-15436: If log_bin and log_bin_index is different SST with rsync fails.
Problem was that in SST log_bin_index name and directory was not handled and passed to rsync SST script. wsrep_sst_common.sh Read binlog index dirname and filename if --binlog-index parameter is provided. Read binlog filenames from that file from donor and write transfered binlog filenames to that file in joiner. mysqld.cc, mysqld.h Moved opt_binlog_index_name from static to global and added it to extern. wsrep_sst.cc generate_binlog_index_opt_val New function to generate binlog index name if opt_binlog_index_name is given on configuration. sst_prepare_other Add binlog index configuration to SST command. wsrep_sst.h Add new SST parameter --binlog-index Add test case.
Diffstat (limited to 'sql/wsrep_sst.cc')
-rw-r--r--sql/wsrep_sst.cc33
1 files changed, 31 insertions, 2 deletions
diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc
index 281eac1ce0e..e2c55583594 100644
--- a/sql/wsrep_sst.cc
+++ b/sql/wsrep_sst.cc
@@ -408,6 +408,22 @@ static int generate_binlog_opt_val(char** ret)
return 0;
}
+static int generate_binlog_index_opt_val(char** ret)
+{
+ DBUG_ASSERT(ret);
+ *ret= NULL;
+ if (opt_binlog_index_name) {
+ *ret= strcmp(opt_binlog_index_name, "0") ?
+ my_strdup(opt_binlog_index_name, MYF(0)) : my_strdup("", MYF(0));
+ }
+ else
+ {
+ *ret= my_strdup("", MYF(0));
+ }
+ if (!*ret) return -ENOMEM;
+ return 0;
+}
+
static void* sst_joiner_thread (void* a)
{
sst_thread_arg* arg= (sst_thread_arg*) a;
@@ -595,7 +611,9 @@ static ssize_t sst_prepare_other (const char* method,
}
const char* binlog_opt= "";
+ const char* binlog_index_opt= "";
char* binlog_opt_val= NULL;
+ char* binlog_index_opt_val= NULL;
int ret;
if ((ret= generate_binlog_opt_val(&binlog_opt_val)))
@@ -604,7 +622,15 @@ static ssize_t sst_prepare_other (const char* method,
ret);
return ret;
}
+
+ if ((ret= generate_binlog_index_opt_val(&binlog_index_opt_val)))
+ {
+ WSREP_ERROR("sst_prepare_other(): generate_binlog_index_opt_val() failed %d",
+ ret);
+ }
+
if (strlen(binlog_opt_val)) binlog_opt= WSREP_SST_OPT_BINLOG;
+ if (strlen(binlog_index_opt_val)) binlog_index_opt= WSREP_SST_OPT_BINLOG_INDEX;
make_wsrep_defaults_file();
@@ -615,11 +641,14 @@ static ssize_t sst_prepare_other (const char* method,
WSREP_SST_OPT_DATA " '%s' "
" %s "
WSREP_SST_OPT_PARENT " '%d'"
- " %s '%s' ",
+ " %s '%s'"
+ " %s '%s'",
method, addr_in, mysql_real_data_home,
wsrep_defaults_file,
- (int)getpid(), binlog_opt, binlog_opt_val);
+ (int)getpid(), binlog_opt, binlog_opt_val,
+ binlog_index_opt, binlog_index_opt_val);
my_free(binlog_opt_val);
+ my_free(binlog_index_opt_val);
if (ret < 0 || ret >= cmd_len)
{