diff options
author | unknown <marko@hundin.mysql.fi> | 2004-03-12 13:46:26 +0200 |
---|---|---|
committer | unknown <marko@hundin.mysql.fi> | 2004-03-12 13:46:26 +0200 |
commit | 8b328b24c9baf36a13edf65304113a8eb23e9f6d (patch) | |
tree | 79233f10fc1fcf426888ddecadfccc593e2a77ec /innobase | |
parent | bebe22a99e0b48b09c4ac69561ede17ff1766b1a (diff) | |
download | mariadb-git-8b328b24c9baf36a13edf65304113a8eb23e9f6d.tar.gz |
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
Diffstat (limited to 'innobase')
-rw-r--r-- | innobase/fil/fil0fil.c | 6 | ||||
-rw-r--r-- | innobase/fsp/fsp0fsp.c | 2 | ||||
-rw-r--r-- | innobase/include/ut0dbg.h | 113 | ||||
-rw-r--r-- | innobase/log/log0log.c | 15 | ||||
-rw-r--r-- | innobase/mem/mem0pool.c | 2 | ||||
-rw-r--r-- | innobase/ut/ut0dbg.c | 13 |
6 files changed, 49 insertions, 102 deletions
diff --git a/innobase/fil/fil0fil.c b/innobase/fil/fil0fil.c index f55df90846c..3bca2d460d0 100644 --- a/innobase/fil/fil0fil.c +++ b/innobase/fil/fil0fil.c @@ -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, diff --git a/innobase/fsp/fsp0fsp.c b/innobase/fsp/fsp0fsp.c index 2cb3ad43e7f..61114b93601 100644 --- a/innobase/fsp/fsp0fsp.c +++ b/innobase/fsp/fsp0fsp.c @@ -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); diff --git a/innobase/include/ut0dbg.h b/innobase/include/ut0dbg.h index 54df031067f..bec9cdd42b5 100644 --- a/innobase/include/ut0dbg.h +++ b/innobase/include/ut0dbg.h @@ -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 diff --git a/innobase/log/log0log.c b/innobase/log/log0log.c index 5df63e39296..cd2b6f520b0 100644 --- a/innobase/log/log0log.c +++ b/innobase/log/log0log.c @@ -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); diff --git a/innobase/mem/mem0pool.c b/innobase/mem/mem0pool.c index b004a8c4df7..5ed12fedf43 100644 --- a/innobase/mem/mem0pool.c +++ b/innobase/mem/mem0pool.c @@ -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)); diff --git a/innobase/ut/ut0dbg.c b/innobase/ut/ut0dbg.c index d6593b70217..3697e31050f 100644 --- a/innobase/ut/ut0dbg.c +++ b/innobase/ut/ut0dbg.c @@ -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"; |