summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/main/debug_sync.result16
-rw-r--r--mysql-test/main/debug_sync.test11
-rw-r--r--sql/debug_sync.cc18
3 files changed, 43 insertions, 2 deletions
diff --git a/mysql-test/main/debug_sync.result b/mysql-test/main/debug_sync.result
index 45cdc40e241..9b6699f9bc2 100644
--- a/mysql-test/main/debug_sync.result
+++ b/mysql-test/main/debug_sync.result
@@ -299,4 +299,20 @@ disconnect con1;
disconnect con2;
connection default;
DROP TABLE t1;
+#
+# Test NO_CLEAR_EVENT flag. The signal should still be visible after
+# the wait has completed succesfully.
+#
+SET DEBUG_SYNC= 'now SIGNAL s1';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+Variable_name Value
+debug_sync ON - current signals: 's1'
+SET DEBUG_SYNC= 'now WAIT_FOR s1 NO_CLEAR_EVENT';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+Variable_name Value
+debug_sync ON - current signals: 's1'
+SET DEBUG_SYNC= 'now WAIT_FOR s1';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+Variable_name Value
+debug_sync ON - current signals: ''
SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/main/debug_sync.test b/mysql-test/main/debug_sync.test
index 0e57071e08a..0ea637a393a 100644
--- a/mysql-test/main/debug_sync.test
+++ b/mysql-test/main/debug_sync.test
@@ -428,6 +428,17 @@ disconnect con2;
connection default;
DROP TABLE t1;
+--echo #
+--echo # Test NO_CLEAR_EVENT flag. The signal should still be visible after
+--echo # the wait has completed succesfully.
+--echo #
+SET DEBUG_SYNC= 'now SIGNAL s1';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+SET DEBUG_SYNC= 'now WAIT_FOR s1 NO_CLEAR_EVENT';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+SET DEBUG_SYNC= 'now WAIT_FOR s1';
+SHOW VARIABLES LIKE 'DEBUG_SYNC';
+
#
# Cleanup after test case.
# Otherwise signal would contain 'flushed' here,
diff --git a/sql/debug_sync.cc b/sql/debug_sync.cc
index 6c847dc9927..cdbeed1244f 100644
--- a/sql/debug_sync.cc
+++ b/sql/debug_sync.cc
@@ -48,6 +48,8 @@ struct st_debug_sync_action
String wait_for; /* signal to wait for */
String sync_point; /* sync point name */
bool need_sort; /* if new action, array needs sort */
+ bool clear_event; /* do not clear signal when waited
+ for if false. */
};
/* Debug sync control. Referenced by THD. */
@@ -1253,6 +1255,7 @@ static bool debug_sync_eval_action(THD *thd, char *action_str, char *action_end)
/* Set default for EXECUTE and TIMEOUT options. */
action->execute= 1;
action->timeout= opt_debug_sync_timeout;
+ action->clear_event= true;
/* Get next token. If none follows, set action. */
if (!(ptr= debug_sync_token(&token, &token_length, ptr, action_end)))
@@ -1304,6 +1307,15 @@ static bool debug_sync_eval_action(THD *thd, char *action_str, char *action_end)
}
/*
+ Try NO_CLEAR_EVENT.
+ */
+ if (!my_strcasecmp(system_charset_info, token, "NO_CLEAR_EVENT")) {
+ action->clear_event= false;
+ /* Get next token. If none follows, set action. */
+ if (!(ptr = debug_sync_token(&token, &token_length, ptr, action_end))) goto set_action;
+ }
+
+ /*
Try HIT_LIMIT.
*/
if (!my_strcasecmp(system_charset_info, token, "HIT_LIMIT"))
@@ -1591,8 +1603,10 @@ static void debug_sync_execute(THD *thd, st_debug_sync_action *action)
}
error= 0;
}
- // TODO conditional on clear-event
- debug_sync_global.clear_signal(action->wait_for);
+
+ if (action->clear_event)
+ debug_sync_global.clear_signal(action->wait_for);
+
DBUG_EXECUTE("debug_sync_exec",
if (thd->killed)
DBUG_PRINT("debug_sync_exec",