diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-09-23 13:40:42 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-09-23 13:40:42 +0300 |
commit | a69cf6f07ee7286d4813ef5c602d5b79b39d3028 (patch) | |
tree | 6068dad43fbda21245e341a6da0164fc7ef01bd1 /sql/debug_sync.cc | |
parent | db7e04ed3ab5d591a323443cb20c3a45792916b6 (diff) | |
download | mariadb-git-a69cf6f07ee7286d4813ef5c602d5b79b39d3028.tar.gz |
MDEV-29613 Improve WITH_DBUG_TRACE=OFF
In commit 28325b08633372cc343dfcbc41fe252020cf6e6e
a compile-time option was introduced to disable the macros
DBUG_ENTER and DBUG_RETURN or DBUG_VOID_RETURN.
The parameter name WITH_DBUG_TRACE would hint that it also
covers DBUG_PRINT statements. Let us do that: WITH_DBUG_TRACE=OFF
shall disable DBUG_PRINT() as well.
A few InnoDB recovery tests used to check that some output from
DBUG_PRINT("ib_log", ...) is present. We can live without those checks.
Reviewed by: Vladislav Vaintroub
Diffstat (limited to 'sql/debug_sync.cc')
-rw-r--r-- | sql/debug_sync.cc | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/sql/debug_sync.cc b/sql/debug_sync.cc index c037af40e33..16ff4abafe1 100644 --- a/sql/debug_sync.cc +++ b/sql/debug_sync.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2009, 2013, Oracle and/or its affiliates. - Copyright (c) 2013, 2020, MariaDB + Copyright (c) 2013, 2022, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -326,7 +326,7 @@ static char *debug_sync_bmove_len(char *to, char *to_end, } -#if !defined(DBUG_OFF) +#ifdef DBUG_TRACE /** Create a string that describes an action. @@ -416,8 +416,7 @@ static void debug_sync_print_actions(THD *thd) DBUG_VOID_RETURN; } - -#endif /* !defined(DBUG_OFF) */ +#endif /* defined(DBUG_TRACE) */ /** @@ -748,6 +747,7 @@ static bool debug_sync_set_action(THD *thd, st_debug_sync_action *action) else { const char *dsp_name= action->sync_point.c_ptr(); +#ifdef DBUG_TRACE DBUG_EXECUTE("debug_sync", { /* Functions as DBUG_PRINT args can change keyword and line nr. */ const char *sig_emit= action->signal.c_ptr(); @@ -758,6 +758,7 @@ static bool debug_sync_set_action(THD *thd, st_debug_sync_action *action) dsp_name, action->activation_count, action->hit_limit, action->execute, action->timeout, sig_emit, sig_wait));}); +#endif /* Check this before sorting the array. action may move. */ is_dsp_now= !my_strcasecmp(system_charset_info, dsp_name, "now"); @@ -770,7 +771,9 @@ static bool debug_sync_set_action(THD *thd, st_debug_sync_action *action) sizeof(st_debug_sync_action), debug_sync_qsort_cmp); } } +#ifdef DBUG_TRACE DBUG_EXECUTE("debug_sync_list", debug_sync_print_actions(thd);); +#endif /* Execute the special sync point 'now' if activated above. */ if (is_dsp_now) @@ -1334,7 +1337,7 @@ uchar *debug_sync_value_ptr(THD *thd) static void debug_sync_execute(THD *thd, st_debug_sync_action *action) { -#ifndef DBUG_OFF +#ifdef DBUG_TRACE const char *dsp_name= action->sync_point.c_ptr(); const char *sig_emit= action->signal.c_ptr(); const char *sig_wait= action->wait_for.c_ptr(); @@ -1425,12 +1428,12 @@ static void debug_sync_execute(THD *thd, st_debug_sync_action *action) restore_current_mutex = false; set_timespec(abstime, action->timeout); - DBUG_EXECUTE("debug_sync_exec", { + DBUG_EXECUTE("debug_sync_exec", /* Functions as DBUG_PRINT args can change keyword and line nr. */ - const char *sig_glob= debug_sync_global.ds_signal.c_ptr(); DBUG_PRINT("debug_sync_exec", ("wait for '%s' at: '%s' curr: '%s'", - sig_wait, dsp_name, sig_glob));}); + sig_wait, dsp_name, + debug_sync_global.ds_signal.c_ptr()));); /* Wait until global signal string matches the wait_for string. @@ -1444,12 +1447,12 @@ static void debug_sync_execute(THD *thd, st_debug_sync_action *action) error= mysql_cond_timedwait(&debug_sync_global.ds_cond, &debug_sync_global.ds_mutex, &abstime); - DBUG_EXECUTE("debug_sync", { + DBUG_EXECUTE("debug_sync", /* Functions as DBUG_PRINT args can change keyword and line nr. */ - const char *sig_glob= debug_sync_global.ds_signal.c_ptr(); DBUG_PRINT("debug_sync", ("awoke from %s global: %s error: %d", - sig_wait, sig_glob, error));}); + sig_wait, debug_sync_global.ds_signal.c_ptr(), + error));); if (unlikely(error == ETIMEDOUT || error == ETIME)) { // We should not make the statement fail, even if in strict mode. |