diff --git a/mysql-test/suite/galera/galera_2nodes.cnf b/mysql-test/suite/galera/galera_2nodes.cnf index 1dbaad4f699..b8c61bc814d 100644 --- a/mysql-test/suite/galera/galera_2nodes.cnf +++ b/mysql-test/suite/galera/galera_2nodes.cnf @@ -9,7 +9,6 @@ default-storage-engine=innodb wsrep-provider=@ENV.WSREP_PROVIDER wsrep_node_address=127.0.0.1 # enforce read-committed characteristics across the cluster -wsrep-causal-reads=ON wsrep-sync-wait=7 [mysqld.1] diff --git a/mysql-test/suite/galera/r/galera_var_sync_wait.result b/mysql-test/suite/galera/r/galera_var_sync_wait.result index f6136a4ddc4..df9cdfbd159 100644 --- a/mysql-test/suite/galera/r/galera_var_sync_wait.result +++ b/mysql-test/suite/galera/r/galera_var_sync_wait.result @@ -1,3 +1,12 @@ +# +# MDEV-10161: wsrep_sync_wait not enabled when set to 1 in config file +# +SELECT @@global.wsrep_sync_wait; +@@global.wsrep_sync_wait +7 +SELECT @@global.wsrep_causal_reads; +@@global.wsrep_causal_reads +1 CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB; SET GLOBAL wsrep_sync_wait = 1; SHOW TABLES LIKE '%t1'; diff --git a/mysql-test/suite/galera/t/galera_var_sync_wait.test b/mysql-test/suite/galera/t/galera_var_sync_wait.test index 935c271a4d6..288ad62226f 100644 --- a/mysql-test/suite/galera/t/galera_var_sync_wait.test +++ b/mysql-test/suite/galera/t/galera_var_sync_wait.test @@ -5,6 +5,13 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--echo # +--echo # MDEV-10161: wsrep_sync_wait not enabled when set to 1 in config file +--echo # +# galera_2nodes.cnf sets wsrep_sync_wait to 7 +SELECT @@global.wsrep_sync_wait; +SELECT @@global.wsrep_causal_reads; + --let $wsrep_sync_wait_orig = `SELECT @@wsrep_sync_wait` --connection node_1 diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 6c8f79bf37a..a19ac8aa968 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -9266,6 +9266,16 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument) #endif break; } +#ifdef WITH_WSREP + case OPT_WSREP_CAUSAL_READS: + wsrep_causal_reads_update(&global_system_variables); + break; + case OPT_WSREP_SYNC_WAIT: + global_system_variables.wsrep_causal_reads= + MY_TEST(global_system_variables.wsrep_sync_wait & + WSREP_SYNC_WAIT_BEFORE_READ); + break; +#endif /* WITH_WSREP */ } return 0; } diff --git a/sql/mysqld.h b/sql/mysqld.h index 594afac521d..8454f2410dc 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -636,6 +636,10 @@ enum options_mysqld OPT_SSL_KEY, OPT_THREAD_CONCURRENCY, OPT_WANT_CORE, +#ifdef WITH_WSREP + OPT_WSREP_CAUSAL_READS, + OPT_WSREP_SYNC_WAIT, +#endif /* WITH_WSREP */ OPT_MYSQL_COMPATIBILITY, OPT_MYSQL_TO_BE_IMPLEMENTED, OPT_which_is_always_the_last diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 29e167d4664..c733976452c 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -4872,7 +4872,8 @@ static bool fix_wsrep_causal_reads(sys_var *self, THD* thd, enum_var_type var_ty static Sys_var_mybool Sys_wsrep_causal_reads( "wsrep_causal_reads", "Setting this variable is equivalent " "to setting wsrep_sync_wait READ flag", - SESSION_VAR(wsrep_causal_reads), CMD_LINE(OPT_ARG), DEFAULT(FALSE), + SESSION_VAR(wsrep_causal_reads), + CMD_LINE(OPT_ARG, OPT_WSREP_CAUSAL_READS), DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_wsrep_causal_reads), DEPRECATED("'@@wsrep_sync_wait=1'")); @@ -4882,7 +4883,7 @@ static Sys_var_uint Sys_wsrep_sync_wait( "an operation of the type specified by bitmask: 1 - READ(includes " "SELECT, SHOW and BEGIN/START TRANSACTION); 2 - UPDATE and DELETE; 4 - " "INSERT and REPLACE", - SESSION_VAR(wsrep_sync_wait), CMD_LINE(OPT_ARG), + SESSION_VAR(wsrep_sync_wait), CMD_LINE(OPT_ARG, OPT_WSREP_SYNC_WAIT), VALID_RANGE(WSREP_SYNC_WAIT_NONE, WSREP_SYNC_WAIT_MAX), DEFAULT(WSREP_SYNC_WAIT_NONE), BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 7b242af2cdb..823a2a76281 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -561,8 +561,6 @@ int wsrep_init() wsrep_sst_auth_init(wsrep_sst_auth); - wsrep_causal_reads_update(&global_system_variables); - wsrep_ready_set(FALSE); assert(wsrep_provider);