Commit dc377fcb authored by Nirbhay Choubey's avatar Nirbhay Choubey

Merge of patch for MDEV-6411 from maria-5.5-galera.

parent 3d1ac121
......@@ -11,6 +11,7 @@ SET SESSION wsrep_replicate_myisam= ON;
ERROR HY000: Variable 'wsrep_replicate_myisam' is a GLOBAL variable and should be set with SET GLOBAL
SET GLOBAL wsrep_replicate_myisam= ON;
SET GLOBAL wsrep_replicate_myisam= OFF;
SET GLOBAL wsrep_provider=none;
#
# MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of
# variables when using "_"
......@@ -144,7 +145,7 @@ call mtr.add_suppression("safe_mutex: Found wrong usage of mutex 'LOCK_wsrep_sla
call mtr.add_suppression("WSREP: Failed to get provider options");
SELECT @@global.wsrep_provider;
@@global.wsrep_provider
none
libgalera_smm.so
SELECT @@global.wsrep_slave_threads;
@@global.wsrep_slave_threads
1
......@@ -160,7 +161,7 @@ wsrep_thread_count 0
SELECT @@global.wsrep_provider;
@@global.wsrep_provider
/usr/lib/galera/libgalera_smm.so
libgalera_smm.so
SELECT @@global.wsrep_cluster_address;
@@global.wsrep_cluster_address
NULL
......@@ -177,7 +178,7 @@ SET GLOBAL wsrep_cluster_address= 'gcomm://';
# Wait for applier threads to get created.
SELECT @@global.wsrep_provider;
@@global.wsrep_provider
/usr/lib/galera/libgalera_smm.so
libgalera_smm.so
SELECT @@global.wsrep_cluster_address;
@@global.wsrep_cluster_address
gcomm://
......@@ -201,4 +202,21 @@ SET GLOBAL wsrep_slave_threads= @wsrep_slave_threads_saved;
SET GLOBAL wsrep_provider= none;
SET GLOBAL wsrep_cluster_address= '';
SET GLOBAL wsrep_provider_options= '';
#
# MDEV#6411: Setting set @@global.wsrep_sst_auth=NULL causes crash
#
SET @wsrep_sst_auth_saved= @@global.wsrep_sst_auth;
SET @@global.wsrep_sst_auth= 'user:pass';
SELECT @@global.wsrep_sst_auth;
@@global.wsrep_sst_auth
********
SET @@global.wsrep_sst_auth= '';
SELECT @@global.wsrep_sst_auth;
@@global.wsrep_sst_auth
SET @@global.wsrep_sst_auth= NULL;
SELECT @@global.wsrep_sst_auth;
@@global.wsrep_sst_auth
NULL
SET @@global.wsrep_sst_auth= @wsrep_sst_auth_saved;
# End of test.
......@@ -19,6 +19,7 @@ SET GLOBAL wsrep_replicate_myisam= ON;
# Reset it back.
SET GLOBAL wsrep_replicate_myisam= OFF;
SET GLOBAL wsrep_provider=none;
--echo #
--echo # MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of
......@@ -27,6 +28,10 @@ SET GLOBAL wsrep_replicate_myisam= OFF;
CALL mtr.add_suppression("WSREP: Could not open saved state file for reading.*");
--disable_query_log
eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
--enable_query_log
--replace_column 2 #
SHOW GLOBAL STATUS LIKE 'wsrep%';
......@@ -40,6 +45,7 @@ SHOW GLOBAL STATUS LIKE 'wsrep_local_state_comment';
--echo # Should show nothing.
SHOW STATUS LIKE 'x';
# Reset it back.
SET GLOBAL wsrep_provider=none;
--echo #
......@@ -59,6 +65,7 @@ SHOW STATUS LIKE 'wsrep_local_state_uuid';
--replace_column 2 #
SHOW STATUS LIKE 'wsrep_last_committed';
# Reset it back.
SET GLOBAL wsrep_provider=none;
--echo
......@@ -67,6 +74,12 @@ SET GLOBAL wsrep_provider=none;
--echo #
call mtr.add_suppression("safe_mutex: Found wrong usage of mutex 'LOCK_wsrep_slave_threads' and 'LOCK_global_system_variables'");
call mtr.add_suppression("WSREP: Failed to get provider options");
--disable_query_log
eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
--enable_query_log
--replace_regex /.*libgalera_smm.*/libgalera_smm.so/
SELECT @@global.wsrep_provider;
SELECT @@global.wsrep_slave_threads;
SELECT @@global.wsrep_cluster_address;
......@@ -77,6 +90,8 @@ SHOW STATUS LIKE 'wsrep_thread_count';
--disable_query_log
eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
--enable_query_log
--replace_regex /.*libgalera_smm.*/libgalera_smm.so/
SELECT @@global.wsrep_provider;
SELECT @@global.wsrep_cluster_address;
SHOW STATUS LIKE 'threads_connected';
......@@ -88,6 +103,8 @@ SHOW STATUS LIKE 'wsrep_thread_count';
SET GLOBAL wsrep_cluster_address= 'gcomm://';
--echo # Wait for applier threads to get created.
sleep 3;
--replace_regex /.*libgalera_smm.*/libgalera_smm.so/
SELECT @@global.wsrep_provider;
SELECT @@global.wsrep_cluster_address;
SHOW STATUS LIKE 'threads_connected';
......@@ -107,4 +124,17 @@ SET GLOBAL wsrep_provider= none;
SET GLOBAL wsrep_cluster_address= '';
SET GLOBAL wsrep_provider_options= '';
--echo #
--echo # MDEV#6411: Setting set @@global.wsrep_sst_auth=NULL causes crash
--echo #
SET @wsrep_sst_auth_saved= @@global.wsrep_sst_auth;
SET @@global.wsrep_sst_auth= 'user:pass';
SELECT @@global.wsrep_sst_auth;
SET @@global.wsrep_sst_auth= '';
SELECT @@global.wsrep_sst_auth;
SET @@global.wsrep_sst_auth= NULL;
SELECT @@global.wsrep_sst_auth;
SET @@global.wsrep_sst_auth= @wsrep_sst_auth_saved;
--echo # End of test.
......@@ -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 */
......
......@@ -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()
......
......@@ -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)
......
......@@ -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)
......
......@@ -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 */
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment