summaryrefslogtreecommitdiff
path: root/sql/debug_sync.cc
diff options
context:
space:
mode:
authorVicențiu Ciorbaru <cvicentiu@gmail.com>2021-09-29 11:24:05 +0300
committerVicențiu Ciorbaru <cvicentiu@gmail.com>2023-02-03 16:27:16 +0200
commitcd873c8688a6f21b3c859068d3146e9fd90120b0 (patch)
tree98f32a36a871d7dc179b36c1a441364c50f869e1 /sql/debug_sync.cc
parent8885225de66906dc424be8f6ffc4d1b68e54ebca (diff)
downloadmariadb-git-cd873c8688a6f21b3c859068d3146e9fd90120b0.tar.gz
debug_sync: Implement NO_CLEAR_EVENT syntax
When waiting on a signal, NO_CLEAR_EVENT allows one to not clear the signal, effectively allowing other threads to wait for the same signal.
Diffstat (limited to 'sql/debug_sync.cc')
-rw-r--r--sql/debug_sync.cc18
1 files changed, 16 insertions, 2 deletions
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",