summaryrefslogtreecommitdiff
path: root/sql/wsrep_var.cc
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2017-08-15 13:57:15 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2017-08-15 13:57:15 +0300
commit5017c261d4b6332ffff70919080a99fd5e459ed1 (patch)
treed4a046d2ddb354c2eb9390f0782e495ef22b1b18 /sql/wsrep_var.cc
parentb5323054af2375cf5595c7d18fb2f22849f4e844 (diff)
downloadmariadb-git-5017c261d4b6332ffff70919080a99fd5e459ed1.tar.gz
Fix test failure on test MW-86 and remove MW-360 test.
Merged from mysql-wsrep-bugs following: GCF-1058 MTR test galera.MW-86 fails on repeated runs Wait for the sync point sync.wsrep_apply_cb to be reached before executing the test and clearing the debug flag sync.wsrep_apply_cb. The race scenario: Intended behavior: node2: set sync.wsrep_apply_cb in order to start waiting in the background INSERT node1: INSERT start node2 (background): INSERT start node1: INSERT end node2: send signal to background INSERT: "stop waiting and continue executing" node2: clear sync.wsrep_apply_cb as no longer needed node2 (background): consume the signal node2 (background): INSERT end node2: DROP TABLE node2: check no pending signals are left - ok What happens occasionally (unexpected): node2: set sync.wsrep_apply_cb in order to start waiting in the background INSERT node1: INSERT start node2 (background): INSERT start node1: INSERT end // The background INSERT still has _not_ reached the place where it starts // waiting for the signal: // DBUG_EXECUTE_IF("sync.wsrep_apply_cb", "now wait_for..."); node2: send signal to background INSERT: "stop waiting and continue executing" node2: clear sync.wsrep_apply_cb as no longer needed // The background INSERT reaches DBUG_EXECUTE_IF("sync.wsrep_apply_cb", ...) // but sync.wsrep_apply_cb has already been cleared and the "wait" code is not // executed. The signal remains unconsumed. node2 (background): INSERT end node2: DROP TABLE node2: check no pending signals are left - failure, signal.wsrep_apply_cb is pending (not consumed) Remove MW-360 test case as it is not intended for MariaDB (uses MySQL GTID).
Diffstat (limited to 'sql/wsrep_var.cc')
-rw-r--r--sql/wsrep_var.cc45
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;
}