Commit 8b328b24 authored by unknown's avatar unknown

Replace ut_anp with ut_a


innobase/include/ut0dbg.h:
  Remove ut_anp
  Replace fprintf with fputs
  Move string constants to .c file
innobase/ut/ut0dbg.c:
  Move string constants to .c file
parent bebe22a9
......@@ -632,7 +632,7 @@ fil_space_create(
/* Spaces with an odd id number are reserved to replicate spaces
used in log debugging */
ut_anp((purpose == FIL_LOG) || (id % 2 == 0));
ut_a((purpose == FIL_LOG) || (id % 2 == 0));
#endif
mutex_enter(&(system->mutex));
......@@ -1230,8 +1230,8 @@ loop:
/* Do aio */
ut_anp(byte_offset % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_anp((len % OS_FILE_LOG_BLOCK_SIZE) == 0);
ut_a(byte_offset % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_a((len % OS_FILE_LOG_BLOCK_SIZE) == 0);
/* Queue the aio request */
ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
......
......@@ -2940,7 +2940,7 @@ fseg_free_step(
freed yet */
ut_a(descr);
ut_anp(xdes_get_bit(descr, XDES_FREE_BIT, buf_frame_get_page_no(header)
ut_a(xdes_get_bit(descr, XDES_FREE_BIT, buf_frame_get_page_no(header)
% FSP_EXTENT_SIZE, mtr) == FALSE);
inode = fseg_inode_get(header, mtr);
......
......@@ -10,7 +10,6 @@ Created 1/30/1994 Heikki Tuuri
#define ut0dbg_h
#include "univ.i"
#include <assert.h>
#include <stdlib.h>
#include "os0thread.h"
......@@ -20,110 +19,46 @@ extern ibool ut_dbg_stop_threads;
extern ulint* ut_dbg_null_ptr;
#define ut_a(EXPR)\
{\
ulint dbg_i;\
\
if (!((ulint)(EXPR) + ut_dbg_zero)) {\
ut_print_timestamp(stderr);\
fprintf(stderr,\
" InnoDB: Assertion failure in thread %lu in file %s line %lu\n",\
os_thread_pf(os_thread_get_curr_id()), IB__FILE__,\
(ulint)__LINE__);\
fprintf(stderr,\
"InnoDB: Failing assertion: " #EXPR);\
fprintf(stderr,\
"\nInnoDB: We intentionally generate a memory trap.\n");\
fprintf(stderr,\
"InnoDB: Send a detailed bug report to mysql@lists.mysql.com\n"\
"InnoDB: If you get repeated assertion failures or crashes, even\n"\
"InnoDB: immediately after the mysqld startup, there may be\n"\
"InnoDB: corruption in the InnoDB tablespace. See section 6.1 of\n"\
"InnoDB: http://www.innodb.com/ibman.php about forcing recovery.\n");\
ut_dbg_stop_threads = TRUE;\
dbg_i = *(ut_dbg_null_ptr);\
if (dbg_i) {\
ut_dbg_null_ptr = NULL;\
}\
}\
if (ut_dbg_stop_threads) {\
fprintf(stderr,\
"InnoDB: Thread %lu stopped in file %s line %lu\n",\
os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
os_thread_sleep(1000000000);\
}\
}
extern const char* ut_dbg_msg_assert_fail;
extern const char* ut_dbg_msg_trap;
extern const char* ut_dbg_msg_stop;
/* This can be used if there are % characters in the assertion formula:
if we try to printf the formula gcc would complain of illegal print
format characters */
#define ut_anp(EXPR)\
{\
ulint dbg_i;\
\
#define ut_a(EXPR) do {\
if (!((ulint)(EXPR) + ut_dbg_zero)) {\
ut_print_timestamp(stderr);\
fprintf(stderr,\
" InnoDB: Assertion failure in thread %lu in file %s line %lu\n",\
os_thread_pf(os_thread_get_curr_id()), IB__FILE__,\
fprintf(stderr, ut_dbg_msg_assert_fail,\
os_thread_pf(os_thread_get_curr_id()), __FILE__,\
(ulint)__LINE__);\
fprintf(stderr,\
"\nInnoDB: We intentionally generate a memory trap.\n");\
fprintf(stderr,\
"InnoDB: Send a detailed bug report to mysql@lists.mysql.com\n"\
"InnoDB: If you get repeated assertion failures or crashes, even\n"\
"InnoDB: immediately after the mysqld startup, there may be\n"\
"InnoDB: corruption in the InnoDB tablespace. See section 6.1 of\n"\
"InnoDB: http://www.innodb.com/ibman.php about forcing recovery.\n");\
fputs("InnoDB: Failing assertion: " #EXPR "\n", stderr);\
fputs(ut_dbg_msg_trap, stderr);\
ut_dbg_stop_threads = TRUE;\
dbg_i = *(ut_dbg_null_ptr);\
if (dbg_i) {\
ut_dbg_null_ptr = NULL;\
}\
if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL;\
}\
if (ut_dbg_stop_threads) {\
fprintf(stderr,\
"InnoDB: Thread %lu stopped in file %s line %lu\n",\
os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
fprintf(stderr, ut_dbg_msg_stop,\
os_thread_pf(os_thread_get_curr_id()), __FILE__, (ulint)__LINE__);\
os_thread_sleep(1000000000);\
}\
}
} while (0)
#define ut_error {\
ulint dbg_i;\
ut_print_timestamp(stderr);\
fprintf(stderr,\
" InnoDB: Assertion failure in thread %lu in file %s line %lu\n",\
os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
fprintf(stderr,\
"InnoDB: We intentionally generate a memory trap.\n");\
fprintf(stderr,\
"InnoDB: Send a detailed bug report to mysql@lists.mysql.com\n"\
"InnoDB: If you get repeated assertion failures or crashes, even\n"\
"InnoDB: immediately after the mysqld startup, there may be\n"\
"InnoDB: corruption in the InnoDB tablespace. See section 6.1 of\n"\
"InnoDB: http://www.innodb.com/ibman.php about forcing recovery.\n");\
ut_dbg_stop_threads = TRUE;\
dbg_i = *(ut_dbg_null_ptr);\
printf("%lu", dbg_i);\
}
#define ut_error do {\
ut_print_timestamp(stderr);\
fprintf(stderr, ut_dbg_msg_assert_fail,\
os_thread_pf(os_thread_get_curr_id()), __FILE__, (ulint)__LINE__);\
fprintf(stderr, ut_dbg_msg_trap);\
ut_dbg_stop_threads = TRUE;\
if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL;\
} while (0)
#ifdef UNIV_DEBUG
#define ut_ad(EXPR) ut_a(EXPR)
#define ut_d(EXPR) {EXPR;}
# define ut_ad(EXPR) ut_a(EXPR)
# define ut_d(EXPR) do {EXPR;} while (0)
#else
#define ut_ad(EXPR)
#define ut_d(EXPR)
# define ut_ad(EXPR)
# define ut_d(EXPR)
#endif
#define UT_NOT_USED(A) A = A
#endif
......@@ -407,7 +407,7 @@ log_pad_current_log_block(void)
log_close();
log_release();
ut_anp((ut_dulint_get_low(lsn) % OS_FILE_LOG_BLOCK_SIZE)
ut_a((ut_dulint_get_low(lsn) % OS_FILE_LOG_BLOCK_SIZE)
== LOG_BLOCK_HDR_SIZE);
}
......@@ -1117,8 +1117,8 @@ log_group_write_buf(
ulint i;
ut_ad(mutex_own(&(log_sys->mutex)));
ut_anp(len % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_anp(ut_dulint_get_low(start_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_a(len % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_a(ut_dulint_get_low(start_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
if (new_data_offset == 0) {
write_header = TRUE;
......@@ -2190,11 +2190,11 @@ log_group_archive(
start_lsn = log_sys->archived_lsn;
ut_anp(ut_dulint_get_low(start_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_a(ut_dulint_get_low(start_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
end_lsn = log_sys->next_archived_lsn;
ut_anp(ut_dulint_get_low(end_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_a(ut_dulint_get_low(end_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
buf = log_sys->archive_buf;
......@@ -2301,7 +2301,7 @@ loop:
group->next_archived_file_no = group->archived_file_no + n_files;
group->next_archived_offset = next_offset % group->file_size;
ut_anp(group->next_archived_offset % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_a(group->next_archived_offset % OS_FILE_LOG_BLOCK_SIZE == 0);
}
/*********************************************************
......@@ -2496,8 +2496,7 @@ loop:
start_lsn = log_sys->archived_lsn;
if (calc_new_limit) {
ut_anp(log_sys->archive_buf_size % OS_FILE_LOG_BLOCK_SIZE
== 0);
ut_a(log_sys->archive_buf_size % OS_FILE_LOG_BLOCK_SIZE == 0);
limit_lsn = ut_dulint_add(start_lsn,
log_sys->archive_buf_size);
......
......@@ -603,7 +603,7 @@ mem_pool_validate(
}
}
ut_anp(free + pool->reserved == pool->size
ut_a(free + pool->reserved == pool->size
- (pool->size % MEM_AREA_MIN_SIZE));
mutex_exit(&(pool->mutex));
......
......@@ -18,3 +18,16 @@ ibool ut_dbg_stop_threads = FALSE;
/* Null pointer used to generate memory trap */
ulint* ut_dbg_null_ptr = NULL;
const char* ut_dbg_msg_assert_fail =
"InnoDB: Assertion failure in thread %lu in file %s line %lu\n";
const char* ut_dbg_msg_trap =
"InnoDB: We intentionally generate a memory trap.\n"
"InnoDB: Send a detailed bug report to mysql@lists.mysql.com.\n"
"InnoDB: If you get repeated assertion failures or crashes, even\n"
"InnoDB: immediately after the mysqld startup, there may be\n"
"InnoDB: corruption in the InnoDB tablespace. See section 6.1 of\n"
"InnoDB: http://www.innodb.com/ibman.php about forcing recovery.\n";
const char* ut_dbg_msg_stop =
"InnoDB: Thread %lu stopped in file %s line %lu\n";
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment