diff options
author | Nirbhay Choubey <nirbhay@skysql.com> | 2014-07-09 11:07:23 -0400 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@skysql.com> | 2014-07-09 11:07:23 -0400 |
commit | dc377fcbc0a3da99e02aa55000ab491d01c63fc4 (patch) | |
tree | 1ad5669b0e1ad17a6bd28fb8895cd33533a37668 /sql | |
parent | 3d1ac121771d61f9d1c944a1caa4e449527725fc (diff) | |
download | mariadb-git-dc377fcbc0a3da99e02aa55000ab491d01c63fc4.tar.gz |
Merge of patch for MDEV-6411 from maria-5.5-galera.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/mysqld.cc | 4 | ||||
-rw-r--r-- | sql/wsrep_mysqld.cc | 7 | ||||
-rw-r--r-- | sql/wsrep_mysqld.h | 2 | ||||
-rw-r--r-- | sql/wsrep_sst.cc | 51 | ||||
-rw-r--r-- | sql/wsrep_sst.h | 1 | ||||
-rw-r--r-- | sql/wsrep_var.cc | 2 |
6 files changed, 43 insertions, 24 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 3ba38ac6ec2..74c3efc714e 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1959,7 +1959,7 @@ static void __cdecl kill_server(int sig_ptr) close_connections(); #ifdef WITH_WSREP if (wsrep_inited == 1) - wsrep_deinit(); + wsrep_deinit(true); #endif if (sig != MYSQL_KILL_SIGNAL && sig != 0) @@ -2071,7 +2071,7 @@ extern "C" void unireg_abort(int exit_code) /* In bootstrap mode we deinitialize wsrep here. */ if (opt_bootstrap && wsrep_inited) - wsrep_deinit(); + wsrep_deinit(true); } #endif // WITH_WSREP clean_up(!opt_abort && (exit_code || !opt_bootstrap)); /* purecov: inspected */ diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index dff2dea8983..a9344b0a946 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -720,7 +720,7 @@ void wsrep_init_startup (bool first) } -void wsrep_deinit() +void wsrep_deinit(bool free_options) { DBUG_ASSERT(wsrep_inited == 1); wsrep_unload(wsrep); @@ -729,6 +729,11 @@ void wsrep_deinit() provider_version[0]= '\0'; provider_vendor[0]= '\0'; wsrep_inited= 0; + + if (free_options) + { + wsrep_sst_auth_free(); + } } void wsrep_recover() diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index bd76abad14e..796f1aac0f1 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -124,7 +124,7 @@ void wsrep_free_status(THD *thd); void wsrep_filter_new_cluster (int* argc, char* argv[]); int wsrep_init(); -void wsrep_deinit(); +void wsrep_deinit(bool free_options); void wsrep_recover(); bool wsrep_before_SE(); // initialize wsrep before storage // engines (true) or after (false) diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index 9b81e0fe22d..acc1a6e1e26 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -123,31 +123,44 @@ bool wsrep_sst_auth_check (sys_var *self, THD* thd, set_var* var) { return 0; } + static bool sst_auth_real_set (const char* value) { - const char* v = strdup (value); + const char* v= NULL; - if (v) - { - if (sst_auth_real) free (const_cast<char*>(sst_auth_real)); - sst_auth_real = v; + if (value) + { + v= my_strdup(value, MYF(0)); + } + else // its NULL + { + wsrep_sst_auth_free(); + return 0; + } - if (strlen(sst_auth_real)) - { - if (wsrep_sst_auth) - { - my_free ((void*)wsrep_sst_auth); - wsrep_sst_auth = my_strdup(WSREP_SST_AUTH_MASK, MYF(0)); - //strncpy (wsrep_sst_auth, WSREP_SST_AUTH_MASK, - // sizeof(wsrep_sst_auth) - 1); - } - else - wsrep_sst_auth = my_strdup (WSREP_SST_AUTH_MASK, MYF(0)); - } - return 0; + if (v) + { + // set sst_auth_real + if (sst_auth_real) { my_free((void *) sst_auth_real); } + sst_auth_real = v; + + // mask wsrep_sst_auth + if (strlen(sst_auth_real)) + { + if (wsrep_sst_auth) { my_free((void*) wsrep_sst_auth); } + wsrep_sst_auth= my_strdup(WSREP_SST_AUTH_MASK, MYF(0)); } + return 0; + } + return 1; +} - return 1; +void wsrep_sst_auth_free() +{ + if (wsrep_sst_auth) { my_free((void *) wsrep_sst_auth); } + if (sst_auth_real) { my_free((void *) sst_auth_real); } + wsrep_sst_auth= NULL; + sst_auth_real= NULL; } bool wsrep_sst_auth_update (sys_var *self, THD* thd, enum_var_type type) diff --git a/sql/wsrep_sst.h b/sql/wsrep_sst.h index b7f0e26f226..dc7789f5a4e 100644 --- a/sql/wsrep_sst.h +++ b/sql/wsrep_sst.h @@ -31,6 +31,7 @@ extern void wsrep_sst_grab(); extern bool wsrep_sst_wait(); /*! Signals wsrep that initialization is complete, writesets can be applied */ extern void wsrep_sst_continue(); +extern void wsrep_sst_auth_free(); extern void wsrep_SE_init_grab(); /*! grab init critical section */ extern void wsrep_SE_init_wait(); /*! wait for SE init to complete */ diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index 37e59763249..2516e8de293 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -239,7 +239,7 @@ bool wsrep_provider_update (sys_var *self, THD* thd, enum_var_type type) mysql_mutex_lock(&LOCK_global_system_variables); if (wsrep_inited == 1) - wsrep_deinit(); + wsrep_deinit(false); char* tmp= strdup(wsrep_provider); // wsrep_init() rewrites provider //when fails |