summaryrefslogtreecommitdiff
path: root/sql/wsrep_sst.cc
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay@mariadb.com>2015-02-27 22:33:41 -0500
committerNirbhay Choubey <nirbhay@mariadb.com>2015-02-27 22:33:41 -0500
commit34d86ac9ff664972d2031e3fabf6c4a407e32c8a (patch)
treeec6f5bb62d72475e1cfd0be265ccdbea09413853 /sql/wsrep_sst.cc
parent0f8cb3c399b230dbbf1ab2f8d11538e2ae0c27c1 (diff)
downloadmariadb-git-34d86ac9ff664972d2031e3fabf6c4a407e32c8a.tar.gz
MDEV-6594: Use separate domain_id for Galera transactions
Diffstat (limited to 'sql/wsrep_sst.cc')
-rw-r--r--sql/wsrep_sst.cc60
1 files changed, 50 insertions, 10 deletions
diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc
index d170ff91bbc..512e8f23dd8 100644
--- a/sql/wsrep_sst.cc
+++ b/sql/wsrep_sst.cc
@@ -435,17 +435,53 @@ static void* sst_joiner_thread (void* a)
if (!tmp)
{
- WSREP_ERROR("Failed to read uuid:seqno from joiner script.");
+ WSREP_ERROR("Failed to read uuid:seqno and wsrep_gtid_domain_id from "
+ "joiner script.");
if (proc.error()) err = proc.error();
}
else
{
- err= sst_scan_uuid_seqno (out, &ret_uuid, &ret_seqno);
+ // Read state ID (UUID:SEQNO) followed by wsrep_gtid_domain_id (if any).
+ const char *pos= strchr(out, ' ');
+
+ if (!pos) {
+ // There is no wsrep_gtid_domain_id (some older version SST script?).
+ err= sst_scan_uuid_seqno (out, &ret_uuid, &ret_seqno);
+
+ } else {
+ // Scan state ID first followed by wsrep_gtid_domain_id.
+ char uuid[512];
+ uint32 domain_id;
+ size_t len= pos - out + 1;
+
+ if (len > sizeof(uuid)) goto err; // safety check
+ memcpy(uuid, out, len); // including '\0'
+ err= sst_scan_uuid_seqno (uuid, &ret_uuid, &ret_seqno);
+
+ if (err)
+ {
+ goto err;
+ }
+ else if (wsrep_gtid_mode)
+ {
+ domain_id= strtol(pos + 1, NULL, 10);
+ if (domain_id < 1000 || domain_id > 0xFFFF)
+ {
+ WSREP_ERROR("Failed to get donor wsrep_gtid_domain_id.");
+ err= EINVAL;
+ goto err;
+ } else {
+ wsrep_gtid_domain_id= domain_id;
+ }
+ }
+ }
}
+err:
+
if (err)
{
- ret_uuid= WSREP_UUID_UNDEFINED;
+ ret_uuid= WSREP_UUID_UNDEFINED;
ret_seqno= -err;
}
@@ -784,11 +820,12 @@ static int sst_donate_mysqldump (const char* addr,
WSREP_SST_OPT_LPORT" '%u' "
WSREP_SST_OPT_SOCKET" '%s' "
" %s "
- WSREP_SST_OPT_GTID" '%s:%lld'"
+ WSREP_SST_OPT_GTID" '%s:%lld' "
+ WSREP_SST_OPT_GTID_DOMAIN_ID" '%d'"
"%s",
user, pswd, host, port, mysqld_port, mysqld_unix_port,
- wsrep_defaults_file, uuid_str,
- (long long)seqno, bypass ? " "WSREP_SST_OPT_BYPASS : "");
+ wsrep_defaults_file, uuid_str, (long long)seqno,
+ wsrep_gtid_domain_id, bypass ? " "WSREP_SST_OPT_BYPASS : "");
WSREP_DEBUG("Running: '%s'", cmd_str);
@@ -885,8 +922,10 @@ static int sst_flush_tables(THD* thd)
}
else
{
- fprintf(file, "%s:%lld\n",
- wsrep_cluster_state_uuid, (long long)wsrep_locked_seqno);
+ // Write cluster state ID and wsrep_gtid_domain_id.
+ fprintf(file, "%s:%lld %d\n",
+ wsrep_cluster_state_uuid, (long long)wsrep_locked_seqno,
+ wsrep_gtid_domain_id);
fsync(fileno(file));
fclose(file);
if (rename(tmp_name, real_name) == -1)
@@ -1058,12 +1097,13 @@ static int sst_donate_other (const char* method,
WSREP_SST_OPT_DATA" '%s' "
" %s "
" %s '%s' "
- WSREP_SST_OPT_GTID" '%s:%lld'"
+ WSREP_SST_OPT_GTID" '%s:%lld' "
+ WSREP_SST_OPT_GTID_DOMAIN_ID" '%d'"
"%s",
method, addr, sst_auth_real, mysqld_unix_port,
mysql_real_data_home, wsrep_defaults_file,
binlog_opt, binlog_opt_val,
- uuid, (long long) seqno,
+ uuid, (long long) seqno, wsrep_gtid_domain_id,
bypass ? " "WSREP_SST_OPT_BYPASS : "");
my_free(binlog_opt_val);