summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2017-07-03 11:35:44 +0300
committerSergei Golubchik <serg@mariadb.org>2017-08-24 01:05:50 +0200
commit536215e32fc43aa423684e9807640dcf3453924b (patch)
treed7249d3c4268c9a57becc5fea554e2379ffe1cf1 /sql
parent52a1e4d613a6c7de759e93da8dfbd8cac08a11ee (diff)
downloadmariadb-git-536215e32fc43aa423684e9807640dcf3453924b.tar.gz
Added DBUG_ASSERT_AS_PRINTF compile flag
If compiling a non DBUG binary with -DDBUG_ASSERT_AS_PRINTF asserts will be changed to printf + stack trace (of stack trace are enabled). - Changed #ifndef DBUG_OFF to #ifdef DBUG_ASSERT_EXISTS for those DBUG_OFF that was just used to enable assert - Assert checking that could greatly impact performance where changed to DBUG_ASSERT_SLOW which is not affected by DBUG_ASSERT_AS_PRINTF - Added one extra option to my_print_stacktrace() to get more silent in case of stack trace printing as part of assert.
Diffstat (limited to 'sql')
-rw-r--r--sql/events.cc2
-rw-r--r--sql/item.cc2
-rw-r--r--sql/item.h2
-rw-r--r--sql/item_xmlfunc.cc2
-rw-r--r--sql/lock.cc2
-rw-r--r--sql/log_event.cc4
-rw-r--r--sql/mdl.cc16
-rw-r--r--sql/mdl.h2
-rw-r--r--sql/my_decimal.h4
-rw-r--r--sql/mysqld.cc21
-rw-r--r--sql/protocol.cc4
-rw-r--r--sql/rpl_gtid.cc7
-rw-r--r--sql/rpl_utility.cc2
-rw-r--r--sql/signal_handler.cc2
-rw-r--r--sql/sp.cc2
-rw-r--r--sql/sp_head.cc8
-rw-r--r--sql/sp_rcontext.h2
-rw-r--r--sql/sql_acl.cc2
-rw-r--r--sql/sql_alter.cc6
-rw-r--r--sql/sql_alter.h2
-rw-r--r--sql/sql_cache.cc2
-rw-r--r--sql/sql_class.cc10
-rw-r--r--sql/sql_class.h8
-rw-r--r--sql/sql_lex.cc10
-rw-r--r--sql/sql_plugin.cc2
-rw-r--r--sql/sql_prepare.cc6
-rw-r--r--sql/sql_yacc.yy4
-rw-r--r--sql/sys_vars.ic2
-rw-r--r--sql/table.h8
29 files changed, 81 insertions, 65 deletions
diff --git a/sql/events.cc b/sql/events.cc
index 3c66945fbd9..0c3b931e722 100644
--- a/sql/events.cc
+++ b/sql/events.cc
@@ -625,7 +625,7 @@ Events::drop_schema_events(THD *thd, const char *db)
DBUG_ENTER("Events::drop_schema_events");
DBUG_PRINT("enter", ("dropping events from %s", db));
- DBUG_ASSERT(ok_for_lower_case_names(db));
+ DBUG_SLOW_ASSERT(ok_for_lower_case_names(db));
/*
Sic: no check if the scheduler is disabled or system tables
diff --git a/sql/item.cc b/sql/item.cc
index fe20687bf51..e4fcaa42c6f 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -8813,7 +8813,7 @@ bool Item_default_value::fix_fields(THD *thd, Item **items)
goto error;
memcpy((void *)def_field, (void *)field_arg->field,
field_arg->field->size_of());
- IF_DBUG(def_field->is_stat_field=1,); // a hack to fool ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED
+ IF_DBUG_ASSERT(def_field->is_stat_field=1,); // a hack to fool ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED
if (def_field->default_value && def_field->default_value->flags)
{
uchar *newptr= (uchar*) thd->alloc(1+def_field->pack_length());
diff --git a/sql/item.h b/sql/item.h
index 75c14c6338a..8a33b107652 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -2220,7 +2220,7 @@ public:
LEX_CSTRING m_name;
public:
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
/*
Routine to which this Item_splocal belongs. Used for checking if correct
runtime context is used for variable handling.
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc
index a427cba5956..ba24ebe76c5 100644
--- a/sql/item_xmlfunc.cc
+++ b/sql/item_xmlfunc.cc
@@ -2622,7 +2622,7 @@ my_xpath_parse_VariableReference(MY_XPATH *xpath)
{
Item_splocal *splocal= new (thd->mem_root)
Item_splocal(thd, &name, spv->offset, spv->sql_type(), 0);
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
if (splocal)
splocal->m_sp= lex->sphead;
#endif
diff --git a/sql/lock.cc b/sql/lock.cc
index 5c80a2c98cd..a45b93a0260 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -911,7 +911,7 @@ bool lock_object_name(THD *thd, MDL_key::enum_mdl_namespace mdl_type,
MDL_request schema_request;
MDL_request mdl_request;
- DBUG_ASSERT(ok_for_lower_case_names(db));
+ DBUG_SLOW_ASSERT(ok_for_lower_case_names(db));
if (thd->locked_tables_mode)
{
diff --git a/sql/log_event.cc b/sql/log_event.cc
index b9d802f7927..abfa0b80ed5 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -6012,7 +6012,7 @@ bool Format_description_log_event::write()
FD_queue checksum_alg value.
*/
compile_time_assert(BINLOG_CHECKSUM_ALG_DESC_LEN == 1);
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
data_written= 0; // to prepare for need_checksum assert
#endif
uint8 checksum_byte= (uint8)
@@ -8687,7 +8687,7 @@ User_var_log_event(const char* buf, uint event_len,
we keep the flags set to UNDEF_F.
*/
uint bytes_read= ((val + val_len) - buf_start);
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
bool old_pre_checksum_fd= description_event->is_version_before_checksum(
&description_event->server_version_split);
#endif
diff --git a/sql/mdl.cc b/sql/mdl.cc
index 350d27298de..4efc8b0e361 100644
--- a/sql/mdl.cc
+++ b/sql/mdl.cc
@@ -2119,11 +2119,11 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout)
the parallel replication scheduler should never schedule a DDL while
DML's are still running.
*/
- DBUG_ASSERT((mdl_request->type != MDL_INTENTION_EXCLUSIVE &&
- mdl_request->type != MDL_EXCLUSIVE) ||
- !(get_thd()->rgi_slave &&
- get_thd()->rgi_slave->is_parallel_exec &&
- lock->check_if_conflicting_replication_locks(this)));
+ DBUG_SLOW_ASSERT((mdl_request->type != MDL_INTENTION_EXCLUSIVE &&
+ mdl_request->type != MDL_EXCLUSIVE) ||
+ !(get_thd()->rgi_slave &&
+ get_thd()->rgi_slave->is_parallel_exec &&
+ lock->check_if_conflicting_replication_locks(this)));
mysql_prlock_unlock(&lock->m_rwlock);
@@ -2644,7 +2644,7 @@ void MDL_context::release_lock(enum_mdl_duration duration, MDL_ticket *ticket)
void MDL_context::release_lock(MDL_ticket *ticket)
{
- DBUG_ASSERT(ticket->m_duration == MDL_EXPLICIT);
+ DBUG_SLOW_ASSERT(ticket->m_duration == MDL_EXPLICIT);
release_lock(MDL_EXPLICIT, ticket);
}
@@ -2904,8 +2904,8 @@ bool MDL_context::has_lock(const MDL_savepoint &mdl_savepoint,
void MDL_context::set_lock_duration(MDL_ticket *mdl_ticket,
enum_mdl_duration duration)
{
- DBUG_ASSERT(mdl_ticket->m_duration == MDL_TRANSACTION &&
- duration != MDL_TRANSACTION);
+ DBUG_SLOW_ASSERT(mdl_ticket->m_duration == MDL_TRANSACTION &&
+ duration != MDL_TRANSACTION);
m_tickets[MDL_TRANSACTION].remove(mdl_ticket);
m_tickets[duration].push_front(mdl_ticket);
diff --git a/sql/mdl.h b/sql/mdl.h
index 97216b8e7b1..f30c976ac94 100644
--- a/sql/mdl.h
+++ b/sql/mdl.h
@@ -349,7 +349,7 @@ public:
NAME_LEN) - m_ptr + 1);
m_hash_value= my_hash_sort(&my_charset_bin, (uchar*) m_ptr + 1,
m_length - 1);
- DBUG_ASSERT(mdl_namespace_arg == USER_LOCK || ok_for_lower_case_names(db));
+ DBUG_SLOW_ASSERT(mdl_namespace_arg == USER_LOCK || ok_for_lower_case_names(db));
}
void mdl_key_init(const MDL_key *rhs)
{
diff --git a/sql/my_decimal.h b/sql/my_decimal.h
index 265b370a154..918213568fc 100644
--- a/sql/my_decimal.h
+++ b/sql/my_decimal.h
@@ -132,8 +132,8 @@ public:
void sanity_check()
{
- DBUG_ASSERT(foo1 == test_value);
- DBUG_ASSERT(foo2 == test_value);
+ DBUG_SLOW_ASSERT(foo1 == test_value);
+ DBUG_SLOW_ASSERT(foo2 == test_value);
}
void fix_buffer_pointer() { buf= buffer; }
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 630a5d64c8f..2ef2830e80b 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2160,7 +2160,7 @@ static void mysqld_exit(int exit_code)
set_malloc_size_cb(NULL);
if (!opt_debugging && !my_disable_leak_check)
{
- DBUG_ASSERT(global_status_var.global_memory_used == 0);
+ DBUG_SLOW_ASSERT(global_status_var.global_memory_used == 0);
}
cleanup_tls();
DBUG_LEAVE;
@@ -3322,6 +3322,20 @@ static size_t my_setstacksize(pthread_attr_t *attr, size_t stacksize)
}
#endif
+#ifdef DBUG_ASSERT_AS_PRINTF
+extern "C" void
+mariadb_dbug_assert_failed(const char *assert_expr, const char *file,
+ unsigned long line)
+{
+ fprintf(stderr, "Warning: assertion failed: %s at %s line %lu\n",
+ assert_expr, file, line);
+ if (opt_stack_trace)
+ {
+ fprintf(stderr, "Attempting backtrace to find out the reason for the assert:\n");
+ my_print_stacktrace(NULL, (ulong) my_thread_stack_size, 1);
+ }
+}
+#endif /* DBUG_ASSERT_AS_PRINT */
#if !defined(__WIN__)
#ifndef SA_RESETHAND
@@ -4140,7 +4154,10 @@ static int init_common_variables()
#ifdef SAFEMALLOC
sf_malloc_dbug_id= mariadb_dbug_id;
-#endif
+#endif /* SAFEMALLOC */
+#ifdef DBUG_ASSERT_AS_PRINTF
+ my_dbug_assert_failed= mariadb_dbug_assert_failed;
+#endif /* DBUG_ASSERT_AS_PRINTF */
if (!(type_handler_data= new Type_handler_data) ||
type_handler_data->init())
diff --git a/sql/protocol.cc b/sql/protocol.cc
index 205b640dcb1..dbaa8ae6a1e 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -1235,7 +1235,7 @@ bool Protocol_text::store(Field *field)
char buff[MAX_FIELD_WIDTH];
String str(buff,sizeof(buff), &my_charset_bin);
CHARSET_INFO *tocs= this->thd->variables.character_set_results;
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
TABLE *table= field->table;
my_bitmap_map *old_map= 0;
if (table->file)
@@ -1243,7 +1243,7 @@ bool Protocol_text::store(Field *field)
#endif
field->val_str(&str);
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
if (old_map)
dbug_tmp_restore_column_map(table->read_set, old_map);
#endif
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc
index 965af7e9b69..f746496993c 100644
--- a/sql/rpl_gtid.cc
+++ b/sql/rpl_gtid.cc
@@ -317,7 +317,7 @@ rpl_slave_state::update(uint32 domain_id, uint32 server_id, uint64 sub_id,
{
if (rgi->gtid_ignore_duplicate_state==rpl_group_info::GTID_DUPLICATE_OWNER)
{
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
Relay_log_info *rli= rgi->rli;
#endif
uint32 count= elem->owner_count;
@@ -2096,15 +2096,14 @@ void
slave_connection_state::remove(const rpl_gtid *in_gtid)
{
uchar *rec= my_hash_search(&hash, (const uchar *)(&in_gtid->domain_id), 0);
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
bool err;
rpl_gtid *slave_gtid= &((entry *)rec)->gtid;
DBUG_ASSERT(rec /* We should never try to remove not present domain_id. */);
DBUG_ASSERT(slave_gtid->server_id == in_gtid->server_id);
DBUG_ASSERT(slave_gtid->seq_no == in_gtid->seq_no);
+ err=
#endif
-
- IF_DBUG(err=, )
my_hash_delete(&hash, rec);
DBUG_ASSERT(!err);
}
diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc
index 1d8cd15dc51..bf0d98e1cf7 100644
--- a/sql/rpl_utility.cc
+++ b/sql/rpl_utility.cc
@@ -1127,7 +1127,7 @@ bool event_checksum_test(uchar *event_buf, ulong event_len, enum enum_binlog_che
if (event_buf[EVENT_TYPE_OFFSET] == FORMAT_DESCRIPTION_EVENT)
{
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
int8 fd_alg= event_buf[event_len - BINLOG_CHECKSUM_LEN -
BINLOG_CHECKSUM_ALG_DESC_LEN];
#endif
diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc
index d7f26ea5aa3..5cc8b958b0a 100644
--- a/sql/signal_handler.cc
+++ b/sql/signal_handler.cc
@@ -163,7 +163,7 @@ extern "C" sig_handler handle_fatal_signal(int sig)
"where mysqld died. If you see no messages after this, something went\n"
"terribly wrong...\n");
my_print_stacktrace(thd ? (uchar*) thd->thread_stack : NULL,
- (ulong)my_thread_stack_size);
+ (ulong)my_thread_stack_size, 0);
}
if (thd)
{
diff --git a/sql/sp.cc b/sql/sp.cc
index 85cef2a7d81..bc7da657462 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -1557,7 +1557,7 @@ bool lock_db_routines(THD *thd, const char *db)
uchar keybuf[MAX_KEY_LENGTH];
DBUG_ENTER("lock_db_routines");
- DBUG_ASSERT(ok_for_lower_case_names(db));
+ DBUG_SLOW_ASSERT(ok_for_lower_case_names(db));
/*
mysql.proc will be re-opened during deletion, so we can ignore
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index a199a181be2..8865a18749a 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1561,7 +1561,7 @@ sp_head::execute_trigger(THD *thd,
goto err_with_cleanup;
}
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
nctx->sp= this;
#endif
@@ -1685,7 +1685,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
*/
thd->restore_active_arena(&call_arena, &backup_arena);
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
nctx->sp= this;
#endif
@@ -1891,7 +1891,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
DBUG_RETURN(TRUE);
}
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
octx->sp= 0;
#endif
thd->spcont= octx;
@@ -1906,7 +1906,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
thd->spcont= save_spcont;
DBUG_RETURN(TRUE);
}
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
nctx->sp= this;
#endif
diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h
index 98464518787..6ff6e02f737 100644
--- a/sql/sp_rcontext.h
+++ b/sql/sp_rcontext.h
@@ -176,7 +176,7 @@ public:
/// of the client/server protocol.
bool end_partial_result_set;
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
/// The stored program for which this runtime context is created. Used for
/// checking if correct runtime context is used for variable handling.
sp_head *sp;
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 15c55ccaef0..81859d2fed6 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -3175,7 +3175,7 @@ static void remove_ptr_from_dynarray(DYNAMIC_ARRAY *array, void *ptr)
{
DBUG_ASSERT(!found);
delete_dynamic_element(array, i);
- IF_DBUG(found= true, break);
+ IF_DBUG_ASSERT(found= true, break);
}
}
DBUG_ASSERT(found);
diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc
index 867b5218fa3..f2f3f7f25d9 100644
--- a/sql/sql_alter.cc
+++ b/sql/sql_alter.cc
@@ -90,7 +90,7 @@ Alter_table_ctx::Alter_table_ctx()
new_db(NULL), new_name(NULL), new_alias(NULL),
fk_error_if_delete_row(false), fk_error_id(NULL),
fk_error_table(NULL)
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
, tmp_table(false)
#endif
{
@@ -110,7 +110,7 @@ Alter_table_ctx::Alter_table_ctx(THD *thd, TABLE_LIST *table_list,
new_db(new_db_arg), new_name(new_name_arg),
fk_error_if_delete_row(false), fk_error_id(NULL),
fk_error_table(NULL)
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
, tmp_table(false)
#endif
{
@@ -187,7 +187,7 @@ Alter_table_ctx::Alter_table_ctx(THD *thd, TABLE_LIST *table_list,
this case. This fact is enforced with assert.
*/
build_tmptable_filename(thd, tmp_path, sizeof(tmp_path));
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
tmp_table= true;
#endif
}
diff --git a/sql/sql_alter.h b/sql/sql_alter.h
index c0232dd7358..a37d96934ea 100644
--- a/sql/sql_alter.h
+++ b/sql/sql_alter.h
@@ -331,7 +331,7 @@ private:
char new_path[FN_REFLEN + 1];
char tmp_path[FN_REFLEN + 1];
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
/** Indicates that we are altering temporary table. Used only in asserts. */
bool tmp_table;
#endif
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 2ef20268e14..b53d6332eb6 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -2342,7 +2342,7 @@ void Query_cache::invalidate(THD *thd, const char *db)
if (is_disabled())
DBUG_VOID_RETURN;
- DBUG_ASSERT(ok_for_lower_case_names(db));
+ DBUG_SLOW_ASSERT(ok_for_lower_case_names(db));
bool restart= FALSE;
/*
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 129f7abc136..d8c6d0db380 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -833,7 +833,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
enable_slow_log= 0;
durability_property= HA_REGULAR_DURABILITY;
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
dbug_sentry=THD_SENTRY_MAGIC;
#endif
mysql_audit_init_thd(this);
@@ -1635,7 +1635,7 @@ THD::~THD()
mysql_cond_destroy(&COND_wakeup_ready);
mysql_mutex_destroy(&LOCK_wakeup_ready);
mysql_mutex_destroy(&LOCK_thd_data);
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
dbug_sentry= THD_SENTRY_GONE;
#endif
#ifndef EMBEDDED_LIBRARY
@@ -3692,7 +3692,7 @@ void THD::set_n_backup_active_arena(Query_arena *set, Query_arena *backup)
backup->set_query_arena(this);
set_query_arena(set);
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
backup->is_backup_arena= TRUE;
#endif
DBUG_VOID_RETURN;
@@ -3711,7 +3711,7 @@ void THD::restore_active_arena(Query_arena *set, Query_arena *backup)
DBUG_ASSERT(backup->is_backup_arena);
set->set_query_arena(this);
set_query_arena(backup);
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
backup->is_backup_arena= FALSE;
#endif
DBUG_VOID_RETURN;
@@ -6409,7 +6409,7 @@ CPP_UNNAMED_NS_START
{
DBUG_ASSERT(s < sizeof(m_ptr)/sizeof(*m_ptr));
DBUG_ASSERT(m_ptr[s] != 0);
- DBUG_ASSERT(m_alloc_checked == TRUE);
+ DBUG_SLOW_ASSERT(m_alloc_checked == TRUE);
return m_ptr[s];
}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 1c2b2717591..f5834186a45 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -890,7 +890,7 @@ void free_tmp_table(THD *thd, TABLE *entry);
/* The following macro is to make init of Query_arena simpler */
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
#define INIT_ARENA_DBUG_INFO is_backup_arena= 0; is_reprepared= FALSE;
#else
#define INIT_ARENA_DBUG_INFO
@@ -905,7 +905,7 @@ public:
*/
Item *free_list;
MEM_ROOT *mem_root; // Pointer to current memroot
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
bool is_backup_arena; /* True if this arena is used for backup. */
bool is_reprepared;
#endif
@@ -2206,7 +2206,7 @@ public:
HASH ull_hash;
/* Hash of used seqeunces (for PREVIOUS value) */
HASH sequences;
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
uint dbug_sentry; // watch out for memory corruption
#endif
struct st_my_thread_var *mysys_var;
@@ -6036,7 +6036,7 @@ public:
(int) m_db.length, (m_db.length ? m_db.str : ""),
dot, ".",
(int) m_name.length, m_name.str);
- DBUG_ASSERT(ok_for_lower_case_names(m_db.str));
+ DBUG_SLOW_ASSERT(ok_for_lower_case_names(m_db.str));
return false;
}
};
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 223d3c1b86e..c71c1e6f378 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -5473,7 +5473,7 @@ bool LEX::sp_for_loop_condition(THD *thd, const Lex_for_loop_st &loop)
Item_splocal(thd, &src->name, src->offset, src->sql_type());
if (args[i] == NULL)
return true;
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
args[i]->m_sp= sphead;
#endif
}
@@ -5607,7 +5607,7 @@ bool LEX::sp_for_loop_increment(THD *thd, const Lex_for_loop_st &loop)
loop.m_index->sql_type());
if (splocal == NULL)
return true;
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
splocal->m_sp= sphead;
#endif
Item_int *inc= new (thd->mem_root) Item_int(thd, loop.m_direction);
@@ -6396,7 +6396,7 @@ Item_splocal *LEX::create_item_spvar_row_field(THD *thd,
pos_in_q, length_in_q)))
return NULL;
}
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
item->m_sp= sphead;
#endif
safe_to_cache_query=0;
@@ -6563,7 +6563,7 @@ Item *LEX::create_item_limit(THD *thd,
spv->offset, spv->sql_type(),
pos_in_q, length_in_q)))
return NULL;
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
item->m_sp= sphead;
#endif
safe_to_cache_query= 0;
@@ -6686,7 +6686,7 @@ Item *LEX::create_item_ident_sp(THD *thd, LEX_CSTRING *name,
start_in_q, length_in_q);
if (splocal == NULL)
return NULL;
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
splocal->m_sp= sphead;
#endif
safe_to_cache_query= 0;
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 9bae754a8c7..0302c4f13bf 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -1669,7 +1669,7 @@ int plugin_init(int *argc, char **argv, int flags)
*/
global_system_variables.table_plugin =
intern_plugin_lock(NULL, plugin_int_to_ref(plugin_ptr));
- DBUG_ASSERT(plugin_ptr->ref_count == 1);
+ DBUG_SLOW_ASSERT(plugin_ptr->ref_count == 1);
}
mysql_mutex_unlock(&LOCK_plugin);
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index ef94d06a567..1e117ae93ba 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -2953,7 +2953,7 @@ void reinit_stmt_before_use(THD *thd, LEX *lex)
for (order= sl->order_list.first; order; order= order->next)
order->item= &order->item_ptr;
{
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
bool res=
#endif
sl->handle_derived(lex, DT_REINIT);
@@ -4254,7 +4254,7 @@ Prepared_statement::execute_bulk_loop(String *expanded_query,
packet_end= packet_end_arg;
iterations= TRUE;
start_param= true;
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
Item *free_list_state= thd->free_list;
#endif
thd->select_number= select_number_after_prepare;
@@ -4479,7 +4479,7 @@ Prepared_statement::reprepare()
{
swap_prepared_statement(&copy);
swap_parameter_array(param_array, copy.param_array, param_count);
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
is_reprepared= TRUE;
#endif
/*
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index e02e5f9d5f1..70237264770 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -217,7 +217,7 @@ int LEX::case_stmt_action_when(Item *when, bool simple)
var= new (thd->mem_root)
Item_case_expr(thd, spcont->get_current_case_expr_id());
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
if (var)
{
var->m_sp= sphead;
@@ -399,7 +399,7 @@ LEX::create_item_for_sp_var(LEX_CSTRING *name, sp_variable *spvar,
Item_splocal(thd, name, spvar->offset, spvar->sql_type(),
pos_in_q, len_in_q);
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
if (item)
item->m_sp= sphead;
#endif
diff --git a/sql/sys_vars.ic b/sql/sys_vars.ic
index ed0d6d59f30..f3837f0246a 100644
--- a/sql/sys_vars.ic
+++ b/sql/sys_vars.ic
@@ -612,7 +612,7 @@ public:
/* parse and feel list with default values */
if (thd)
{
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
bool res=
#endif
sysvartrack_validate_value(thd,
diff --git a/sql/table.h b/sql/table.h
index f2c615ba414..9ecec6d636c 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -2605,7 +2605,7 @@ static inline void tmp_restore_column_map(MY_BITMAP *bitmap,
static inline my_bitmap_map *dbug_tmp_use_all_columns(TABLE *table,
MY_BITMAP *bitmap)
{
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
return tmp_use_all_columns(table, bitmap);
#else
return 0;
@@ -2615,7 +2615,7 @@ static inline my_bitmap_map *dbug_tmp_use_all_columns(TABLE *table,
static inline void dbug_tmp_restore_column_map(MY_BITMAP *bitmap,
my_bitmap_map *old)
{
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
tmp_restore_column_map(bitmap, old);
#endif
}
@@ -2630,7 +2630,7 @@ static inline void dbug_tmp_use_all_columns(TABLE *table,
MY_BITMAP *read_set,
MY_BITMAP *write_set)
{
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
save[0]= read_set->bitmap;
save[1]= write_set->bitmap;
(void) tmp_use_all_columns(table, read_set);
@@ -2643,7 +2643,7 @@ static inline void dbug_tmp_restore_column_maps(MY_BITMAP *read_set,
MY_BITMAP *write_set,
my_bitmap_map **old)
{
-#ifndef DBUG_OFF
+#ifdef DBUG_ASSERT_EXISTS
tmp_restore_column_map(read_set, old[0]);
tmp_restore_column_map(write_set, old[1]);
#endif