diff options
31 files changed, 89 insertions, 99 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 94b459c583b..78ff7c0fb9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -248,9 +248,11 @@ ENDIF() INCLUDE(wsrep) -OPTION(WITH_DBUG_TRACE "Enable DBUG_ENTER()/DBUG_EXIT()" ON) +OPTION(WITH_DBUG_TRACE "Enable DBUG_ENTER()/DBUG_RETURN()/DBUG_PRINT()" ON) IF(WITH_DBUG_TRACE) - ADD_DEFINITIONS(-DDBUG_TRACE) + FOREACH(LANG C CXX) + SET(CMAKE_${LANG}_FLAGS_DEBUG "${CMAKE_${LANG}_FLAGS_DEBUG} -DDBUG_TRACE") + ENDFOREACH() ENDIF() # Always enable debug sync for debug builds. diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index a270a3edd04..714a7947b9e 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -6158,18 +6158,18 @@ static bool xtrabackup_prepare_func(char** argv) { for (int i= 0; i < got; i++) { -#ifndef DBUG_OFF +#ifdef DBUG_TRACE int rc= -#endif // !DBUG_OFF +#endif innobase_rollback_by_xid(NULL, xid_list + i); -#ifndef DBUG_OFF +#ifdef DBUG_TRACE if (rc == 0) { char buf[XIDDATASIZE * 4 + 6]; // see xid_to_str DBUG_PRINT("info", ("rollback xid %s", xid_to_str(buf, xid_list[i]))); } -#endif // !DBUG_OFF +#endif } } ut_d(recv_no_log_write= true); diff --git a/include/my_dbug.h b/include/my_dbug.h index 9ae482005b9..e69ee4f8ed5 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -74,6 +74,9 @@ extern int (*dbug_sanity)(void); _db_stack_frame_.line= 0; \ } while(0) +#define DBUG_PRINT(keyword,arglist) \ + do if (_db_pargs_(__LINE__,keyword)) _db_doprnt_ arglist; while(0) + #ifdef HAVE_ATTRIBUTE_CLEANUP #define DBUG_ENTER(a) struct _db_stack_frame_ _db_stack_frame_ __attribute__((cleanup(_db_return_))); \ _db_enter_ (a,__FILE__,__LINE__,&_db_stack_frame_) @@ -91,6 +94,7 @@ extern int (*dbug_sanity)(void); #define DBUG_ENTER(a) #define DBUG_RETURN(a1) return(a1) #define DBUG_VOID_RETURN return +#define DBUG_PRINT(keyword,arglist) do{} while(0) #endif #define DBUG_EXECUTE(keyword,a1) \ @@ -101,8 +105,6 @@ extern int (*dbug_sanity)(void); (_db_keyword_(0,(keyword), 0) ? (a1) : (a2)) #define DBUG_EVALUATE_IF(keyword,a1,a2) \ (_db_keyword_(0,(keyword), 1) ? (a1) : (a2)) -#define DBUG_PRINT(keyword,arglist) \ - do if (_db_pargs_(__LINE__,keyword)) _db_doprnt_ arglist; while(0) #define DBUG_PUSH(a1) _db_push_ (a1) #define DBUG_POP() _db_pop_ () #define DBUG_SET(a1) _db_set_ (a1) @@ -164,6 +166,7 @@ extern void _db_suicide_(void); #define DBUG_LEAVE #define DBUG_RETURN(a1) do { return(a1); } while(0) #define DBUG_VOID_RETURN do { return; } while(0) +#define DBUG_PRINT(keyword, arglist) do { } while(0) #define DBUG_EXECUTE(keyword,a1) do { } while(0) #define DBUG_EXECUTE_IF(keyword,a1) do { } while(0) #define DBUG_EVALUATE(keyword,a1,a2) (a2) diff --git a/mysql-test/suite/encryption/r/debug_key_management.result b/mysql-test/suite/encryption/r/debug_key_management.result index 911a369f0c6..7fe681d52ae 100644 --- a/mysql-test/suite/encryption/r/debug_key_management.result +++ b/mysql-test/suite/encryption/r/debug_key_management.result @@ -15,7 +15,6 @@ set global debug_key_management_version=10; select count(*) from information_schema.innodb_tablespaces_encryption where current_key_version <> 10; count(*) 0 -SET GLOBAL debug_dbug = '+d,ib_log'; SET GLOBAL innodb_log_checkpoint_now = 1; SET GLOBAL innodb_flush_log_at_trx_commit = 1; INSERT INTO t1 VALUES(NULL); diff --git a/mysql-test/suite/encryption/t/debug_key_management.test b/mysql-test/suite/encryption/t/debug_key_management.test index c370ecf5bd8..15a560d4c42 100644 --- a/mysql-test/suite/encryption/t/debug_key_management.test +++ b/mysql-test/suite/encryption/t/debug_key_management.test @@ -25,7 +25,6 @@ let $wait_condition= select count(*) = $tables_count from information_schema.inn select count(*) from information_schema.innodb_tablespaces_encryption where current_key_version <> 10; # Test redo log key rotation and crash recovery. -SET GLOBAL debug_dbug = '+d,ib_log'; SET GLOBAL innodb_log_checkpoint_now = 1; SET GLOBAL innodb_flush_log_at_trx_commit = 1; INSERT INTO t1 VALUES(NULL); diff --git a/mysql-test/suite/innodb/r/log_alter_table.result b/mysql-test/suite/innodb/r/log_alter_table.result index 9de89bebaa6..db20982cbaa 100644 --- a/mysql-test/suite/innodb/r/log_alter_table.result +++ b/mysql-test/suite/innodb/r/log_alter_table.result @@ -11,11 +11,8 @@ INSERT INTO t1 VALUES (1,2); ALTER TABLE t1 ADD PRIMARY KEY(a), LOCK=SHARED, ALGORITHM=INPLACE; ALTER TABLE t1 DROP INDEX b, ADD INDEX (b), LOCK=SHARED; # Kill the server -# restart: --debug=d,ib_log -FOUND 2 /scan \d+: multi-log rec MLOG_FILE_CREATE2 len \d+ page \d+:0/ in mysqld.1.err -FOUND 3 /scan \d+: log rec MLOG_INDEX_LOAD/ in mysqld.1.err +# restart CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK -# restart DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/log_file_name_debug.result b/mysql-test/suite/innodb/r/log_file_name_debug.result index 2b81caa26b7..2ec4761e945 100644 --- a/mysql-test/suite/innodb/r/log_file_name_debug.result +++ b/mysql-test/suite/innodb/r/log_file_name_debug.result @@ -9,10 +9,9 @@ CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; SELECT * FROM t1; ERROR 42000: Unknown storage engine 'InnoDB' FOUND 1 /InnoDB: Tablespace 4294967280 was not found at .*, but there were no modifications either/ in mysqld.1.err -# restart: --debug=d,innodb_log_abort_3,ib_log --innodb-log-files-in-group=1 --innodb-log-file-size=4M +# restart: --debug=d,innodb_log_abort_3 --innodb-log-files-in-group=1 --innodb-log-file-size=4M SELECT * FROM t1; ERROR 42000: Unknown storage engine 'InnoDB' -FOUND 1 /ib_log: MLOG_CHECKPOINT.* written/ in mysqld.1.err # restart # restart DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/log_alter_table.test b/mysql-test/suite/innodb/t/log_alter_table.test index c92953f16a1..0b396078284 100644 --- a/mysql-test/suite/innodb/t/log_alter_table.test +++ b/mysql-test/suite/innodb/t/log_alter_table.test @@ -26,22 +26,7 @@ ALTER TABLE t1 DROP INDEX b, ADD INDEX (b), LOCK=SHARED; --let CLEANUP_IF_CHECKPOINT=DROP TABLE t1; --source include/no_checkpoint_end.inc ---let $restart_parameters= --debug=d,ib_log --source include/start_mysqld.inc -let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err; -let SEARCH_ABORT=NOT FOUND; -# ensure that we have exactly 2 records there. -let SEARCH_PATTERN=scan \d+: multi-log rec MLOG_FILE_CREATE2 len \d+ page \d+:0; ---source include/search_pattern_in_file.inc -# ensure that we have exactly 3 records there. -let SEARCH_PATTERN=scan \d+: log rec MLOG_INDEX_LOAD; ---source include/search_pattern_in_file.inc - CHECK TABLE t1; - -# Remove the --debug=d,ib_log setting. ---let $restart_parameters= ---source include/restart_mysqld.inc - DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/log_file_name_debug.test b/mysql-test/suite/innodb/t/log_file_name_debug.test index 584d3dc1d5d..f8ce342503a 100644 --- a/mysql-test/suite/innodb/t/log_file_name_debug.test +++ b/mysql-test/suite/innodb/t/log_file_name_debug.test @@ -35,12 +35,10 @@ SELECT * FROM t1; --let SEARCH_PATTERN = InnoDB: Tablespace 4294967280 was not found at .*, but there were no modifications either --source include/search_pattern_in_file.inc ---let $restart_parameters= --debug=d,innodb_log_abort_3,ib_log $resize +--let $restart_parameters= --debug=d,innodb_log_abort_3 $resize --source include/restart_mysqld.inc --error ER_UNKNOWN_STORAGE_ENGINE SELECT * FROM t1; ---let SEARCH_PATTERN= ib_log: MLOG_CHECKPOINT.* written ---source include/search_pattern_in_file.inc --let $restart_parameters= --source include/restart_mysqld.inc diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index f09739ae8af..568064b2a7c 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2017, MariaDB Corporation. + Copyright (c) 2017, 2022, MariaDB Corporation. 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 @@ -376,7 +376,7 @@ static void keycache_debug_print(const char *fmt,...); #define KEYCACHE_DBUG_ASSERT(a) DBUG_ASSERT(a) #endif /* defined(KEYCACHE_DEBUG_LOG) && defined(KEYCACHE_DEBUG) */ -#if defined(KEYCACHE_DEBUG) || !defined(DBUG_OFF) +#if defined(KEYCACHE_DEBUG) || defined(DBUG_TRACE) static long keycache_thread_id; #define KEYCACHE_THREAD_TRACE(l) \ KEYCACHE_DBUG_PRINT(l,("|thread %ld",keycache_thread_id)) @@ -392,7 +392,7 @@ static long keycache_thread_id; #define KEYCACHE_THREAD_TRACE_BEGIN(l) #define KEYCACHE_THREAD_TRACE_END(l) #define KEYCACHE_THREAD_TRACE(l) -#endif /* defined(KEYCACHE_DEBUG) || !defined(DBUG_OFF) */ +#endif /* defined(KEYCACHE_DEBUG) || defined(DBUG_TRACE) */ #define BLOCK_NUMBER(b) \ ((uint) (((char*)(b)-(char *) keycache->block_root)/sizeof(BLOCK_LINK))) 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. diff --git a/sql/event_queue.cc b/sql/event_queue.cc index 96a5e93cfe6..516bdc9158f 100644 --- a/sql/event_queue.cc +++ b/sql/event_queue.cc @@ -538,7 +538,7 @@ Event_queue::empty_queue() void Event_queue::dbug_dump_queue(my_time_t when) { -#ifndef DBUG_OFF +#ifdef DBUG_TRACE my_time_t now= when; Event_queue_element *et; uint i; diff --git a/sql/field.cc b/sql/field.cc index 148eaa71c00..853b0c62f14 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -3269,7 +3269,7 @@ bool Field_new_decimal::store_value(const my_decimal *decimal_value, DBUG_ASSERT(marked_for_write_or_computed()); int error= 0; DBUG_ENTER("Field_new_decimal::store_value"); -#ifndef DBUG_OFF +#ifdef DBUG_TRACE { char dbug_buff[DECIMAL_MAX_STR_LENGTH+2]; DBUG_PRINT("enter", ("value: %s", dbug_decimal_as_string(dbug_buff, decimal_value))); @@ -3284,7 +3284,7 @@ bool Field_new_decimal::store_value(const my_decimal *decimal_value, error= 1; decimal_value= &decimal_zero; } -#ifndef DBUG_OFF +#ifdef DBUG_TRACE { char dbug_buff[DECIMAL_MAX_STR_LENGTH+2]; DBUG_PRINT("info", ("saving with precision %d scale: %d value %s", @@ -3376,7 +3376,7 @@ int Field_new_decimal::store(const char *from, size_t length, } } -#ifndef DBUG_OFF +#ifdef DBUG_TRACE char dbug_buff[DECIMAL_MAX_STR_LENGTH+2]; DBUG_PRINT("enter", ("value: %s", dbug_decimal_as_string(dbug_buff, &decimal_value))); diff --git a/sql/gcalc_slicescan.cc b/sql/gcalc_slicescan.cc index b3752420316..c0794688b76 100644 --- a/sql/gcalc_slicescan.cc +++ b/sql/gcalc_slicescan.cc @@ -116,16 +116,20 @@ static void GCALC_DBUG_PRINT_PI(const Gcalc_heap::Info *pi) int n_buf; if (pi->type == Gcalc_heap::nt_intersection) { +#ifdef DBUG_TRACE const Gcalc_scan_iterator::intersection_info *ic= i_data(pi); GCALC_DBUG_PRINT(("intersection point %d %d", ic->edge_a->thread, ic->edge_b->thread)); +#endif return; } if (pi->type == Gcalc_heap::nt_eq_node) { +#ifdef DBUG_TRACE const Gcalc_scan_iterator::point *e= eq_sp(pi); GCALC_DBUG_PRINT(("eq point %d", e->thread)); +#endif return; } n_buf= gcalc_pi_str(buf, pi, ""); diff --git a/sql/log.h b/sql/log.h index ed4bcd9479c..1707a8c8831 100644 --- a/sql/log.h +++ b/sql/log.h @@ -726,7 +726,7 @@ public: } void harvest_bytes_written(Atomic_counter<uint64> *counter) { -#ifndef DBUG_OFF +#ifdef DBUG_TRACE char buf1[22],buf2[22]; #endif DBUG_ENTER("harvest_bytes_written"); diff --git a/sql/log_event.cc b/sql/log_event.cc index 1d32760c084..914a4595b62 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2019, Oracle and/or its affiliates. - Copyright (c) 2009, 2021, MariaDB + Copyright (c) 2009, 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 @@ -4557,7 +4557,7 @@ static void copy_str_and_move(const char **src, } -#ifndef DBUG_OFF +#ifdef DBUG_TRACE static char const * code_name(int code) { diff --git a/sql/mdl.cc b/sql/mdl.cc index 0a0f877d0e0..1a4d4c24d31 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -2278,7 +2278,7 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout) MDL_ticket *ticket; MDL_wait::enum_wait_status wait_status; DBUG_ENTER("MDL_context::acquire_lock"); -#ifndef DBUG_OFF +#ifdef DBUG_TRACE const char *mdl_lock_name= get_mdl_lock_name( mdl_request->key.mdl_namespace(), mdl_request->type)->str; #endif @@ -2304,7 +2304,7 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout) DBUG_RETURN(FALSE); } -#ifndef DBUG_OFF +#ifdef DBUG_TRACE const char *ticket_msg= dbug_print_mdl(ticket); #endif diff --git a/sql/rpl_injector.h b/sql/rpl_injector.h index ecf16ba28cf..6fff3fc2415 100644 --- a/sql/rpl_injector.h +++ b/sql/rpl_injector.h @@ -263,14 +263,14 @@ public: */ int check_state(enum_state const target_state) { -#ifndef DBUG_OFF +#ifdef DBUG_TRACE static char const *state_name[] = { "START_STATE", "TABLE_STATE", "ROW_STATE", "STATE_COUNT" }; - DBUG_ASSERT(target_state <= STATE_COUNT); DBUG_PRINT("info", ("In state %s", state_name[m_state])); #endif + DBUG_ASSERT(target_state <= STATE_COUNT); if (m_state <= target_state && target_state <= m_state + 1 && m_state < STATE_COUNT) diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc index 7da296b47d9..6266acf7805 100644 --- a/sql/rpl_record.cc +++ b/sql/rpl_record.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2007, 2013, Oracle and/or its affiliates. - Copyright (c) 2008, 2019, MariaDB Corporation. + Copyright (c) 2008, 2022, MariaDB Corporation. 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 @@ -319,7 +319,9 @@ unpack_row(rpl_group_info *rgi, normal unpack operation. */ uint16 const metadata= tabledef->field_metadata(i); - IF_DBUG(uchar const *const old_pack_ptr= pack_ptr;,) +#ifdef DBUG_TRACE + uchar const *const old_pack_ptr= pack_ptr; +#endif pack_ptr= f->unpack(f->ptr, pack_ptr, row_end, metadata); DBUG_PRINT("debug", ("field: %s; metadata: 0x%x;" diff --git a/sql/slave.cc b/sql/slave.cc index f883b13e7b5..d906066204e 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -3831,7 +3831,7 @@ apply_event_and_update_pos_apply(Log_event* ev, THD* thd, rpl_group_info *rgi, } #endif -#ifndef DBUG_OFF +#ifdef DBUG_TRACE /* This only prints information to the debug trace. @@ -3857,7 +3857,7 @@ apply_event_and_update_pos_apply(Log_event* ev, THD* thd, rpl_group_info *rgi, if (exec_res == 0) { int error= ev->update_pos(rgi); - #ifndef DBUG_OFF +#ifdef DBUG_TRACE DBUG_PRINT("info", ("update_pos error = %d", error)); if (!rli->belongs_to_client()) { diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc index f1326d97a21..9961cf6e137 100644 --- a/sql/sql_binlog.cc +++ b/sql/sql_binlog.cc @@ -41,14 +41,13 @@ static int check_event_type(int type, Relay_log_info *rli) */ if (fd_event && fd_event->event_type_permutation) { - IF_DBUG({ - int new_type= fd_event->event_type_permutation[type]; - DBUG_PRINT("info", - ("converting event type %d to %d (%s)", - type, new_type, - Log_event::get_type_str((Log_event_type)new_type))); - }, - (void)0); +#ifdef DBUG_TRACE + int new_type= fd_event->event_type_permutation[type]; + DBUG_PRINT("info", + ("converting event type %d to %d (%s)", + type, new_type, + Log_event::get_type_str((Log_event_type)new_type))); +#endif type= fd_event->event_type_permutation[type]; } diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 92189c30bee..d6e77cc1259 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -4762,7 +4762,7 @@ void Query_cache::cache_dump() void Query_cache::queries_dump() { - +#ifdef DBUG_TRACE if (!initialized) { DBUG_PRINT("qcache", ("Query Cache not initialized")); @@ -4823,11 +4823,13 @@ void Query_cache::queries_dump() DBUG_PRINT("qcache", ("no queries in list")); } DBUG_PRINT("qcache", ("------------------")); +#endif } void Query_cache::tables_dump() { +#ifdef DBUG_TRACE if (!initialized || query_cache_size == 0) { DBUG_PRINT("qcache", ("Query Cache not initialized")); @@ -4850,6 +4852,7 @@ void Query_cache::tables_dump() else DBUG_PRINT("qcache", ("no tables in list")); DBUG_PRINT("qcache", ("--------------------")); +#endif } diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 4826597bb95..df3a7e2b704 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -7054,7 +7054,7 @@ int THD::binlog_flush_pending_rows_event(bool stmt_end, bool is_transactional) } -#if !defined(DBUG_OFF) && !defined(_lint) +#if defined(DBUG_TRACE) && !defined(_lint) static const char * show_query_type(THD::enum_binlog_query_type qtype) { diff --git a/sql/table.cc b/sql/table.cc index 37a23d5b93e..ffbc75e6d7c 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -8583,7 +8583,7 @@ int TABLE::update_virtual_fields(handler *h, enum_vcol_update_mode update_mode) { /* Compute the actual value of the virtual fields */ DBUG_FIX_WRITE_SET(vf); -# ifndef DBUG_OFF +# ifdef DBUG_TRACE int field_error= # endif vcol_info->expr->save_in_field(vf, 0); diff --git a/storage/innobase/que/que0que.cc b/storage/innobase/que/que0que.cc index e98d50ea0fc..25631d0eec8 100644 --- a/storage/innobase/que/que0que.cc +++ b/storage/innobase/que/que0que.cc @@ -892,7 +892,7 @@ que_node_get_containing_loop_node( return(node); } -#ifndef DBUG_OFF +#ifdef DBUG_TRACE /** Gets information of an SQL query graph node. @return type description */ static MY_ATTRIBUTE((warn_unused_result, nonnull)) @@ -949,7 +949,7 @@ que_node_type_string( return("UNKNOWN NODE TYPE"); } } -#endif /* !DBUG_OFF */ +#endif /* DBUG_TRACE */ /**********************************************************************//** Performs an execution step on a query thread. diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index 98f9c49b9fa..fec443dfc56 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -1040,7 +1040,7 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo, share->state.state.data_file_length) || (share->data_file_type == NO_RECORD && record != 0)) { -#ifndef DBUG_OFF +#ifdef DBUG_TRACE char llbuff2[22], llbuff3[22]; #endif _ma_check_print_error(param, diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index e2d8114c712..78f211c824e 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -2661,7 +2661,7 @@ static my_bool translog_buffer_flush(struct st_translog_buffer *buffer) i < buffer->size; i+= TRANSLOG_PAGE_SIZE, pg++) { -#ifndef DBUG_OFF +#ifdef DBUG_TRACE TRANSLOG_ADDRESS addr= (buffer->offset + i); #endif DBUG_PRINT("info", ("send log form %lu till %lu address: " LSN_FMT " " @@ -2908,7 +2908,7 @@ static my_bool translog_page_validator(int res, PAGECACHE_IO_HOOK_ARGS *args) uint flags; uchar *page_pos; TRANSLOG_FILE *data= (TRANSLOG_FILE *) args->data; -#ifndef DBUG_OFF +#ifdef DBUG_TRACE pgcache_page_no_t offset= page_no * TRANSLOG_PAGE_SIZE; #endif DBUG_ENTER("translog_page_validator"); @@ -3268,7 +3268,7 @@ static my_bool translog_get_last_page_addr(TRANSLOG_ADDRESS *addr, my_off_t file_size; uint32 file_no= LSN_FILE_NO(*addr); TRANSLOG_FILE *file; -#ifndef DBUG_OFF +#ifdef DBUG_TRACE char buff[21]; #endif DBUG_ENTER("translog_get_last_page_addr"); diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c index e411cfbd54c..029176feee3 100644 --- a/storage/maria/ma_pagecache.c +++ b/storage/maria/ma_pagecache.c @@ -184,7 +184,7 @@ struct st_pagecache_hash_link enum PCBLOCK_TEMPERATURE { PCBLOCK_COLD /*free*/ , PCBLOCK_WARM , PCBLOCK_HOT }; /* debug info */ -#ifndef DBUG_OFF +#ifdef DBUG_TRACE static const char *page_cache_page_type_str[]= { /* used only for control page type changing during debugging */ @@ -219,8 +219,9 @@ static const char *page_cache_page_pin_str[]= "unpinned -> pinned", "pinned -> unpinned" }; +#endif /* DBUG_TRACE */ - +#ifndef DBUG_OFF typedef struct st_pagecache_pin_info { struct st_pagecache_pin_info *next, **prev; @@ -549,7 +550,7 @@ static void pagecache_debug_print _VARARGS((const char *fmt, ...)); #define KEYCACHE_DBUG_ASSERT(a) DBUG_ASSERT(a) #endif /* defined(PAGECACHE_DEBUG_LOG) && defined(PAGECACHE_DEBUG) */ -#if defined(PAGECACHE_DEBUG) || !defined(DBUG_OFF) +#if defined(PAGECACHE_DEBUG) || defined(DBUG_TRACE) static long pagecache_thread_id; #define KEYCACHE_THREAD_TRACE(l) \ KEYCACHE_DBUG_PRINT(l,("|thread %ld",pagecache_thread_id)) @@ -566,7 +567,7 @@ static long pagecache_thread_id; #define KEYCACHE_THREAD_TRACE_BEGIN(l) #define KEYCACHE_THREAD_TRACE_END(l) #define KEYCACHE_THREAD_TRACE(l) -#endif /* defined(PAGECACHE_DEBUG) || !defined(DBUG_OFF) */ +#endif /* defined(PAGECACHE_DEBUG) || defined(DBUG_TRACE) */ #define PCBLOCK_NUMBER(p, b) \ ((uint) (((char*)(b)-(char *) p->block_root)/sizeof(PAGECACHE_BLOCK_LINK))) @@ -3345,8 +3346,9 @@ uchar *pagecache_read(PAGECACHE *pagecache, unlock_pin= lock_to_pin[buff==0][lock].unlock_pin; PAGECACHE_BLOCK_LINK *fake_link; my_bool reg_request; -#ifndef DBUG_OFF +#ifdef DBUG_TRACE char llbuf[22]; +#endif DBUG_ENTER("pagecache_read"); DBUG_PRINT("enter", ("fd: %u page: %s buffer: %p level: %u " "t:%s (%d)%s->%s %s->%s", @@ -3361,7 +3363,6 @@ uchar *pagecache_read(PAGECACHE *pagecache, DBUG_ASSERT(buff != 0 || (buff == 0 && (unlock_pin == PAGECACHE_PIN || unlock_pin == PAGECACHE_PIN_LEFT_PINNED))); DBUG_ASSERT(pageno < ((1ULL) << 40)); -#endif if (!page_link) page_link= &fake_link; @@ -3976,8 +3977,9 @@ my_bool pagecache_write_part(PAGECACHE *pagecache, my_bool error= 0; int need_lock_change= write_lock_change_table[lock].need_lock_change; my_bool reg_request; -#ifndef DBUG_OFF +#ifdef DBUG_TRACE char llbuf[22]; +#endif DBUG_ENTER("pagecache_write_part"); DBUG_PRINT("enter", ("fd: %u page: %s level: %u type: %s lock: %s " "pin: %s mode: %s offset: %u size %u", @@ -3992,7 +3994,6 @@ my_bool pagecache_write_part(PAGECACHE *pagecache, DBUG_ASSERT(lock != PAGECACHE_LOCK_READ_UNLOCK); DBUG_ASSERT(offset + size <= pagecache->block_size); DBUG_ASSERT(pageno < ((1ULL) << 40)); -#endif if (!page_link) page_link= &fake_link; diff --git a/storage/maria/unittest/ma_pagecache_single.c b/storage/maria/unittest/ma_pagecache_single.c index 00e6efad0e6..3fcaf4e5c5c 100644 --- a/storage/maria/unittest/ma_pagecache_single.c +++ b/storage/maria/unittest/ma_pagecache_single.c @@ -661,14 +661,10 @@ err: static void *test_thread(void *arg) { -#ifndef DBUG_OFF - int param= *((int*) arg); -#endif - my_thread_init(); { DBUG_ENTER("test_thread"); - DBUG_PRINT("enter", ("param: %d", param)); + DBUG_PRINT("enter", ("param: %d", *(int*) arg)); if (!simple_read_write_test() || !simple_read_change_write_read_test() || diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index 3822a929fcf..baca24eb56f 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -858,7 +858,7 @@ static int chk_index(HA_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, } if (record >= info->state->data_file_length) { -#ifndef DBUG_OFF +#ifdef DBUG_TRACE char llbuff2[22], llbuff3[22]; #endif mi_check_print_error(param,"Found key at page %s that points to record outside datafile",llstr(page,llbuff)); diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c index ebe139bb342..54b33aac997 100644 --- a/storage/myisam/mi_create.c +++ b/storage/myisam/mi_create.c @@ -702,7 +702,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, if (mi_state_info_write(file, &share.state, 2) || mi_base_info_write(file, &share.base)) goto err; -#ifndef DBUG_OFF +#ifdef DBUG_TRACE if ((uint) mysql_file_tell(file, MYF(0)) != base_pos + MI_BASE_INFO_SIZE) { uint pos=(uint) mysql_file_tell(file, MYF(0)); @@ -802,12 +802,12 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, if (mi_recinfo_write(file, &recinfo[i])) goto err; -#ifndef DBUG_OFF - if ((uint) mysql_file_tell(file, MYF(0)) != info_length) +#ifdef DBUG_TRACE { uint pos= (uint) mysql_file_tell(file, MYF(0)); - DBUG_PRINT("warning",("info_length: %d != used_length: %d", - info_length, pos)); + if (pos != info_length) + DBUG_PRINT("warning",("info_length: %d != used_length: %d", + info_length, pos)); } #endif |