summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-09-26 14:34:43 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2022-09-26 14:34:43 +0300
commit829e8111c70cf0354f686bd9087818de61f452a2 (patch)
tree7e63e7facd44cc3b0d937c34de9b6f5737019a1c /sql
parent70701ee4b1a9962e33a83da94aea61d7537fe9d4 (diff)
parentfe7c95ec7833d424b1dcaf64f6c78c74ce0832d6 (diff)
downloadmariadb-git-829e8111c70cf0354f686bd9087818de61f452a2.tar.gz
Merge 10.5 into 10.6
Diffstat (limited to 'sql')
-rw-r--r--sql/debug_sync.cc25
-rw-r--r--sql/event_queue.cc2
-rw-r--r--sql/field.cc6
-rw-r--r--sql/gcalc_slicescan.cc4
-rw-r--r--sql/item_create.cc2
-rw-r--r--sql/item_func.cc2
-rw-r--r--sql/log.cc6
-rw-r--r--sql/log.h2
-rw-r--r--sql/log_event.cc4
-rw-r--r--sql/mdl.cc6
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/net_serv.cc4
-rw-r--r--sql/records.cc4
-rw-r--r--sql/rpl_injector.h4
-rw-r--r--sql/rpl_parallel.cc12
-rw-r--r--sql/rpl_record.cc6
-rw-r--r--sql/slave.cc8
-rw-r--r--sql/sql_binlog.cc15
-rw-r--r--sql/sql_cache.cc5
-rw-r--r--sql/sql_class.cc2
-rw-r--r--sql/sql_parse.cc2
-rw-r--r--sql/sql_repl.cc6
-rw-r--r--sql/sql_table.cc2
-rw-r--r--sql/sql_trigger.cc4
-rw-r--r--sql/table.cc2
-rw-r--r--sql/wsrep_high_priority_service.cc8
-rw-r--r--sql/wsrep_mysqld.cc7
-rw-r--r--sql/wsrep_server_service.cc2
-rw-r--r--sql/wsrep_sst.cc2
-rw-r--r--sql/wsrep_thd.cc2
30 files changed, 110 insertions, 48 deletions
diff --git a/sql/debug_sync.cc b/sql/debug_sync.cc
index debda4c8970..ca2abc1c9a3 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) 2009, 2020, MariaDB Corporation.
+ 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
@@ -353,7 +353,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.
@@ -443,8 +443,7 @@ static void debug_sync_print_actions(THD *thd)
DBUG_VOID_RETURN;
}
-
-#endif /* !defined(DBUG_OFF) */
+#endif /* defined(DBUG_TRACE) */
/**
@@ -775,6 +774,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();
@@ -785,6 +785,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");
@@ -797,7 +798,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)
@@ -1367,7 +1370,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();
@@ -1458,12 +1461,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.
@@ -1477,12 +1480,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 873be03faac..ebd2dfeefd6 100644
--- a/sql/event_queue.cc
+++ b/sql/event_queue.cc
@@ -544,7 +544,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 29b9634c877..bdd52c4626b 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -3389,7 +3389,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)));
@@ -3404,7 +3404,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",
@@ -3496,7 +3496,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 93561f5fe97..b079bd7a714 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/item_create.cc b/sql/item_create.cc
index 18a0a20c4fb..1562cab61ed 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -5766,7 +5766,7 @@ int item_create_init()
DBUG_RETURN(1);
#endif
-#ifndef DBUG_OFF
+#ifdef DBUG_TRACE
for (uint i=0 ; i < native_functions_hash.records ; i++)
{
Native_func_registry *func;
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 941328b5652..eb499b429cd 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -4603,10 +4603,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 30913d3071a..df857baa8d7 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -8217,10 +8217,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.
@@ -10553,6 +10555,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,
@@ -10561,6 +10564,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;
@@ -10575,11 +10579,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.h b/sql/log.h
index 84e3bd2cdba..13819b73d9d 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -735,7 +735,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 728fd18a45a..53785a89f1e 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2018, 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
@@ -1359,7 +1359,7 @@ static void copy_str_and_move(const char **src, Log_event::Byte **dst,
}
-#ifndef DBUG_OFF
+#ifdef DBUG_TRACE
static char const *
code_name(int code)
{
diff --git a/sql/mdl.cc b/sql/mdl.cc
index 3ba006a63a7..f1c9c6e0444 100644
--- a/sql/mdl.cc
+++ b/sql/mdl.cc
@@ -1187,6 +1187,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",
{
@@ -1196,6 +1197,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);
@@ -2279,7 +2281,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
@@ -2305,7 +2307,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/mysqld.cc b/sql/mysqld.cc
index 41ec99a90b2..4f46b099d31 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1677,6 +1677,7 @@ void kill_mysql(THD *thd)
shutdown_thread_id= thd->thread_id;
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);
@@ -1686,6 +1687,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 39b4290a161..70e71d9a21b 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
@@ -507,6 +507,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)
@@ -518,6 +519,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/records.cc b/sql/records.cc
index b3b69f19665..3aad36ca862 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2010, Oracle and/or its affiliates.
- Copyright (c) 2009, 2017, 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
@@ -568,7 +568,7 @@ template<bool Packed_addon_fields>
static int rr_unpack_from_tempfile(READ_RECORD *info)
{
uchar *destination= info->rec_buf;
-#ifndef DBUG_OFF
+#ifdef DBUG_TRACE
my_off_t where= my_b_tell(info->io_cache);
#endif
if (Packed_addon_fields)
diff --git a/sql/rpl_injector.h b/sql/rpl_injector.h
index 669a8e29543..28359d9555a 100644
--- a/sql/rpl_injector.h
+++ b/sql/rpl_injector.h
@@ -264,14 +264,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_parallel.cc b/sql/rpl_parallel.cc
index 8be1964b762..5e32565cca7 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);
@@ -774,6 +776,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,
@@ -781,6 +784,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);
@@ -1206,6 +1210,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) {
@@ -1220,6 +1225,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)
{
@@ -2257,11 +2263,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;
}
@@ -2279,11 +2287,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,
@@ -2438,11 +2448,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
global_rpl_thread_pool.copy_pool_for_pfs(rli);
for (i= 0; i < domain_hash.records; ++i)
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 a0d725ca318..4312ed2487e 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -3871,12 +3871,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);
@@ -3905,7 +3907,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.
@@ -3931,7 +3933,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())
{
@@ -4464,6 +4466,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) {
@@ -4472,6 +4475,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_binlog.cc b/sql/sql_binlog.cc
index bab2afb957a..9f61135232f 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 9e8f0a8fe68..81ea002ce32 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -4770,7 +4770,7 @@ void Query_cache::cache_dump()
void Query_cache::queries_dump()
{
-
+#ifdef DBUG_TRACE
if (!initialized)
{
DBUG_PRINT("qcache", ("Query Cache not initialized"));
@@ -4831,11 +4831,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"));
@@ -4858,6 +4860,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 78417afeac7..1ec447c7f27 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -7390,7 +7390,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/sql_parse.cc b/sql/sql_parse.cc
index 44eeaadb920..e6eaebeab36 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -7881,6 +7881,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[]=
@@ -7889,6 +7890,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 90fdce1b56f..e688fbcdad3 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
@@ -2876,6 +2876,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[]=
@@ -2884,6 +2885,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
@@ -2973,12 +2975,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 57309cdd725..f26b2e23b25 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -9536,7 +9536,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 911c4e7349c..896afa6f59e 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -644,7 +644,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[]=
@@ -653,7 +653,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 */
if (create)
result= table->triggers->create_trigger(thd, tables, &stmt_query,
diff --git a/sql/table.cc b/sql/table.cc
index 5940d647acb..5f6d88183ef 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -8845,7 +8845,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/sql/wsrep_high_priority_service.cc b/sql/wsrep_high_priority_service.cc
index e165a204f56..708eb552866 100644
--- a/sql/wsrep_high_priority_service.cc
+++ b/sql/wsrep_high_priority_service.cc
@@ -405,6 +405,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[]=
@@ -414,6 +415,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= apply_events(thd, m_rli, data, err);
wsrep_thd_set_ignored_error(thd, false);
@@ -459,6 +461,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[]=
@@ -467,6 +470,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())
{
@@ -562,8 +566,8 @@ 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
*/
- /* Allow tests to block the applier thread using the DBUG facilities */
#ifdef ENABLED_DEBUG_SYNC
+ /* Allow tests to block the applier thread using the DBUG facilities */
DBUG_EXECUTE_IF("sync.wsrep_apply_cb",
{
const char act[]=
@@ -716,6 +720,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",
{
@@ -726,6 +731,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_mysqld.cc b/sql/wsrep_mysqld.cc
index b3d6176f8b2..e66b27ff1a8 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -711,11 +711,14 @@ static std::string wsrep_server_incoming_address()
/*
In case port is not specified in wsrep_node_incoming_address, we use
mysqld_port.
+ Note that we might get here before we execute set_ports().
*/
- int port= (addr.get_port() > 0) ? addr.get_port() : (int) mysqld_port;
+ int local_port= (addr.get_port() > 0) ? addr.get_port() : (int) mysqld_port;
+ if (!local_port)
+ local_port= MYSQL_PORT;
const char *fmt= (addr.is_ipv6()) ? "[%s]:%u" : "%s:%u";
- snprintf(inc_addr, inc_addr_max, fmt, addr.get_address(), port);
+ snprintf(inc_addr, inc_addr_max, fmt, addr.get_address(), local_port);
}
done:
diff --git a/sql/wsrep_server_service.cc b/sql/wsrep_server_service.cc
index 4916005e7ed..9be6af71c56 100644
--- a/sql/wsrep_server_service.cc
+++ b/sql/wsrep_server_service.cc
@@ -391,6 +391,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 "
@@ -401,4 +402,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 10212ee8da7..339b138dbf2 100644
--- a/sql/wsrep_sst.cc
+++ b/sql/wsrep_sst.cc
@@ -1740,6 +1740,7 @@ wait_signal:
WSREP_INFO("Donor state reached");
+#ifdef ENABLED_DEBUG_SYNC
DBUG_EXECUTE_IF("sync.wsrep_donor_state",
{
const char act[]=
@@ -1749,6 +1750,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 a615b7f609b..64b7faa2957 100644
--- a/sql/wsrep_thd.cc
+++ b/sql/wsrep_thd.cc
@@ -346,6 +346,7 @@ bool wsrep_bf_abort(THD* bf_thd, THD* victim_thd)
WSREP_LOG_THD(bf_thd, "BF aborter before");
WSREP_LOG_THD(victim_thd, "victim before");
+#ifdef ENABLED_DEBUG_SYNC
DBUG_EXECUTE_IF("sync.wsrep_bf_abort",
{
const char act[]=
@@ -355,6 +356,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())
{