diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-09-23 17:37:52 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-09-23 17:37:52 +0300 |
commit | 3c92050d1c907cc548e848d0ab2891a06681ad92 (patch) | |
tree | 27ea08091389453521b52f15c6dffe3d70ecb68b | |
parent | 13eae1885e739a234cebd592f891e87f387784c6 (diff) | |
download | mariadb-git-3c92050d1c907cc548e848d0ab2891a06681ad92.tar.gz |
Fix build without either ENABLED_DEBUG_SYNC or DBUG_OFF
There are separate flags DBUG_OFF for disabling the DBUG facility
and ENABLED_DEBUG_SYNC for enabling the DEBUG_SYNC facility.
Let us allow debug builds without DEBUG_SYNC.
Note: For CMAKE_BUILD_TYPE=Debug, CMakeLists.txt will continue to
define ENABLED_DEBUG_SYNC.
33 files changed, 83 insertions, 14 deletions
diff --git a/mysql-test/main/alter_table-big.test b/mysql-test/main/alter_table-big.test index b010815955f..66f95938107 100644 --- a/mysql-test/main/alter_table-big.test +++ b/mysql-test/main/alter_table-big.test @@ -5,6 +5,7 @@ --source include/big_test.inc # We are using some debug-only features in this test --source include/have_debug.inc +--source include/have_debug_sync.inc # Also we are using SBR to check that statements are executed # in proper order. --source include/have_binlog_format_mixed_or_statement.inc diff --git a/mysql-test/main/flush_read_lock_kill.test b/mysql-test/main/flush_read_lock_kill.test index bd3efd7bdc4..8b76c065227 100644 --- a/mysql-test/main/flush_read_lock_kill.test +++ b/mysql-test/main/flush_read_lock_kill.test @@ -7,6 +7,7 @@ --source include/not_embedded.inc --source include/have_debug.inc +--source include/have_debug_sync.inc # This test needs transactional engine as otherwise COMMIT # won't block FLUSH TABLES WITH GLOBAL READ LOCK. diff --git a/mysql-test/main/partition_sync.test b/mysql-test/main/partition_sync.test index 22ca7df7e62..a07fb6e5c13 100644 --- a/mysql-test/main/partition_sync.test +++ b/mysql-test/main/partition_sync.test @@ -1,5 +1,6 @@ --source include/have_partition.inc --source include/have_debug.inc +--source include/have_debug_sync.inc # Save the initial number of concurrent sessions. --source include/count_sessions.inc diff --git a/mysql-test/main/show_explain.test b/mysql-test/main/show_explain.test index 515eb9efa47..271067ae03a 100644 --- a/mysql-test/main/show_explain.test +++ b/mysql-test/main/show_explain.test @@ -2,6 +2,7 @@ # Tests for SHOW EXPLAIN FOR functionality # --source include/have_debug.inc +--source include/have_debug_sync.inc --source include/have_innodb.inc diff --git a/mysql-test/main/show_explain_non_select.test b/mysql-test/main/show_explain_non_select.test index 505e9296222..92b3c9788c9 100644 --- a/mysql-test/main/show_explain_non_select.test +++ b/mysql-test/main/show_explain_non_select.test @@ -2,6 +2,7 @@ # SHOW EXPLAIN tests for non-select subqueries # --source include/have_debug.inc +--source include/have_debug_sync.inc --source include/have_innodb.inc --source include/not_embedded.inc diff --git a/mysql-test/main/view_debug.test b/mysql-test/main/view_debug.test index 0e448ae2721..bf8074ddeb1 100644 --- a/mysql-test/main/view_debug.test +++ b/mysql-test/main/view_debug.test @@ -1,5 +1,6 @@ --source include/have_debug.inc +--source include/have_debug_sync.inc --echo # --echo #MDEV-8087:Server crashed in Time_and_counter_tracker::incr_loops diff --git a/mysql-test/suite/gcol/t/virtual_index_drop.test b/mysql-test/suite/gcol/t/virtual_index_drop.test index e1ec43f75e5..0fe4986f2c1 100644 --- a/mysql-test/suite/gcol/t/virtual_index_drop.test +++ b/mysql-test/suite/gcol/t/virtual_index_drop.test @@ -1,5 +1,6 @@ --source include/have_innodb.inc --source include/have_debug.inc +--source include/have_debug_sync.inc --echo # --echo # MDEV-24971 InnoDB access freed virtual column diff --git a/mysql-test/suite/innodb/t/alter_crash.test b/mysql-test/suite/innodb/t/alter_crash.test index 72116b0ca9d..7a2f4452f4d 100644 --- a/mysql-test/suite/innodb/t/alter_crash.test +++ b/mysql-test/suite/innodb/t/alter_crash.test @@ -4,6 +4,7 @@ --source include/not_embedded.inc --source include/have_innodb.inc --source include/have_debug.inc +--source include/have_debug_sync.inc --source include/not_crashrep.inc --disable_query_log diff --git a/mysql-test/suite/innodb/t/alter_mdl_timeout.test b/mysql-test/suite/innodb/t/alter_mdl_timeout.test index 15e7f524fd0..0ce23646090 100644 --- a/mysql-test/suite/innodb/t/alter_mdl_timeout.test +++ b/mysql-test/suite/innodb/t/alter_mdl_timeout.test @@ -1,5 +1,6 @@ --source include/have_innodb.inc --source include/have_debug.inc +--source include/have_debug_sync.inc create table t1(f1 char(10), f2 char(10) not null, f3 int not null, f4 int not null, primary key(f3))engine=innodb; diff --git a/mysql-test/suite/innodb/t/autoinc_debug.test b/mysql-test/suite/innodb/t/autoinc_debug.test index 2e662565490..3700db63547 100644 --- a/mysql-test/suite/innodb/t/autoinc_debug.test +++ b/mysql-test/suite/innodb/t/autoinc_debug.test @@ -1,5 +1,6 @@ --source include/have_innodb.inc --source include/have_debug.inc +--source include/have_debug_sync.inc --source include/not_embedded.inc # Two parallel connection with autoinc column after restart. diff --git a/mysql-test/suite/innodb/t/blob-crash.test b/mysql-test/suite/innodb/t/blob-crash.test index beb500553ea..8af4a16d40c 100644 --- a/mysql-test/suite/innodb/t/blob-crash.test +++ b/mysql-test/suite/innodb/t/blob-crash.test @@ -1,6 +1,7 @@ ---source include/maybe_debug.inc --source include/innodb_page_size_small.inc +let $have_debug_sync=`select count(*) = 1 from information_schema.session_variables where variable_name = 'debug_sync' and variable_value like 'on %'`; + --echo # --echo # Bug #16963396 INNODB: USE OF LARGE EXTERNALLY-STORED FIELDS MAKES --echo # CRASH RECOVERY LOSE DATA @@ -94,7 +95,7 @@ select f1, right(f2, 20), right(f3, 20) from t2; update t2 set f3 = '&'; select f1, right(f2, 20), right(f3, 20) from t2; -if ($have_debug) { +if ($have_debug_sync) { --disable_query_log set DEBUG_SYNC='blob_rollback_middle SIGNAL stuck WAIT_FOR ever'; send ROLLBACK; @@ -102,7 +103,7 @@ send ROLLBACK; } connection default; -if ($have_debug) { +if ($have_debug_sync) { --disable_query_log SET DEBUG_SYNC = 'now WAIT_FOR stuck'; --enable_query_log diff --git a/mysql-test/suite/rpl/t/rpl_lost_events_on_rotate.test b/mysql-test/suite/rpl/t/rpl_lost_events_on_rotate.test index 3a4a24e1762..8c4baafe23d 100644 --- a/mysql-test/suite/rpl/t/rpl_lost_events_on_rotate.test +++ b/mysql-test/suite/rpl/t/rpl_lost_events_on_rotate.test @@ -13,6 +13,7 @@ # during this window while forcing a rotation in the binlog. # --source include/have_debug.inc +--source include/have_debug_sync.inc --source include/master-slave.inc --connection master diff --git a/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test b/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test index 31a9478f632..d1bfbf25bae 100644 --- a/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test +++ b/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test @@ -20,6 +20,7 @@ # MDEV-16091: Seconds_Behind_Master spikes to millions of seconds # --source include/have_debug.inc +--source include/have_debug_sync.inc --source include/have_innodb.inc --source include/master-slave.inc diff --git a/mysql-test/suite/sys_vars/t/sysvars_debug.test b/mysql-test/suite/sys_vars/t/sysvars_debug.test index fbdcbd683df..6e64d48c6cd 100644 --- a/mysql-test/suite/sys_vars/t/sysvars_debug.test +++ b/mysql-test/suite/sys_vars/t/sysvars_debug.test @@ -1,4 +1,5 @@ --source include/have_debug.inc +--source include/have_debug_sync.inc --source include/word_size.inc --vertical_results diff --git a/sql/item_func.cc b/sql/item_func.cc index dddb93271c0..f4596803c2d 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -4508,10 +4508,12 @@ longlong Item_func_sleep::val_int() mysql_cond_destroy(&cond); +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("sleep_inject_query_done_debug_sync", { debug_sync_set_action (thd, STRING_WITH_LEN("dispatch_command_end SIGNAL query_done")); };); +#endif return MY_TEST(!error); // Return 1 killed } diff --git a/sql/log.cc b/sql/log.cc index 1ddb3c412ff..873218e8e32 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2018, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB Corporation. + Copyright (c) 2009, 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 @@ -8012,10 +8012,12 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader) DBUG_ENTER("MYSQL_BIN_LOG::trx_group_commit_leader"); { +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("inject_binlog_commit_before_get_LOCK_log", DBUG_ASSERT(!debug_sync_set_action(leader->thd, STRING_WITH_LEN ("commit_before_get_LOCK_log SIGNAL waiting WAIT_FOR cont TIMEOUT 1"))); ); +#endif /* Lock the LOCK_log(), and once we get it, collect any additional writes that queued up while we were waiting. @@ -10142,6 +10144,7 @@ binlog_background_thread(void *arg __attribute__((unused))) mysql_mutex_unlock(&mysql_bin_log.LOCK_binlog_background_thread); /* Process any incoming commit_checkpoint_notify() calls. */ +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("inject_binlog_background_thread_before_mark_xid_done", DBUG_ASSERT(!debug_sync_set_action( thd, @@ -10150,6 +10153,7 @@ binlog_background_thread(void *arg __attribute__((unused))) "WAIT_FOR something_that_will_never_happen " "TIMEOUT 2"))); ); +#endif while (queue) { long count= queue->notify_count; @@ -10164,11 +10168,13 @@ binlog_background_thread(void *arg __attribute__((unused))) mysql_bin_log.mark_xid_done(queue->binlog_id, true); queue= next; +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("binlog_background_checkpoint_processed", DBUG_ASSERT(!debug_sync_set_action( thd, STRING_WITH_LEN("now SIGNAL binlog_background_checkpoint_processed"))); ); +#endif } if (stop) diff --git a/sql/log_event.cc b/sql/log_event.cc index 914a4595b62..0cb8667c8b0 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -11384,12 +11384,13 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi) /* A small test to verify that objects have consistent types */ DBUG_ASSERT(sizeof(thd->variables.option_bits) == sizeof(OPTION_RELAXED_UNIQUE_CHECKS)); - +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("rows_log_event_before_open_table", { const char action[] = "now SIGNAL before_open_table WAIT_FOR go_ahead_sql"; DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(action))); };); +#endif /* Trigger's procedures work with global table list. So we have to add diff --git a/sql/mdl.cc b/sql/mdl.cc index 1a4d4c24d31..3b553c5ce37 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -1168,6 +1168,7 @@ MDL_wait::timed_wait(MDL_context_owner *owner, struct timespec *abs_timeout, wait_result != ETIMEDOUT && wait_result != ETIME) { #ifdef WITH_WSREP +# ifdef ENABLED_DEBUG_SYNC // Allow tests to block the applier thread using the DBUG facilities DBUG_EXECUTE_IF("sync.wsrep_before_mdl_wait", { @@ -1177,6 +1178,7 @@ MDL_wait::timed_wait(MDL_context_owner *owner, struct timespec *abs_timeout, DBUG_ASSERT(!debug_sync_set_action((owner->get_thd()), STRING_WITH_LEN(act))); };); +# endif if (WSREP_ON && wsrep_thd_is_BF(owner->get_thd(), false)) { wait_result= mysql_cond_wait(&m_COND_wait_status, &m_LOCK_wait_status); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 4d22dde9f62..d86875ecaea 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1676,6 +1676,7 @@ void kill_mysql(THD *thd) DBUG_EXECUTE_IF("mysql_admin_shutdown_wait_for_slaves", thd->lex->is_shutdown_wait_for_slaves= true;); +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("simulate_delay_at_shutdown", { DBUG_ASSERT(binlog_dump_thread_count == 3); @@ -1685,6 +1686,7 @@ void kill_mysql(THD *thd) DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act))); };); +#endif if (thd->lex->is_shutdown_wait_for_slaves) shutdown_wait_for_slaves= true; diff --git a/sql/net_serv.cc b/sql/net_serv.cc index b324f4a362f..c52083f8c2a 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2012, 2020, MariaDB Corporation. + Copyright (c) 2012, 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 @@ -490,6 +490,7 @@ net_write_command(NET *net,uchar command, DBUG_ENTER("net_write_command"); DBUG_PRINT("enter",("length: %lu", (ulong) len)); +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("simulate_error_on_packet_write", { if (command == COM_BINLOG_DUMP) @@ -501,6 +502,7 @@ net_write_command(NET *net,uchar command, DBUG_RETURN(true); } };); +#endif MYSQL_NET_WRITE_START(length); buff[4]=command; /* For first packet */ diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc index 35901cb5263..2c431ccc12d 100644 --- a/sql/rpl_parallel.cc +++ b/sql/rpl_parallel.cc @@ -247,6 +247,7 @@ finish_event_group(rpl_parallel_thread *rpt, uint64 sub_id, entry->stop_on_error_sub_id == (uint64)ULONGLONG_MAX) entry->stop_on_error_sub_id= sub_id; mysql_mutex_unlock(&entry->LOCK_parallel_entry); +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("hold_worker_on_schedule", { if (entry->stop_on_error_sub_id < (uint64)ULONGLONG_MAX) { @@ -261,6 +262,7 @@ finish_event_group(rpl_parallel_thread *rpt, uint64 sub_id, STRING_WITH_LEN("now WAIT_FOR proceed_by_1000")); } }); +#endif if (rgi->killed_for_retry == rpl_group_info::RETRY_KILL_PENDING) wait_for_pending_deadlock_kill(thd, rgi); @@ -772,6 +774,7 @@ do_retry: rgi->killed_for_retry= rpl_group_info::RETRY_KILL_KILLED; thd->set_killed(KILL_CONNECTION); }); +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("rpl_parallel_simulate_wait_at_retry", { if (rgi->current_gtid.seq_no == 1001) { debug_sync_set_action(thd, @@ -779,6 +782,7 @@ do_retry: } DEBUG_SYNC(thd, "rpl_parallel_simulate_wait_at_retry"); }); +#endif rgi->cleanup_context(thd, 1); wait_for_pending_deadlock_kill(thd, rgi); @@ -1189,6 +1193,7 @@ handle_rpl_parallel_thread(void *arg) bool did_enter_cond= false; PSI_stage_info old_stage; +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("hold_worker_on_schedule", { if (rgi->current_gtid.domain_id == 0 && rgi->current_gtid.seq_no == 100) { @@ -1203,6 +1208,7 @@ handle_rpl_parallel_thread(void *arg) STRING_WITH_LEN("now SIGNAL scheduled_gtid_0_x_100")); } }); +#endif if(unlikely(thd->wait_for_commit_ptr) && group_rgi != NULL) { @@ -2171,11 +2177,13 @@ rpl_parallel_entry::choose_thread(rpl_group_info *rgi, bool *did_enter_cond, unlock_or_exit_cond(rli->sql_driver_thd, &thr->LOCK_rpl_thread, did_enter_cond, old_stage); my_error(ER_CONNECTION_KILLED, MYF(0)); +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("rpl_parallel_wait_queue_max", { debug_sync_set_action(rli->sql_driver_thd, STRING_WITH_LEN("now SIGNAL wait_queue_killed")); };); +#endif slave_output_error_info(rgi, rli->sql_driver_thd); return NULL; } @@ -2193,11 +2201,13 @@ rpl_parallel_entry::choose_thread(rpl_group_info *rgi, bool *did_enter_cond, Because debug_sync changes the thd->mysys_var->current_mutex, and this can cause THD::awake to use the wrong mutex. */ +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("rpl_parallel_wait_queue_max", { debug_sync_set_action(rli->sql_driver_thd, STRING_WITH_LEN("now SIGNAL wait_queue_ready")); };); +#endif rli->sql_driver_thd->ENTER_COND(&thr->COND_rpl_thread_queue, &thr->LOCK_rpl_thread, &stage_waiting_for_room_in_worker_thread, @@ -2352,11 +2362,13 @@ rpl_parallel::wait_for_done(THD *thd, Relay_log_info *rli) } } } +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("rpl_parallel_wait_for_done_trigger", { debug_sync_set_action(thd, STRING_WITH_LEN("now SIGNAL wait_for_done_waiting")); };); +#endif for (i= 0; i < domain_hash.records; ++i) { diff --git a/sql/service_wsrep.cc b/sql/service_wsrep.cc index fd2a5c301f2..291d8dfbef8 100644 --- a/sql/service_wsrep.cc +++ b/sql/service_wsrep.cc @@ -227,7 +227,7 @@ extern "C" my_bool wsrep_thd_bf_abort(THD *bf_thd, THD *victim_thd, { mysql_mutex_assert_owner(&victim_thd->LOCK_thd_kill); mysql_mutex_assert_owner(&victim_thd->LOCK_thd_data); - +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("sync.before_wsrep_thd_abort", { const char act[]= @@ -237,7 +237,7 @@ extern "C" my_bool wsrep_thd_bf_abort(THD *bf_thd, THD *victim_thd, DBUG_ASSERT(!debug_sync_set_action(bf_thd, STRING_WITH_LEN(act))); };); - +#endif my_bool ret= wsrep_bf_abort(bf_thd, victim_thd); /* Send awake signal if victim was BF aborted or does not diff --git a/sql/slave.cc b/sql/slave.cc index d906066204e..c9d5c9ca3be 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -3797,12 +3797,14 @@ apply_event_and_update_pos_apply(Log_event* ev, THD* thd, rpl_group_info *rgi, Relay_log_info* rli= rgi->rli; DBUG_ENTER("apply_event_and_update_pos_apply"); +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("inject_slave_sql_before_apply_event", { DBUG_ASSERT(!debug_sync_set_action (thd, STRING_WITH_LEN("now WAIT_FOR continue"))); DBUG_SET_INITIAL("-d,inject_slave_sql_before_apply_event"); };); +#endif if (reason == Log_event::EVENT_SKIP_NOT) exec_res= ev->apply_event(rgi); @@ -4388,6 +4390,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, #ifdef WITH_WSREP wsrep_after_statement(thd); #endif /* WITH_WSREP */ +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF( "pause_sql_thread_on_fde", if (ev && typ == FORMAT_DESCRIPTION_EVENT) { @@ -4396,6 +4399,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, STRING_WITH_LEN( "now SIGNAL paused_on_fde WAIT_FOR sql_thread_continue"))); }); +#endif DBUG_RETURN(exec_res); } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 3f654777605..a039090da34 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -7837,6 +7837,7 @@ static bool wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, thd->lex->sql_command != SQLCOM_SELECT && thd->wsrep_retry_counter < thd->variables.wsrep_retry_autocommit) { +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("sync.wsrep_retry_autocommit", { const char act[]= @@ -7845,6 +7846,7 @@ static bool wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, "WAIT_FOR wsrep_retry_autocommit_continue"; DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act))); }); +#endif WSREP_DEBUG("wsrep retrying AC query: %lu %s", thd->wsrep_retry_counter, wsrep_thd_query(thd)); wsrep_prepare_for_autocommit_retry(thd, rawbuf, length, parser_state); diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 94cbc6be614..d59bfbdb839 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2018, Oracle and/or its affiliates. - Copyright (c) 2008, 2020, 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 @@ -2865,6 +2865,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, info->error= ER_UNKNOWN_ERROR; goto err; } +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("simulate_delay_at_shutdown", { const char act[]= @@ -2873,6 +2874,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act))); };); +#endif /* heartbeat_period from @master_heartbeat_period user variable @@ -2962,12 +2964,14 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, if (should_stop(info)) break; +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("wait_after_binlog_EOF", { const char act[]= "now wait_for signal.rotate_finished"; DBUG_ASSERT(!debug_sync_set_action(current_thd, STRING_WITH_LEN(act))); };); +#endif THD_STAGE_INFO(thd, stage_finished_reading_one_binlog_switching_to_next_binlog); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index a5fa36ffde6..f29fecd2744 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2115,10 +2115,12 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, bool if_exists, } } +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("ib_purge_virtual_mdev_16222_1", DBUG_ASSERT(!debug_sync_set_action( thd, STRING_WITH_LEN("now SIGNAL drop_started")));); +#endif /* mark for close and remove all cached entries */ thd->push_internal_handler(&err_handler); @@ -9654,7 +9656,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db, DEBUG_SYNC(thd, "alter_opened_table"); -#ifdef WITH_WSREP +#if defined WITH_WSREP && defined ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("sync.alter_opened_table", { const char act[]= diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index fe10adb0417..77c7b60c233 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2004, 2012, Oracle and/or its affiliates. - Copyright (c) 2010, 2018, MariaDB + Copyright (c) 2010, 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 @@ -596,7 +596,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) goto end; } -#ifdef WITH_WSREP +#if defined WITH_WSREP && defined ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("sync.mdev_20225", { const char act[]= @@ -605,7 +605,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act))); };); -#endif /* WITH_WSREP */ +#endif /* WITH_WSREP && ENABLED_DEBUG_SYNC */ result= (create ? table->triggers->create_trigger(thd, tables, &stmt_query): diff --git a/sql/wsrep_high_priority_service.cc b/sql/wsrep_high_priority_service.cc index e45bcf3e5ce..700ac599cee 100644 --- a/sql/wsrep_high_priority_service.cc +++ b/sql/wsrep_high_priority_service.cc @@ -381,6 +381,7 @@ int Wsrep_high_priority_service::apply_toi(const wsrep::ws_meta& ws_meta, WSREP_DEBUG("Wsrep_high_priority_service::apply_toi: %lld", client_state.toi_meta().seqno().get()); +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("sync.wsrep_apply_toi", { const char act[]= @@ -390,6 +391,7 @@ int Wsrep_high_priority_service::apply_toi(const wsrep::ws_meta& ws_meta, DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act))); };); +#endif int ret= wsrep_apply_events(thd, m_rli, data.data(), data.size()); if (ret != 0 || thd->wsrep_has_ignored_error) @@ -439,6 +441,7 @@ int Wsrep_high_priority_service::log_dummy_write_set(const wsrep::ws_handle& ws_ DBUG_PRINT("info", ("Wsrep_high_priority_service::log_dummy_write_set: seqno=%lld", ws_meta.seqno().get())); +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("sync.wsrep_log_dummy_write_set", { const char act[]= @@ -447,6 +450,7 @@ int Wsrep_high_priority_service::log_dummy_write_set(const wsrep::ws_handle& ws_ DBUG_ASSERT(!debug_sync_set_action(m_thd, STRING_WITH_LEN(act))); };); +#endif if (ws_meta.ordered()) { @@ -536,6 +540,7 @@ int Wsrep_applier_service::apply_write_set(const wsrep::ws_meta& ws_meta, /* moved dbug sync point here, after possible THD switch for SR transactions has ben done */ +#ifdef ENABLED_DEBUG_SYNC /* Allow tests to block the applier thread using the DBUG facilities */ DBUG_EXECUTE_IF("sync.wsrep_apply_cb", { @@ -546,6 +551,7 @@ int Wsrep_applier_service::apply_write_set(const wsrep::ws_meta& ws_meta, DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act))); };); +#endif wsrep_setup_uk_and_fk_checks(thd); @@ -694,6 +700,7 @@ int Wsrep_replayer_service::apply_write_set(const wsrep::ws_meta& ws_meta, DBUG_ASSERT(thd->wsrep_trx().active()); DBUG_ASSERT(thd->wsrep_trx().state() == wsrep::transaction::s_replaying); +#ifdef ENABLED_DEBUG_SYNC /* Allow tests to block the replayer thread using the DBUG facilities */ DBUG_EXECUTE_IF("sync.wsrep_replay_cb", { @@ -704,6 +711,7 @@ int Wsrep_replayer_service::apply_write_set(const wsrep::ws_meta& ws_meta, DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act))); };); +#endif wsrep_setup_uk_and_fk_checks(thd); diff --git a/sql/wsrep_server_service.cc b/sql/wsrep_server_service.cc index 41778ef9420..cf6f76cf02e 100644 --- a/sql/wsrep_server_service.cc +++ b/sql/wsrep_server_service.cc @@ -386,6 +386,7 @@ int Wsrep_server_service::wait_committing_transactions(int timeout) void Wsrep_server_service::debug_sync(const char* sync_point) { +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF(sync_point, { std::stringstream dbug_action; dbug_action << "now " @@ -396,4 +397,5 @@ void Wsrep_server_service::debug_sync(const char* sync_point) action.c_str(), action.length())); };); +#endif } diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index a8642189bff..ddd5b5945b4 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -1736,6 +1736,7 @@ wait_signal: WSREP_INFO("Donor state reached"); +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("sync.wsrep_donor_state", { const char act[]= @@ -1745,6 +1746,7 @@ wait_signal: assert(!debug_sync_set_action(thd.ptr, STRING_WITH_LEN(act))); };); +#endif goto wait_signal; } diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc index 3a9384c7428..8853ea6a499 100644 --- a/sql/wsrep_thd.cc +++ b/sql/wsrep_thd.cc @@ -348,6 +348,7 @@ bool wsrep_bf_abort(THD* bf_thd, THD* victim_thd) mysql_mutex_assert_owner(&victim_thd->LOCK_thd_data); mysql_mutex_assert_owner(&victim_thd->LOCK_thd_kill); +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("sync.wsrep_bf_abort", { const char act[]= @@ -357,6 +358,7 @@ bool wsrep_bf_abort(THD* bf_thd, THD* victim_thd) DBUG_ASSERT(!debug_sync_set_action(bf_thd, STRING_WITH_LEN(act))); };); +#endif if (WSREP(victim_thd) && !victim_thd->wsrep_trx().active()) { diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index b8a80d02350..beab6ff5239 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -20579,6 +20579,7 @@ fail: for purge thread */ static TABLE* innodb_find_table_for_vc(THD* thd, dict_table_t* table) { +#ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF( "ib_purge_virtual_mdev_16222_1", DBUG_ASSERT(!debug_sync_set_action( @@ -20592,6 +20593,7 @@ static TABLE* innodb_find_table_for_vc(THD* thd, dict_table_t* table) thd, STRING_WITH_LEN("ib_purge_virtual_got_no_such_table " "SIGNAL got_no_such_table")));); +#endif if (THDVAR(thd, background_thread)) { /* Purge thread acquires dict_sys.latch while diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc index d61dc2c2280..8ee7639f095 100644 --- a/storage/innobase/row/row0purge.cc +++ b/storage/innobase/row/row0purge.cc @@ -1314,7 +1314,7 @@ row_purge_step( node->start(); -#ifdef UNIV_DEBUG +#ifdef ENABLED_DEBUG_SYNC srv_slot_t *slot = thr->thread_slot; ut_ad(slot); |