diff options
Diffstat (limited to 'sql/wsrep_var.cc')
-rw-r--r-- | sql/wsrep_var.cc | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index 9a5c7b86068..20091a3893e 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -64,19 +64,21 @@ bool wsrep_on_update (sys_var *self, THD* thd, enum_var_type var_type) bool wsrep_causal_reads_update (sys_var *self, THD* thd, enum_var_type var_type) { - // wsrep_sync_wait should also be updated. - if (var_type == OPT_GLOBAL) { - if (global_system_variables.wsrep_causal_reads) { - global_system_variables.wsrep_sync_wait |= WSREP_SYNC_WAIT_BEFORE_READ; - } else { - global_system_variables.wsrep_sync_wait &= ~WSREP_SYNC_WAIT_BEFORE_READ; - } + // global setting should not affect session setting. + // if (var_type == OPT_GLOBAL) { + // thd->variables.wsrep_causal_reads = global_system_variables.wsrep_causal_reads; + // } + if (thd->variables.wsrep_causal_reads) { + thd->variables.wsrep_sync_wait |= WSREP_SYNC_WAIT_BEFORE_READ; } else { - if (thd->variables.wsrep_causal_reads) { - thd->variables.wsrep_sync_wait |= WSREP_SYNC_WAIT_BEFORE_READ; - } else { - thd->variables.wsrep_sync_wait &= ~WSREP_SYNC_WAIT_BEFORE_READ; - } + thd->variables.wsrep_sync_wait &= ~WSREP_SYNC_WAIT_BEFORE_READ; + } + + // update global settings too. + if (global_system_variables.wsrep_causal_reads) { + global_system_variables.wsrep_sync_wait |= WSREP_SYNC_WAIT_BEFORE_READ; + } else { + global_system_variables.wsrep_sync_wait &= ~WSREP_SYNC_WAIT_BEFORE_READ; } return false; @@ -84,14 +86,17 @@ bool wsrep_causal_reads_update (sys_var *self, THD* thd, enum_var_type var_type) bool wsrep_sync_wait_update (sys_var* self, THD* thd, enum_var_type var_type) { - // wsrep_causal_reads should also be updated. - if (var_type == OPT_GLOBAL) { - global_system_variables.wsrep_causal_reads= - global_system_variables.wsrep_sync_wait & WSREP_SYNC_WAIT_BEFORE_READ; - } else { - thd->variables.wsrep_causal_reads= - thd->variables.wsrep_sync_wait & WSREP_SYNC_WAIT_BEFORE_READ; - } + // global setting should not affect session setting. + // if (var_type == OPT_GLOBAL) { + // thd->variables.wsrep_sync_wait = global_system_variables.wsrep_sync_wait; + // } + thd->variables.wsrep_causal_reads = thd->variables.wsrep_sync_wait & + WSREP_SYNC_WAIT_BEFORE_READ; + + // update global settings too + global_system_variables.wsrep_causal_reads = global_system_variables.wsrep_sync_wait & + WSREP_SYNC_WAIT_BEFORE_READ; + return false; } |