summaryrefslogtreecommitdiff
path: root/sql/wsrep_sst.cc
diff options
context:
space:
mode:
authorSeppo Jaakola <seppo.jaakola@codership.com>2012-08-09 01:47:21 +0300
committerSeppo Jaakola <seppo.jaakola@codership.com>2012-08-09 01:47:21 +0300
commitebfa24b1d24377a241b79883da96969a9150f22c (patch)
treeef1198f9dfb1838cbdbc5056f2b84e399b446bfd /sql/wsrep_sst.cc
parent1fd2e10736d6fd198e62054cb9006a3dc13fd55e (diff)
parenta7123f507598690ef0fce68b5d8dc58e63635024 (diff)
downloadmariadb-git-ebfa24b1d24377a241b79883da96969a9150f22c.tar.gz
References lp:1034621 - Merge up to mysql-5.5.25 level
merged codership-mysql/5.5 revisions: bzr diff -r3759..3767 merged codership-mysql/5.5 revisions: bzr diff -r3768..3771
Diffstat (limited to 'sql/wsrep_sst.cc')
-rw-r--r--sql/wsrep_sst.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc
index 37779c4b96d..df39db3caa4 100644
--- a/sql/wsrep_sst.cc
+++ b/sql/wsrep_sst.cc
@@ -39,6 +39,8 @@ const char* wsrep_sst_donor = "";
// container for real auth string
static const char* sst_auth_real = NULL;
+my_bool wsrep_sst_donor_rejects_queries = FALSE;
+
static const char *sst_methods[] = {
"mysqldump",
"rsync",
@@ -597,6 +599,13 @@ static int sst_run_shell (const char* cmd_str, int max_tries)
return -ret;
}
+static void sst_reject_queries(my_bool close_conn)
+{
+ wsrep_ready_set (FALSE); // this will be resotred when donor becomes synced
+ WSREP_INFO("Rejecting client queries for the duration of SST.");
+ if (TRUE == close_conn) wsrep_close_client_connections(FALSE);
+}
+
static int sst_mysqldump_check_addr (const char* user, const char* pswd,
const char* host, const char* port)
{
@@ -654,6 +663,8 @@ static int sst_donate_mysqldump (const char* addr,
size_t cmd_len= 1024;
char cmd_str[cmd_len];
+ if (!bypass && wsrep_sst_donor_rejects_queries) sst_reject_queries(TRUE);
+
snprintf (cmd_str, cmd_len,
"wsrep_sst_mysqldump '%s' '%s' '%s' '%s' '%u' '%s' '%lld' '%d'",
user, pswd, host, port, mysqld_port, uuid_str, (long long)seqno,
@@ -781,7 +792,8 @@ static void* sst_donor_thread (void* a)
wsrep_uuid_t ret_uuid= WSREP_UUID_UNDEFINED;
wsrep_seqno_t ret_seqno= WSREP_SEQNO_UNDEFINED; // seqno of complete SST
- wsp::thd thd;
+ wsp::thd thd(FALSE); // we turn off wsrep_on for this THD so that it can
+ // operate with wsrep_ready == OFF
wsp::process proc(arg->cmd, "r");
err= proc.error();
@@ -880,6 +892,8 @@ static int sst_donate_other (const char* method,
return (ret < 0 ? ret : -EMSGSIZE);
}
+ if (!bypass && wsrep_sst_donor_rejects_queries) sst_reject_queries(FALSE);
+
pthread_t tmp;
sst_thread_arg arg(cmd_str);
mysql_mutex_lock (&arg.lock);