MDEV-24546 : AddressSanitizer: initialization-order-fiasco on address ... in Sys_var_integer from __static_initialization_and_destruction_0, possibly inside global var wsrep_gtid_server

Galera parameter wsrep_gtid_domain_id was defined using a class where
actual parameter was not a first member. Fixed this by using normal
variable and assigning this value to class member value.
This commit is contained in:
Jan Lindström 2021-01-09 09:03:39 +02:00
parent fae87e0c74
commit 49b8774951
5 changed files with 15 additions and 2 deletions

View File

@ -6051,8 +6051,10 @@ static Sys_var_uint Sys_wsrep_gtid_domain_id(
"wsrep_gtid_domain_id", "When wsrep_gtid_mode is set, this value is "
"used as gtid_domain_id for galera transactions and also copied to the "
"joiner nodes during state transfer. It is ignored, otherwise.",
GLOBAL_VAR(wsrep_gtid_server.domain_id), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX32), DEFAULT(0), BLOCK_SIZE(1));
GLOBAL_VAR(wsrep_gtid_domain_id), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX32), DEFAULT(0), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(wsrep_gtid_domain_id_update));
static Sys_var_ulonglong Sys_wsrep_gtid_seq_no(
"wsrep_gtid_seq_no",

View File

@ -110,6 +110,7 @@ ulong wsrep_mysql_replication_bundle;
bool wsrep_gtid_mode; // Enable WSREP native GTID support
Wsrep_gtid_server wsrep_gtid_server;
uint wsrep_gtid_domain_id=0; // Domain id on above structure
/* Other configuration variables and their default values. */
my_bool wsrep_incremental_data_collection= 0; // Incremental data collection

View File

@ -101,6 +101,7 @@ extern ulong wsrep_running_rollbacker_threads;
extern bool wsrep_new_cluster;
extern bool wsrep_gtid_mode;
extern my_bool wsrep_strict_ddl;
extern uint wsrep_gtid_domain_id;
enum enum_wsrep_reject_types {
WSREP_REJECT_NONE, /* nothing rejected */

View File

@ -961,3 +961,11 @@ void wsrep_free_status (THD* thd)
{
thd->wsrep_status_vars.clear();
}
bool wsrep_gtid_domain_id_update(sys_var* self, THD *thd, enum_var_type)
{
WSREP_DEBUG("wsrep_gtid_domain_id_update: %llu",
wsrep_gtid_domain_id);
wsrep_gtid_server.domain_id= wsrep_gtid_domain_id;
return false;
}

View File

@ -105,6 +105,7 @@ extern bool wsrep_debug_update UPDATE_ARGS;
extern bool wsrep_gtid_seq_no_check CHECK_ARGS;
extern bool wsrep_gtid_domain_id_update UPDATE_ARGS;
#else /* WITH_WSREP */
#define wsrep_provider_init(X)