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.
This commit is contained in:
Monty 2017-07-03 11:35:44 +03:00 committed by Sergei Golubchik
parent 52a1e4d613
commit 536215e32f
63 changed files with 213 additions and 153 deletions

View file

@ -243,8 +243,8 @@ ENDIF()
# Set DBUG_OFF and other optional release-only flags for non-debug project types
FOREACH(BUILD_TYPE RELEASE RELWITHDEBINFO MINSIZEREL)
FOREACH(LANG C CXX)
IF (NOT CMAKE_${LANG}_FLAGS_${BUILD_TYPE} MATCHES "DDBUG_" AND
NOT CMAKE_${LANG}_FLAGS MATCHES "DDBUG_")
IF (NOT CMAKE_${LANG}_FLAGS_${BUILD_TYPE} MATCHES "DDBUG_ON" AND
NOT CMAKE_${LANG}_FLAGS MATCHES "DDBUG_ON")
SET(CMAKE_${LANG}_FLAGS_${BUILD_TYPE}
"${CMAKE_${LANG}_FLAGS_${BUILD_TYPE}} -DDBUG_OFF")
ENDIF()

View file

@ -8907,7 +8907,7 @@ static void dump_backtrace(void)
#endif
}
fputs("Attempting backtrace...\n", stderr);
my_print_stacktrace(NULL, (ulong)my_thread_stack_size);
my_print_stacktrace(NULL, (ulong)my_thread_stack_size, 0);
}
#else

View file

@ -2144,7 +2144,6 @@ void _db_flush_()
(void) fflush(cs->stack->out_file->file);
}
#ifndef __WIN__
void _db_suicide_()
{
@ -2198,3 +2197,23 @@ int i_am_a_dummy_function() {
}
#endif /* DBUG_OFF */
/*
This function is called by default on DBUG_ASSERT() when compiled with
DBUG_ASSERT_AS_PRINTF
*/
#ifdef DBUG_ASSERT_AS_PRINTF
static void default_my_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);
}
void (*my_dbug_assert_failed)(const char *assert_expr, const char* file,
unsigned long line)= default_my_dbug_assert_failed;
#endif /* DBUG_ASSERT_AS_PRINTF */

View file

@ -103,13 +103,17 @@ extern const char* _db_get_func_(void);
#define DBUG_LOCK_FILE _db_lock_file_()
#define DBUG_UNLOCK_FILE _db_unlock_file_()
#define DBUG_ASSERT(A) assert(A)
#define DBUG_SLOW_ASSERT(A) assert(A)
#define DBUG_ASSERT_EXISTS
#define DBUG_EXPLAIN(buf,len) _db_explain_(0, (buf),(len))
#define DBUG_EXPLAIN_INITIAL(buf,len) _db_explain_init_((buf),(len))
#define DEBUGGER_OFF do { _dbug_on_= 0; } while(0)
#define DEBUGGER_ON do { _dbug_on_= 1; } while(0)
#define IF_DBUG(A,B) A
#define IF_DBUG_ASSERT(A,B) A
#define DBUG_SWAP_CODE_STATE(arg) dbug_swap_code_state(arg)
#define DBUG_FREE_CODE_STATE(arg) dbug_free_code_state(arg)
#undef DBUG_ASSERT_AS_PRINTF
#ifndef __WIN__
#define DBUG_ABORT() (_db_flush_(), abort())
@ -138,7 +142,7 @@ extern const char* _db_get_func_(void);
#else
extern void _db_suicide_(void);
#define DBUG_SUICIDE() (_db_flush_(), _db_suicide_())
#endif
#endif /* __WIN__ */
#else /* No debugger */
@ -159,7 +163,7 @@ extern void _db_suicide_(void);
#define DBUG_PROCESS(a1) do { } while(0)
#define DBUG_DUMP(keyword,a1,a2) do { } while(0)
#define DBUG_END() do { } while(0)
#define DBUG_ASSERT(A) do { } while(0)
#define DBUG_SLOW_ASSERT(A) do { } while(0)
#define DBUG_LOCK_FILE do { } while(0)
#define DBUG_FILE (stderr)
#define DBUG_UNLOCK_FILE do { } while(0)
@ -176,7 +180,16 @@ extern void _db_suicide_(void);
#define DBUG_CRASH_VOID_RETURN do { return; } while(0)
#define DBUG_SUICIDE() do { } while(0)
#endif
#ifdef DBUG_ASSERT_AS_PRINTF
extern void (*my_dbug_assert_failed)(const char *assert_expr, const char* file, unsigned long line);
#define DBUG_ASSERT(assert_expr) do { if (!(assert_expr)) { my_dbug_assert_failed(#assert_expr, __FILE__, __LINE__); }} while (0)
#define DBUG_ASSERT_EXISTS
#define IF_DBUG_ASSERT(A,B) A
#else
#define DBUG_ASSERT(A) do { } while(0)
#define IF_DBUG_ASSERT(A,B) B
#endif /* DBUG_ASSERT_AS_PRINTF */
#endif /* !defined(DBUG_OFF) && !defined(_lint) */
#ifdef EXTRA_DEBUG
/**

View file

@ -42,7 +42,8 @@ C_MODE_START
#if defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE)
void my_init_stacktrace();
void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack);
void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack,
my_bool silent);
int my_safe_print_str(const char* val, int max_len);
void my_write_core(int sig);
#if BACKTRACE_DEMANGLE

View file

@ -917,7 +917,7 @@ extern int unpackfrm(uchar **, size_t *, const uchar *);
extern ha_checksum my_checksum(ha_checksum crc, const uchar *mem,
size_t count);
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
extern void my_debug_put_break_here(void);
#else
#define my_debug_put_break_here() do {} while(0)

View file

@ -28,14 +28,14 @@ void Querycache_stream::store_uchar(uchar c)
if (data_end == cur_data)
use_next_block(TRUE);
*(cur_data++)= c;
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
stored_size++;
#endif
}
void Querycache_stream::store_short(ushort s)
{
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
stored_size+= 2;
#endif
if (data_end - cur_data > 1)
@ -58,7 +58,7 @@ void Querycache_stream::store_short(ushort s)
void Querycache_stream::store_int(uint i)
{
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
stored_size+= 4;
#endif
size_t rest_len= data_end - cur_data;
@ -85,7 +85,7 @@ void Querycache_stream::store_int(uint i)
void Querycache_stream::store_ll(ulonglong ll)
{
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
stored_size+= 8;
#endif
size_t rest_len= data_end - cur_data;
@ -110,7 +110,7 @@ void Querycache_stream::store_ll(ulonglong ll)
void Querycache_stream::store_str_only(const char *str, uint str_len)
{
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
stored_size+= str_len;
#endif
do

View file

@ -22,7 +22,7 @@ class Querycache_stream
Query_cache_block *block;
uint headers_len;
public:
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
Query_cache_block *first_block;
uint stored_size;
#endif
@ -31,7 +31,7 @@ public:
{
cur_data= ((uchar*)block)+headers_len;
data_end= cur_data + (block->used-headers_len);
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
first_block= ini_block;
stored_size= 0;
#endif

View file

@ -4375,7 +4375,7 @@ static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data)
MYSQL_FIELD *field;
uchar *null_ptr, bit;
uchar *row= (uchar*) data->data;
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
uchar *row_end= row + data->length;
#endif

View file

@ -421,11 +421,12 @@ static int keycache_pthread_cond_signal(mysql_cond_t *cond);
#undef inline
#endif
#define inline /* disabled inline for easier debugging */
static int fail_block(BLOCK_LINK *block);
static int fail_hlink(HASH_LINK *hlink);
static int cache_empty(SIMPLE_KEY_CACHE_CB *keycache);
#endif
#ifdef DBUG_ASSERT_EXISTS
static int fail_block(BLOCK_LINK *block);
#endif
static inline uint next_power(uint value)
{
@ -713,7 +714,7 @@ int prepare_resize_simple_key_cache(SIMPLE_KEY_CACHE_CB *keycache,
res= 1;
goto finish;
}
DBUG_ASSERT(cache_empty(keycache));
DBUG_SLOW_ASSERT(cache_empty(keycache));
/* End the flush phase. */
keycache->resize_in_flush= 0;
@ -1088,7 +1089,7 @@ static void unlink_from_queue(KEYCACHE_WQUEUE *wqueue,
thread->prev);
}
thread->next= NULL;
#if !defined(DBUG_OFF)
#ifdef DBUG_ASSERT_EXISTS
/*
This makes it easier to see it's not in a chain during debugging.
And some DBUG_ASSERT() rely on it.
@ -1211,7 +1212,7 @@ static inline void unlink_changed(BLOCK_LINK *block)
block->next_changed->prev_changed= block->prev_changed;
*block->prev_changed= block->next_changed;
#if !defined(DBUG_OFF)
#ifdef DBUG_ASSERT_EXISTS
/*
This makes it easier to see it's not in a chain during debugging.
And some DBUG_ASSERT() rely on it.
@ -1497,7 +1498,7 @@ static void unlink_block(SIMPLE_KEY_CACHE_CB *keycache, BLOCK_LINK *block)
keycache->used_ins=STRUCT_PTR(BLOCK_LINK, next_used, block->prev_used);
}
block->next_used= NULL;
#if !defined(DBUG_OFF)
#ifdef DBUG_ASSERT_EXISTS
/*
This makes it easier to see it's not in a chain during debugging.
And some DBUG_ASSERT() rely on it.
@ -4309,10 +4310,8 @@ restart:
} /* if (keycache->disk_blocks > 0 */
#ifndef DBUG_OFF
DBUG_EXECUTE("check_keycache",
test_key_cache(keycache, "end of flush_key_blocks", 0););
#endif
err:
if (cache != cache_buff)
my_free(cache);
@ -4790,11 +4789,12 @@ void keycache_debug_log_close(void)
#endif /* defined(KEYCACHE_DEBUG) */
#if !defined(DBUG_OFF)
#ifdef DBUG_ASSERT_EXISTS
#define F_B_PRT(_f_, _v_) DBUG_PRINT("assert_fail", (_f_, _v_))
static int fail_block(BLOCK_LINK *block)
static int fail_block(BLOCK_LINK *block __attribute__((unused)))
{
#ifndef DBUG_OFF
F_B_PRT("block->next_used: %lx\n", (ulong) block->next_used);
F_B_PRT("block->prev_used: %lx\n", (ulong) block->prev_used);
F_B_PRT("block->next_changed: %lx\n", (ulong) block->next_changed);
@ -4805,10 +4805,13 @@ static int fail_block(BLOCK_LINK *block)
F_B_PRT("block->offset: %u\n", block->offset);
F_B_PRT("block->requests: %u\n", block->requests);
F_B_PRT("block->temperature: %u\n", block->temperature);
#endif
return 0; /* Let the assert fail. */
}
#endif
static int fail_hlink(HASH_LINK *hlink)
#ifndef DBUG_OFF
static int fail_hlink(HASH_LINK *hlink __attribute__((unused)))
{
F_B_PRT("hlink->next: %lx\n", (ulong) hlink->next);
F_B_PRT("hlink->prev: %lx\n", (ulong) hlink->prev);

View file

@ -230,7 +230,7 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
my_init_done= my_thr_key_mysys_exists= 0;
} /* my_end */
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
/* Dummy tag function for debugging */
void my_debug_put_break_here(void)

View file

@ -178,12 +178,13 @@ int my_safe_print_str(const char* val, int max_len)
#include <ucontext.h>
void my_print_stacktrace(uchar* stack_bottom __attribute__((unused)),
ulong thread_stack __attribute__((unused)))
ulong thread_stack __attribute__((unused)),
my_bool silent)
{
if (printstack(fileno(stderr)) == -1)
my_safe_printf_stderr("%s",
"Error when traversing the stack, stack appears corrupt.\n");
else
else if (!silent)
my_safe_printf_stderr("%s",
"Please read "
"http://dev.mysql.com/doc/refman/5.1/en/resolve-stack-dump.html\n"
@ -260,7 +261,8 @@ static int print_with_addr_resolve(void **addrs, int n)
}
#endif
void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack)
void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack,
my_bool silent __attribute__((unused)))
{
void *addrs[128];
char **strings __attribute__((unused)) = NULL;
@ -334,7 +336,8 @@ inline uint32* find_prev_pc(uint32* pc, uchar** fp)
}
#endif /* defined(__alpha__) && defined(__GNUC__) */
void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack)
void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack,
my_bool silent)
{
uchar** UNINIT_VAR(fp);
uint frame_count = 0, sigreturn_frame_count;
@ -449,7 +452,8 @@ void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack)
"Stack trace seems successful - bottom reached\n");
end:
my_safe_printf_stderr("%s",
if (!silent)
my_safe_printf_stderr("%s",
"Please read "
"http://dev.mysql.com/doc/refman/5.1/en/resolve-stack-dump.html\n"
"and follow instructions on how to resolve the stack trace.\n"
@ -610,7 +614,7 @@ static void get_symbol_path(char *path, size_t size)
#define SYMOPT_NO_PROMPTS 0
#endif
void my_print_stacktrace(uchar* unused1, ulong unused2)
void my_print_stacktrace(uchar* unused1, ulong unused2, my_bool silent)
{
HANDLE hProcess= GetCurrentProcess();
HANDLE hThread= GetCurrentThread();

View file

@ -261,7 +261,8 @@ void thr_end_alarm(thr_alarm_t *alarmed)
alarm_data= (ALARM*) ((uchar*) *alarmed - offsetof(ALARM,alarmed));
mysql_mutex_lock(&LOCK_alarm);
DBUG_ASSERT(alarm_data->index_in_queue != 0);
DBUG_ASSERT(queue_element(&alarm_queue, alarm_data->index_in_queue) ==
DBUG_ASSERT((ALARM*) queue_element(&alarm_queue,
alarm_data->index_in_queue) ==
alarm_data);
queue_remove(&alarm_queue, alarm_data->index_in_queue);
mysql_mutex_unlock(&LOCK_alarm);

View file

@ -1541,7 +1541,7 @@ void thr_downgrade_write_lock(THR_LOCK_DATA *in_data,
enum thr_lock_type new_lock_type)
{
THR_LOCK *lock=in_data->lock;
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
enum thr_lock_type old_lock_type= in_data->type;
#endif
DBUG_ENTER("thr_downgrade_write_only_lock");

View file

@ -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

View file

@ -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());

View file

@ -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.

View file

@ -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

View file

@ -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)
{

View file

@ -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

View file

@ -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);

View file

@ -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)
{

View file

@ -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; }

View file

@ -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())

View file

@ -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

View file

@ -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);
}

View file

@ -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

View file

@ -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)
{

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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);

View file

@ -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
}

View file

@ -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

View file

@ -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;
/*

View file

@ -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];
}

View file

@ -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;
}
};

View file

@ -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;

View file

@ -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);

View file

@ -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
/*

View file

@ -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

View file

@ -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,

View file

@ -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

View file

@ -3087,7 +3087,7 @@ ha_innobase::update_thd(
m_user_thd, thd));
/* The table should have been opened in ha_innobase::open(). */
DBUG_ASSERT(m_prebuilt->table->n_ref_count > 0);
ut_ad(m_prebuilt->table->n_ref_count > 0);
trx_t* trx = check_trx_exists(thd);
@ -14340,7 +14340,7 @@ ha_innobase::info_low(
m_prebuilt->trx->op_info = "returning various info to MariaDB";
ib_table = m_prebuilt->table;
DBUG_ASSERT(ib_table->n_ref_count > 0);
ut_ad(ib_table->n_ref_count > 0);
if (flag & HA_STATUS_TIME) {
if (is_analyze || innobase_stats_on_metadata) {

View file

@ -1677,7 +1677,7 @@ struct dict_table_t {
It is protected by lock_sys->mutex. */
ulint n_rec_locks;
#ifndef UNIV_DEBUG
#ifndef DBUG_ASSERT_EXISTS
private:
#endif
/** Count of how many handles are opened to this table. Dropping of the

View file

@ -493,10 +493,10 @@ struct OSMutex {
}
private:
#ifdef UNIV_DEBUG
#ifdef DBUG_ASSERT_EXISTS
/** true if the mutex has been freed/destroyed. */
bool m_freed;
#endif /* UNIV_DEBUG */
#endif /* DBUG_ASSERT_EXISTS */
sys_mutex_t m_mutex;
};

View file

@ -61,7 +61,7 @@ ut_dbg_assertion_failed(
ut_dbg_assertion_failed(0, __FILE__, __LINE__)
/** Debug assertion */
#define ut_ad DBUG_ASSERT
#define ut_ad DBUG_SLOW_ASSERT
#if defined(UNIV_DEBUG) || !defined(DBUG_OFF)
/** Debug statement. Does nothing unless UNIV_DEBUG is defined. */
#define ut_d(EXPR) EXPR

View file

@ -1865,7 +1865,7 @@ lock_queue_validate(
hash_table_t* hash;
hash_cell_t* cell;
lock_t* next;
bool wait_lock = false;
bool wait_lock __attribute__((unused))= false;
if (in_lock == NULL) {
return true;

View file

@ -1443,7 +1443,7 @@ row_merge_write_rec_low(
}
memcpy(b, mrec - rec_offs_extra_size(offsets), rec_offs_size(offsets));
DBUG_ASSERT(b + rec_offs_size(offsets) == end);
DBUG_SLOW_ASSERT(b + rec_offs_size(offsets) == end);
DBUG_VOID_RETURN;
}

View file

@ -2926,7 +2926,7 @@ int _ma_bitmap_create_first(MARIA_SHARE *share)
static my_bool
flush_log_for_bitmap(PAGECACHE_IO_HOOK_ARGS *args __attribute__ ((unused)))
{
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
const MARIA_SHARE *share= (MARIA_SHARE*)args->data;
#endif
DBUG_ENTER("flush_log_for_bitmap");

View file

@ -6893,7 +6893,7 @@ uint _ma_apply_redo_insert_row_blobs(MARIA_HA *info,
}
else
{
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
uchar found_page_type= (buff[PAGE_TYPE_OFFSET] & PAGE_TYPE_MASK);
#endif
if (lsn_korr(buff) >= lsn)

View file

@ -946,7 +946,7 @@ uint _ma_apply_redo_index(MARIA_HA *info,
uint page_offset= 0, org_page_length;
uint page_length, keypage_header, keynr;
uint max_page_size= share->max_index_block_size;
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
uint new_page_length= 0;
#endif
int result;
@ -1110,7 +1110,7 @@ uint _ma_apply_redo_index(MARIA_HA *info,
DBUG_PRINT("redo", ("org_page_length: %u new_page_length: %u",
uint2korr(header), uint2korr(header+2)));
DBUG_ASSERT(uint2korr(header) == page_length);
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
new_page_length= MY_MIN(uint2korr(header+2), max_page_size);
#endif
header+= 4;

View file

@ -3010,7 +3010,7 @@ restart:
if (cmp_translog_addr(addr, in_buffers) >= 0)
{
uint16 buffer_no= log_descriptor.bc.buffer_no;
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
uint16 buffer_start= buffer_no;
#endif
struct st_translog_buffer *buffer_unlock= log_descriptor.bc.buffer;
@ -6228,7 +6228,7 @@ my_bool translog_write_record(LSN *lsn,
DBUG_ASSERT(translog_status == TRANSLOG_OK ||
translog_status == TRANSLOG_READONLY);
DBUG_ASSERT(type != 0);
DBUG_ASSERT((uint)type <= max_allowed_translog_type);
DBUG_SLOW_ASSERT((uint)type <= max_allowed_translog_type);
if (unlikely(translog_status != TRANSLOG_OK))
{
DBUG_PRINT("error", ("Transaction log is write protected"));

View file

@ -420,11 +420,11 @@ my_off_t _ma_new(register MARIA_HA *info, int level,
Next deleted page's number is in the header of the present page
(single linked list):
*/
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
my_off_t key_del_current;
#endif
share->key_del_current= mi_sizekorr(buff+share->keypage_header);
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
key_del_current= share->key_del_current;
DBUG_ASSERT((key_del_current != 0) &&
((key_del_current == HA_OFFSET_ERROR) ||
@ -512,7 +512,7 @@ static my_bool _ma_log_compact_keypage(MARIA_PAGE *ma_page,
@param min_read_from Remove all trids from page less than this
@retval 0 Ok
®retval 1 Error; my_errno contains the error
®retval 1 Error; my_errno contains the error
*/
my_bool _ma_compact_keypage(MARIA_PAGE *ma_page, TrID min_read_from)

View file

@ -2044,7 +2044,7 @@ restart:
DBUG_ASSERT(block->rlocks_queue == 0);
DBUG_ASSERT(block->pins == 0);
block->status= 0;
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
block->type= PAGECACHE_EMPTY_PAGE;
#endif
DBUG_ASSERT(reg_req);
@ -2187,7 +2187,7 @@ restart:
block->last_hit_time= 0;
block->status= error ? PCBLOCK_ERROR : 0;
block->error= error ? (int16) my_errno : 0;
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
block->type= PAGECACHE_EMPTY_PAGE;
if (error)
my_debug_put_break_here();
@ -4274,7 +4274,7 @@ static my_bool free_block(PAGECACHE *pagecache, PAGECACHE_BLOCK_LINK *block,
DBUG_ASSERT(block->requests >= 1);
DBUG_ASSERT(block->next_used == NULL);
block->status= 0;
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
block->type= PAGECACHE_EMPTY_PAGE;
#endif
block->rec_lsn= LSN_MAX;
@ -4781,10 +4781,8 @@ restart:
wqueue_release_queue(&us_flusher.flush_queue);
}
#ifndef DBUG_OFF
DBUG_EXECUTE("check_pagecache",
test_key_cache(pagecache, "end of flush_pagecache_blocks", 0););
#endif
if (cache != cache_buff)
my_free(cache);
if (rc != 0)

View file

@ -287,7 +287,7 @@ my_bool maria_page_crc_check_none(int res,
my_bool maria_page_filler_set_normal(PAGECACHE_IO_HOOK_ARGS *args)
{
uchar *page= args->page;
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
pgcache_page_no_t page_no= args->pageno;
#endif
MARIA_SHARE *share= (MARIA_SHARE *)args->data;

View file

@ -533,7 +533,7 @@ my_bool _ma_trnman_end_trans_hook(TRN *trn, my_bool commit,
}
else
{
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
/*
We need to keep share->in_trans correct in the debug library
because of the assert in maria_close()

View file

@ -23,13 +23,13 @@ namespace mrn {
DebugColumnAccess::DebugColumnAccess(TABLE *table, MY_BITMAP *bitmap)
: table_(table),
bitmap_(bitmap) {
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
map_ = dbug_tmp_use_all_columns(table_, bitmap_);
#endif
}
DebugColumnAccess::~DebugColumnAccess() {
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
dbug_tmp_restore_column_map(bitmap_, map_);
#endif
}

View file

@ -26,7 +26,7 @@ namespace mrn {
class DebugColumnAccess {
TABLE *table_;
MY_BITMAP *bitmap_;
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
my_bitmap_map *map_;
#endif
public:

View file

@ -603,6 +603,10 @@ public:
const int storage_length = static_cast<int>(max_storage_fmt_length());
return (storage_length - offset) >= needed;
}
#else
inline bool is_storage_available(const int &offset, const int &needed) const {
return 1;
}
#endif // DBUG_OFF
/* Global number of this index (used as prefix in StorageFormat) */

View file

@ -235,19 +235,19 @@ inline mutex_t::mutex_t(void) {
_owners = 0;
_owner = _null_owner;
#endif
int r = pthread_mutex_init(&_mutex, MY_MUTEX_INIT_FAST);
int r __attribute__((unused)) = pthread_mutex_init(&_mutex, MY_MUTEX_INIT_FAST);
assert_debug(r == 0);
}
inline mutex_t::~mutex_t(void) {
#ifdef TOKUDB_DEBUG
assert_debug(_owners == 0);
#endif
int r = pthread_mutex_destroy(&_mutex);
int r __attribute__((unused)) = pthread_mutex_destroy(&_mutex);
assert_debug(r == 0);
}
inline void mutex_t::lock(void) {
assert_debug(is_owned_by_me() == false);
int r = pthread_mutex_lock(&_mutex);
int r __attribute__((unused)) = pthread_mutex_lock(&_mutex);
assert_debug(r == 0);
#ifdef TOKUDB_DEBUG
_owners++;
@ -274,7 +274,7 @@ inline void mutex_t::unlock(void) {
_owners--;
_owner = _null_owner;
#endif
int r = pthread_mutex_unlock(&_mutex);
int r __attribute__((unused)) = pthread_mutex_unlock(&_mutex);
assert_debug(r == 0);
}
#ifdef TOKUDB_DEBUG
@ -285,11 +285,11 @@ inline bool mutex_t::is_owned_by_me(void) const {
inline rwlock_t::rwlock_t(void) {
int r = pthread_rwlock_init(&_rwlock, NULL);
int r __attribute__((unused)) = pthread_rwlock_init(&_rwlock, NULL);
assert_debug(r == 0);
}
inline rwlock_t::~rwlock_t(void) {
int r = pthread_rwlock_destroy(&_rwlock);
int r __attribute__((unused)) = pthread_rwlock_destroy(&_rwlock);
assert_debug(r == 0);
}
inline void rwlock_t::lock_read(void) {
@ -345,7 +345,7 @@ inline int rwlock_t::lock_write(ulonglong microseconds) {
return r;
}
inline void rwlock_t::unlock(void) {
int r = pthread_rwlock_unlock(&_rwlock);
int r __attribute__((unused)) = pthread_rwlock_unlock(&_rwlock);
assert_debug(r == 0);
}
inline rwlock_t::rwlock_t(const rwlock_t&) {
@ -358,7 +358,7 @@ inline rwlock_t& rwlock_t::operator=(const rwlock_t&) {
inline event_t::event_t(bool create_signalled, bool manual_reset) :
_manual_reset(manual_reset) {
int r = pthread_mutex_init(&_mutex, NULL);
int __attribute__((unused)) r = pthread_mutex_init(&_mutex, NULL);
assert_debug(r == 0);
r = pthread_cond_init(&_cond, NULL);
assert_debug(r == 0);
@ -370,13 +370,13 @@ inline event_t::event_t(bool create_signalled, bool manual_reset) :
_pulsed = false;
}
inline event_t::~event_t(void) {
int r = pthread_mutex_destroy(&_mutex);
int r __attribute__((unused)) = pthread_mutex_destroy(&_mutex);
assert_debug(r == 0);
r = pthread_cond_destroy(&_cond);
assert_debug(r == 0);
}
inline void event_t::wait(void) {
int r = pthread_mutex_lock(&_mutex);
int r __attribute__((unused)) = pthread_mutex_lock(&_mutex);
assert_debug(r == 0);
while (_signalled == false && _pulsed == false) {
r = pthread_cond_wait(&_cond, &_mutex);
@ -413,7 +413,7 @@ inline int event_t::wait(ulonglong microseconds) {
return 0;
}
inline void event_t::signal(void) {
int r = pthread_mutex_lock(&_mutex);
int r __attribute__((unused)) = pthread_mutex_lock(&_mutex);
assert_debug(r == 0);
_signalled = true;
if (_manual_reset) {
@ -427,7 +427,7 @@ inline void event_t::signal(void) {
assert_debug(r == 0);
}
inline void event_t::pulse(void) {
int r = pthread_mutex_lock(&_mutex);
int r __attribute__((unused)) = pthread_mutex_lock(&_mutex);
assert_debug(r == 0);
_pulsed = true;
r = pthread_cond_signal(&_cond);
@ -437,7 +437,7 @@ inline void event_t::pulse(void) {
}
inline bool event_t::signalled(void) {
bool ret = false;
int r = pthread_mutex_lock(&_mutex);
int r __attribute__((unused)) = pthread_mutex_lock(&_mutex);
assert_debug(r == 0);
ret = _signalled;
r = pthread_mutex_unlock(&_mutex);
@ -445,7 +445,7 @@ inline bool event_t::signalled(void) {
return ret;
}
inline void event_t::reset(void) {
int r = pthread_mutex_lock(&_mutex);
int r __attribute__((unused)) = pthread_mutex_lock(&_mutex);
assert_debug(r == 0);
_signalled = false;
_pulsed = false;
@ -467,21 +467,21 @@ inline semaphore_t::semaphore_t(
_initial_count(initial_count),
_max_count(max_count) {
int r = pthread_mutex_init(&_mutex, NULL);
int r __attribute__((unused)) = pthread_mutex_init(&_mutex, NULL);
assert_debug(r == 0);
r = pthread_cond_init(&_cond, NULL);
assert_debug(r == 0);
_signalled = _initial_count;
}
inline semaphore_t::~semaphore_t(void) {
int r = pthread_mutex_destroy(&_mutex);
int r __attribute__((unused)) = pthread_mutex_destroy(&_mutex);
assert_debug(r == 0);
r = pthread_cond_destroy(&_cond);
assert_debug(r == 0);
}
inline semaphore_t::E_WAIT semaphore_t::wait(void) {
E_WAIT ret;
int r = pthread_mutex_lock(&_mutex);
int r __attribute__((unused)) = pthread_mutex_lock(&_mutex);
assert_debug(r == 0);
while (_signalled == 0 && _interrupted == false) {
r = pthread_cond_wait(&_cond, &_mutex);
@ -524,7 +524,7 @@ inline semaphore_t::E_WAIT semaphore_t::wait(ulonglong microseconds) {
}
inline bool semaphore_t::signal(void) {
bool ret = false;
int r = pthread_mutex_lock(&_mutex);
int r __attribute__((unused)) = pthread_mutex_lock(&_mutex);
assert_debug(r == 0);
if (_signalled < _max_count) {
_signalled++;
@ -538,7 +538,7 @@ inline bool semaphore_t::signal(void) {
}
inline int semaphore_t::signalled(void) {
int ret = 0;
int r = pthread_mutex_lock(&_mutex);
int r __attribute__((unused)) = pthread_mutex_lock(&_mutex);
assert_debug(r == 0);
ret = _signalled;
r = pthread_mutex_unlock(&_mutex);
@ -546,7 +546,7 @@ inline int semaphore_t::signalled(void) {
return ret;
}
inline void semaphore_t::reset(void) {
int r = pthread_mutex_lock(&_mutex);
int r __attribute__((unused)) = pthread_mutex_lock(&_mutex);
assert_debug(r == 0);
_signalled = 0;
r = pthread_mutex_unlock(&_mutex);
@ -554,7 +554,7 @@ inline void semaphore_t::reset(void) {
return;
}
inline void semaphore_t::set_interrupt(void) {
int r = pthread_mutex_lock(&_mutex);
int r __attribute__((unused)) = pthread_mutex_lock(&_mutex);
assert_debug(r == 0);
_interrupted = true;
r = pthread_cond_broadcast(&_cond);
@ -563,7 +563,7 @@ inline void semaphore_t::set_interrupt(void) {
assert_debug(r == 0);
}
inline void semaphore_t::clear_interrupt(void) {
int r = pthread_mutex_lock(&_mutex);
int r __attribute__((unused)) = pthread_mutex_lock(&_mutex);
assert_debug(r == 0);
_interrupted = false;
r = pthread_mutex_unlock(&_mutex);

View file

@ -2618,14 +2618,14 @@ void my_fill_utf32(CHARSET_INFO *cs,
char *s, size_t slen, int fill)
{
char buf[10];
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
uint buflen;
#endif
char *e= s + slen;
DBUG_ASSERT((slen % 4) == 0);
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
buflen=
#endif
cs->cset->wc_mb(cs, (my_wc_t) fill, (uchar*) buf,

View file

@ -17,6 +17,7 @@
/* This file is to be include first in all files in the string directory */
#undef DBUG_ASSERT_AS_PRINTF
#include <my_global.h> /* Define standar vars */
#include "m_string.h" /* Exernal defintions of string functions */