mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
MDEV#4109: Galera: Valgrind warnings "blocks are still
reachable" in wsrep_init_startup on MTR tests The initialization & de-initialization of wsrep plugin is solely controlled by wsrep_on system variable. Now, as wsrep_on is ON by default, the plugin gets initialized during server start. However, there would be a leakage in case wsrep_on is turned off before plugin's deinitialization (while server is shutting down) takes place, in which case the deinit routine will not be invoked. In this particular case, wsrep_on is turned off as no wsrep provider has been specified & thus the valgrind warnings. Fixed by introducing a flag which tracks and now controls the (de|)initialization of the wsrep plugin instead on wsrep_on. Added necessary asserts. main.connect [ pass ] 16534 valgrind_report [ pass ]
This commit is contained in:
@@ -1751,7 +1751,8 @@ static void __cdecl kill_server(int sig_ptr)
|
||||
|
||||
close_connections();
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP_ON) wsrep_deinit();
|
||||
if (wsrep_inited == 1)
|
||||
wsrep_deinit();
|
||||
#endif
|
||||
if (sig != MYSQL_KILL_SIGNAL &&
|
||||
sig != 0)
|
||||
|
||||
@@ -56,6 +56,11 @@ my_bool wsrep_desync = 0; // desynchronize the node from the c
|
||||
* End configuration options
|
||||
*/
|
||||
|
||||
/*
|
||||
* Other wsrep global variables.
|
||||
*/
|
||||
my_bool wsrep_inited = 0; // initialized ?
|
||||
|
||||
static const wsrep_uuid_t cluster_uuid = WSREP_UUID_UNDEFINED;
|
||||
const wsrep_uuid_t* wsrep_cluster_uuid()
|
||||
{
|
||||
@@ -414,6 +419,7 @@ static void wsrep_init_position()
|
||||
int wsrep_init()
|
||||
{
|
||||
int rcode= -1;
|
||||
DBUG_ASSERT(wsrep_inited == 0);
|
||||
|
||||
wsrep_ready_set(FALSE);
|
||||
assert(wsrep_provider);
|
||||
@@ -442,6 +448,7 @@ int wsrep_init()
|
||||
{
|
||||
// enable normal operation in case no provider is specified
|
||||
wsrep_ready_set(TRUE);
|
||||
wsrep_inited= 1;
|
||||
global_system_variables.wsrep_on = 0;
|
||||
return 0;
|
||||
}
|
||||
@@ -565,6 +572,8 @@ int wsrep_init()
|
||||
WSREP_ERROR("wsrep::init() failed: %d, must shutdown", rcode);
|
||||
free(wsrep);
|
||||
wsrep = NULL;
|
||||
} else {
|
||||
wsrep_inited= 1;
|
||||
}
|
||||
|
||||
return rcode;
|
||||
@@ -595,6 +604,7 @@ void wsrep_init_startup (bool first)
|
||||
|
||||
void wsrep_deinit()
|
||||
{
|
||||
DBUG_ASSERT(wsrep_inited == 1);
|
||||
wsrep_unload(wsrep);
|
||||
wsrep= 0;
|
||||
provider_name[0]= '\0';
|
||||
@@ -603,6 +613,7 @@ void wsrep_deinit()
|
||||
|
||||
delete wsrep_format_desc;
|
||||
wsrep_format_desc= NULL;
|
||||
wsrep_inited= 0;
|
||||
}
|
||||
|
||||
void wsrep_recover()
|
||||
|
||||
@@ -117,6 +117,9 @@ extern const char* wsrep_provider_vendor;
|
||||
extern int wsrep_show_status(THD *thd, SHOW_VAR *var, char *buff);
|
||||
extern void wsrep_free_status(THD *thd);
|
||||
|
||||
// Other wsrep global variables
|
||||
extern my_bool wsrep_inited; // whether wsrep is initialized ?
|
||||
|
||||
#define WSREP_SST_ADDRESS_AUTO "AUTO"
|
||||
#define WSREP_NODE_INCOMING_AUTO "AUTO"
|
||||
|
||||
|
||||
@@ -247,7 +247,8 @@ bool wsrep_provider_update (sys_var *self, THD* thd, enum_var_type type)
|
||||
wsrep_stop_replication(thd);
|
||||
mysql_mutex_lock(&LOCK_global_system_variables);
|
||||
|
||||
wsrep_deinit();
|
||||
if (wsrep_inited == 1)
|
||||
wsrep_deinit();
|
||||
|
||||
char* tmp= strdup(wsrep_provider); // wsrep_init() rewrites provider
|
||||
//when fails
|
||||
|
||||
Reference in New Issue
Block a user