Commit e992adcb authored by marko@hundin.mysql.fi's avatar marko@hundin.mysql.fi

Merge hundin.mysql.fi:/home/marko/mysql-5.0

into hundin.mysql.fi:/home/marko/mysql-5.0-current
parents ff20e1c2 f7079888
This diff is collapsed.
This diff is collapsed.
...@@ -78,6 +78,7 @@ btr_pcur_store_position( ...@@ -78,6 +78,7 @@ btr_pcur_store_position(
rec_t* rec; rec_t* rec;
dict_tree_t* tree; dict_tree_t* tree;
page_t* page; page_t* page;
ulint offs;
ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES); ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
...@@ -87,7 +88,8 @@ btr_pcur_store_position( ...@@ -87,7 +88,8 @@ btr_pcur_store_position(
page_cursor = btr_pcur_get_page_cur(cursor); page_cursor = btr_pcur_get_page_cur(cursor);
rec = page_cur_get_rec(page_cursor); rec = page_cur_get_rec(page_cursor);
page = buf_frame_align(rec); page = ut_align_down(rec, UNIV_PAGE_SIZE);
offs = ut_align_offset(rec, UNIV_PAGE_SIZE);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page), ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_S_FIX) MTR_MEMO_PAGE_S_FIX)
...@@ -95,35 +97,33 @@ btr_pcur_store_position( ...@@ -95,35 +97,33 @@ btr_pcur_store_position(
MTR_MEMO_PAGE_X_FIX)); MTR_MEMO_PAGE_X_FIX));
ut_a(cursor->latch_mode != BTR_NO_LATCHES); ut_a(cursor->latch_mode != BTR_NO_LATCHES);
if (page_get_n_recs(page) == 0) { if (UNIV_UNLIKELY(page_get_n_recs(page) == 0)) {
/* It must be an empty index tree; NOTE that in this case /* It must be an empty index tree; NOTE that in this case
we do not store the modify_clock, but always do a search we do not store the modify_clock, but always do a search
if we restore the cursor position */ if we restore the cursor position */
ut_a(btr_page_get_next(page, mtr) == FIL_NULL ut_a(btr_page_get_next(page, mtr) == FIL_NULL);
&& btr_page_get_prev(page, mtr) == FIL_NULL); ut_a(btr_page_get_prev(page, mtr) == FIL_NULL);
if (rec == page_get_supremum_rec(page)) { cursor->old_stored = BTR_PCUR_OLD_STORED;
cursor->rel_pos = BTR_PCUR_AFTER_LAST_IN_TREE; if (page_rec_is_supremum_low(offs)) {
cursor->old_stored = BTR_PCUR_OLD_STORED;
return; cursor->rel_pos = BTR_PCUR_AFTER_LAST_IN_TREE;
} else {
cursor->rel_pos = BTR_PCUR_BEFORE_FIRST_IN_TREE;
} }
cursor->rel_pos = BTR_PCUR_BEFORE_FIRST_IN_TREE;
cursor->old_stored = BTR_PCUR_OLD_STORED;
return; return;
} }
if (rec == page_get_supremum_rec(page)) { if (page_rec_is_supremum_low(offs)) {
rec = page_rec_get_prev(rec); rec = page_rec_get_prev(rec);
cursor->rel_pos = BTR_PCUR_AFTER; cursor->rel_pos = BTR_PCUR_AFTER;
} else if (rec == page_get_infimum_rec(page)) { } else if (page_rec_is_infimum_low(offs)) {
rec = page_rec_get_next(rec); rec = page_rec_get_next(rec);
...@@ -139,7 +139,8 @@ btr_pcur_store_position( ...@@ -139,7 +139,8 @@ btr_pcur_store_position(
&cursor->buf_size); &cursor->buf_size);
cursor->block_when_stored = buf_block_align(page); cursor->block_when_stored = buf_block_align(page);
cursor->modify_clock = buf_frame_get_modify_clock(page); cursor->modify_clock = buf_block_get_modify_clock(
cursor->block_when_stored);
} }
/****************************************************************** /******************************************************************
...@@ -202,33 +203,27 @@ btr_pcur_restore_position( ...@@ -202,33 +203,27 @@ btr_pcur_restore_position(
dtuple_t* tuple; dtuple_t* tuple;
ulint mode; ulint mode;
ulint old_mode; ulint old_mode;
ibool from_left;
mem_heap_t* heap; mem_heap_t* heap;
ut_a(cursor->pos_state == BTR_PCUR_WAS_POSITIONED if (UNIV_UNLIKELY(cursor->old_stored != BTR_PCUR_OLD_STORED)
|| cursor->pos_state == BTR_PCUR_IS_POSITIONED); || UNIV_UNLIKELY(cursor->pos_state != BTR_PCUR_WAS_POSITIONED
if (cursor->old_stored != BTR_PCUR_OLD_STORED) { && cursor->pos_state != BTR_PCUR_IS_POSITIONED)) {
ut_print_buf(stderr, (const byte*)cursor, sizeof(btr_pcur_t)); ut_print_buf(stderr, (const byte*)cursor, sizeof(btr_pcur_t));
if (cursor->trx_if_known) { if (cursor->trx_if_known) {
trx_print(stderr, cursor->trx_if_known); trx_print(stderr, cursor->trx_if_known);
} }
ut_a(0); ut_error;
} }
if (cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE if (UNIV_UNLIKELY(cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE
|| cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE) { || cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) {
/* In these cases we do not try an optimistic restoration, /* In these cases we do not try an optimistic restoration,
but always do a search */ but always do a search */
if (cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE) { btr_cur_open_at_index_side(
from_left = TRUE; cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE,
} else {
from_left = FALSE;
}
btr_cur_open_at_index_side(from_left,
btr_pcur_get_btr_cur(cursor)->index, latch_mode, btr_pcur_get_btr_cur(cursor)->index, latch_mode,
btr_pcur_get_btr_cur(cursor), mtr); btr_pcur_get_btr_cur(cursor), mtr);
...@@ -243,12 +238,13 @@ btr_pcur_restore_position( ...@@ -243,12 +238,13 @@ btr_pcur_restore_position(
page = btr_cur_get_page(btr_pcur_get_btr_cur(cursor)); page = btr_cur_get_page(btr_pcur_get_btr_cur(cursor));
if (latch_mode == BTR_SEARCH_LEAF || latch_mode == BTR_MODIFY_LEAF) { if (UNIV_LIKELY(latch_mode == BTR_SEARCH_LEAF)
|| UNIV_LIKELY(latch_mode == BTR_MODIFY_LEAF)) {
/* Try optimistic restoration */ /* Try optimistic restoration */
if (buf_page_optimistic_get(latch_mode, if (UNIV_LIKELY(buf_page_optimistic_get(latch_mode,
cursor->block_when_stored, page, cursor->block_when_stored, page,
cursor->modify_clock, mtr)) { cursor->modify_clock, mtr))) {
cursor->pos_state = BTR_PCUR_IS_POSITIONED; cursor->pos_state = BTR_PCUR_IS_POSITIONED;
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_TREE_NODE); buf_page_dbg_add_level(page, SYNC_TREE_NODE);
...@@ -297,7 +293,7 @@ btr_pcur_restore_position( ...@@ -297,7 +293,7 @@ btr_pcur_restore_position(
/* Save the old search mode of the cursor */ /* Save the old search mode of the cursor */
old_mode = cursor->search_mode; old_mode = cursor->search_mode;
if (cursor->rel_pos == BTR_PCUR_ON) { if (UNIV_LIKELY(cursor->rel_pos == BTR_PCUR_ON)) {
mode = PAGE_CUR_LE; mode = PAGE_CUR_LE;
} else if (cursor->rel_pos == BTR_PCUR_AFTER) { } else if (cursor->rel_pos == BTR_PCUR_AFTER) {
mode = PAGE_CUR_G; mode = PAGE_CUR_G;
...@@ -323,12 +319,10 @@ btr_pcur_restore_position( ...@@ -323,12 +319,10 @@ btr_pcur_restore_position(
the cursor can now be on a different page! But we can retain the cursor can now be on a different page! But we can retain
the value of old_rec */ the value of old_rec */
cursor->modify_clock =
buf_frame_get_modify_clock(btr_pcur_get_page(cursor));
cursor->block_when_stored = cursor->block_when_stored =
buf_block_align(btr_pcur_get_page(cursor)); buf_block_align(btr_pcur_get_page(cursor));
cursor->modify_clock =
buf_block_get_modify_clock(cursor->block_when_stored);
cursor->old_stored = BTR_PCUR_OLD_STORED; cursor->old_stored = BTR_PCUR_OLD_STORED;
mem_heap_free(heap); mem_heap_free(heap);
......
This diff is collapsed.
...@@ -223,13 +223,14 @@ in the free list to the frames. ...@@ -223,13 +223,14 @@ in the free list to the frames.
buf_pool_t* buf_pool = NULL; /* The buffer buf_pool of the database */ buf_pool_t* buf_pool = NULL; /* The buffer buf_pool of the database */
#ifdef UNIV_DEBUG
ulint buf_dbg_counter = 0; /* This is used to insert validation ulint buf_dbg_counter = 0; /* This is used to insert validation
operations in excution in the operations in excution in the
debug version */ debug version */
ibool buf_debug_prints = FALSE; /* If this is set TRUE, ibool buf_debug_prints = FALSE; /* If this is set TRUE,
the program prints info whenever the program prints info whenever
read-ahead or flush occurs */ read-ahead or flush occurs */
#endif /* UNIV_DEBUG */
/************************************************************************ /************************************************************************
Calculates a page checksum which is stored to the page when it is written Calculates a page checksum which is stored to the page when it is written
to a file. Note that we must be careful to calculate the same value on to a file. Note that we must be careful to calculate the same value on
...@@ -1286,8 +1287,9 @@ buf_page_optimistic_get_func( ...@@ -1286,8 +1287,9 @@ buf_page_optimistic_get_func(
/* If AWE is used, block may have a different frame now, e.g., NULL */ /* If AWE is used, block may have a different frame now, e.g., NULL */
if (block->state != BUF_BLOCK_FILE_PAGE || block->frame != guess) { if (UNIV_UNLIKELY(block->state != BUF_BLOCK_FILE_PAGE)
|| UNIV_UNLIKELY(block->frame != guess)) {
exit_func:
mutex_exit(&(buf_pool->mutex)); mutex_exit(&(buf_pool->mutex));
return(FALSE); return(FALSE);
...@@ -1320,19 +1322,17 @@ buf_page_optimistic_get_func( ...@@ -1320,19 +1322,17 @@ buf_page_optimistic_get_func(
fix_type = MTR_MEMO_PAGE_X_FIX; fix_type = MTR_MEMO_PAGE_X_FIX;
} }
if (!success) { if (UNIV_UNLIKELY(!success)) {
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
block->buf_fix_count--; block->buf_fix_count--;
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
rw_lock_s_unlock(&(block->debug_latch)); rw_lock_s_unlock(&(block->debug_latch));
#endif #endif
mutex_exit(&(buf_pool->mutex)); goto exit_func;
return(FALSE);
} }
if (!UT_DULINT_EQ(modify_clock, block->modify_clock)) { if (UNIV_UNLIKELY(!UT_DULINT_EQ(modify_clock, block->modify_clock))) {
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(block->frame, SYNC_NO_ORDER_CHECK); buf_page_dbg_add_level(block->frame, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
...@@ -1347,10 +1347,8 @@ buf_page_optimistic_get_func( ...@@ -1347,10 +1347,8 @@ buf_page_optimistic_get_func(
block->buf_fix_count--; block->buf_fix_count--;
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
rw_lock_s_unlock(&(block->debug_latch)); rw_lock_s_unlock(&(block->debug_latch));
#endif #endif
mutex_exit(&(buf_pool->mutex)); goto exit_func;
return(FALSE);
} }
mtr_memo_push(mtr, block, fix_type); mtr_memo_push(mtr, block, fix_type);
...@@ -1368,7 +1366,7 @@ buf_page_optimistic_get_func( ...@@ -1368,7 +1366,7 @@ buf_page_optimistic_get_func(
#ifdef UNIV_DEBUG_FILE_ACCESSES #ifdef UNIV_DEBUG_FILE_ACCESSES
ut_a(block->file_page_was_freed == FALSE); ut_a(block->file_page_was_freed == FALSE);
#endif #endif
if (!accessed) { if (UNIV_UNLIKELY(!accessed)) {
/* In the case of a first access, try to apply linear /* In the case of a first access, try to apply linear
read-ahead */ read-ahead */
...@@ -1742,10 +1740,12 @@ buf_page_create( ...@@ -1742,10 +1740,12 @@ buf_page_create(
/* If we get here, the page was not in buf_pool: init it there */ /* If we get here, the page was not in buf_pool: init it there */
#ifdef UNIV_DEBUG
if (buf_debug_prints) { if (buf_debug_prints) {
fprintf(stderr, "Creating space %lu page %lu to buffer\n", fprintf(stderr, "Creating space %lu page %lu to buffer\n",
(ulong) space, (ulong) offset); (ulong) space, (ulong) offset);
} }
#endif /* UNIV_DEBUG */
block = free_block; block = free_block;
...@@ -1896,9 +1896,11 @@ buf_page_io_complete( ...@@ -1896,9 +1896,11 @@ buf_page_io_complete(
rw_lock_x_unlock_gen(&(block->lock), BUF_IO_READ); rw_lock_x_unlock_gen(&(block->lock), BUF_IO_READ);
#ifdef UNIV_DEBUG
if (buf_debug_prints) { if (buf_debug_prints) {
fputs("Has read ", stderr); fputs("Has read ", stderr);
} }
#endif /* UNIV_DEBUG */
} else { } else {
ut_ad(io_type == BUF_IO_WRITE); ut_ad(io_type == BUF_IO_WRITE);
...@@ -1911,17 +1913,21 @@ buf_page_io_complete( ...@@ -1911,17 +1913,21 @@ buf_page_io_complete(
buf_pool->n_pages_written++; buf_pool->n_pages_written++;
#ifdef UNIV_DEBUG
if (buf_debug_prints) { if (buf_debug_prints) {
fputs("Has written ", stderr); fputs("Has written ", stderr);
} }
#endif /* UNIV_DEBUG */
} }
mutex_exit(&(buf_pool->mutex)); mutex_exit(&(buf_pool->mutex));
#ifdef UNIV_DEBUG
if (buf_debug_prints) { if (buf_debug_prints) {
fprintf(stderr, "page space %lu page no %lu\n", fprintf(stderr, "page space %lu page no %lu\n",
(ulong) block->space, (ulong) block->offset); (ulong) block->space, (ulong) block->offset);
} }
#endif /* UNIV_DEBUG */
} }
/************************************************************************* /*************************************************************************
...@@ -1950,6 +1956,7 @@ buf_pool_invalidate(void) ...@@ -1950,6 +1956,7 @@ buf_pool_invalidate(void)
mutex_exit(&(buf_pool->mutex)); mutex_exit(&(buf_pool->mutex));
} }
#ifdef UNIV_DEBUG
/************************************************************************* /*************************************************************************
Validates the buffer buf_pool data structure. */ Validates the buffer buf_pool data structure. */
...@@ -2149,6 +2156,7 @@ buf_print(void) ...@@ -2149,6 +2156,7 @@ buf_print(void)
ut_a(buf_validate()); ut_a(buf_validate());
} }
#endif /* UNIV_DEBUG */
/************************************************************************* /*************************************************************************
Returns the number of latched pages in the buffer pool. */ Returns the number of latched pages in the buffer pool. */
......
...@@ -586,11 +586,13 @@ buf_flush_try_page( ...@@ -586,11 +586,13 @@ buf_flush_try_page(
rw_lock_s_lock_gen(&(block->lock), BUF_IO_WRITE); rw_lock_s_lock_gen(&(block->lock), BUF_IO_WRITE);
} }
#ifdef UNIV_DEBUG
if (buf_debug_prints) { if (buf_debug_prints) {
fprintf(stderr, fprintf(stderr,
"Flushing page space %lu, page no %lu \n", "Flushing page space %lu, page no %lu \n",
(ulong) block->space, (ulong) block->offset); (ulong) block->space, (ulong) block->offset);
} }
#endif /* UNIV_DEBUG */
buf_flush_write_block_low(block); buf_flush_write_block_low(block);
...@@ -674,12 +676,14 @@ buf_flush_try_page( ...@@ -674,12 +676,14 @@ buf_flush_try_page(
rw_lock_s_lock_gen(&(block->lock), BUF_IO_WRITE); rw_lock_s_lock_gen(&(block->lock), BUF_IO_WRITE);
#ifdef UNIV_DEBUG
if (buf_debug_prints) { if (buf_debug_prints) {
fprintf(stderr, fprintf(stderr,
"Flushing single page space %lu, page no %lu \n", "Flushing single page space %lu, page no %lu \n",
(ulong) block->space, (ulong) block->space,
(ulong) block->offset); (ulong) block->offset);
} }
#endif /* UNIV_DEBUG */
buf_flush_write_block_low(block); buf_flush_write_block_low(block);
...@@ -906,6 +910,7 @@ buf_flush_batch( ...@@ -906,6 +910,7 @@ buf_flush_batch(
buf_flush_buffered_writes(); buf_flush_buffered_writes();
#ifdef UNIV_DEBUG
if (buf_debug_prints && page_count > 0) { if (buf_debug_prints && page_count > 0) {
ut_a(flush_type == BUF_FLUSH_LRU ut_a(flush_type == BUF_FLUSH_LRU
|| flush_type == BUF_FLUSH_LIST); || flush_type == BUF_FLUSH_LIST);
...@@ -914,6 +919,7 @@ buf_flush_batch( ...@@ -914,6 +919,7 @@ buf_flush_batch(
: "Flushed %lu pages in flush list flush\n", : "Flushed %lu pages in flush list flush\n",
(ulong) page_count); (ulong) page_count);
} }
#endif /* UNIV_DEBUG */
if (page_count != ULINT_UNDEFINED) if (page_count != ULINT_UNDEFINED)
srv_buf_pool_flushed+= page_count; srv_buf_pool_flushed+= page_count;
......
...@@ -213,12 +213,14 @@ buf_LRU_search_and_free_block( ...@@ -213,12 +213,14 @@ buf_LRU_search_and_free_block(
ut_a(block->in_LRU_list); ut_a(block->in_LRU_list);
if (buf_flush_ready_for_replace(block)) { if (buf_flush_ready_for_replace(block)) {
#ifdef UNIV_DEBUG
if (buf_debug_prints) { if (buf_debug_prints) {
fprintf(stderr, fprintf(stderr,
"Putting space %lu page %lu to free list\n", "Putting space %lu page %lu to free list\n",
(ulong) block->space, (ulong) block->space,
(ulong) block->offset); (ulong) block->offset);
} }
#endif /* UNIV_DEBUG */
buf_LRU_block_remove_hashed_page(block); buf_LRU_block_remove_hashed_page(block);
...@@ -919,7 +921,8 @@ buf_LRU_block_free_hashed_page( ...@@ -919,7 +921,8 @@ buf_LRU_block_free_hashed_page(
buf_LRU_block_free_non_file_page(block); buf_LRU_block_free_non_file_page(block);
} }
#ifdef UNIV_DEBUG
/************************************************************************** /**************************************************************************
Validates the LRU list. */ Validates the LRU list. */
...@@ -1050,3 +1053,4 @@ buf_LRU_print(void) ...@@ -1050,3 +1053,4 @@ buf_LRU_print(void)
mutex_exit(&(buf_pool->mutex)); mutex_exit(&(buf_pool->mutex));
} }
#endif /* UNIV_DEBUG */
...@@ -288,12 +288,14 @@ buf_read_ahead_random( ...@@ -288,12 +288,14 @@ buf_read_ahead_random(
os_aio_simulated_wake_handler_threads(); os_aio_simulated_wake_handler_threads();
#ifdef UNIV_DEBUG
if (buf_debug_prints && (count > 0)) { if (buf_debug_prints && (count > 0)) {
fprintf(stderr, fprintf(stderr,
"Random read-ahead space %lu offset %lu pages %lu\n", "Random read-ahead space %lu offset %lu pages %lu\n",
(ulong) space, (ulong) offset, (ulong) space, (ulong) offset,
(ulong) count); (ulong) count);
} }
#endif /* UNIV_DEBUG */
++srv_read_ahead_rnd; ++srv_read_ahead_rnd;
return(count); return(count);
...@@ -575,11 +577,13 @@ buf_read_ahead_linear( ...@@ -575,11 +577,13 @@ buf_read_ahead_linear(
/* Flush pages from the end of the LRU list if necessary */ /* Flush pages from the end of the LRU list if necessary */
buf_flush_free_margin(); buf_flush_free_margin();
#ifdef UNIV_DEBUG
if (buf_debug_prints && (count > 0)) { if (buf_debug_prints && (count > 0)) {
fprintf(stderr, fprintf(stderr,
"LINEAR read-ahead space %lu offset %lu pages %lu\n", "LINEAR read-ahead space %lu offset %lu pages %lu\n",
(ulong) space, (ulong) offset, (ulong) count); (ulong) space, (ulong) offset, (ulong) count);
} }
#endif /* UNIV_DEBUG */
++srv_read_ahead_seq; ++srv_read_ahead_seq;
return(count); return(count);
...@@ -641,11 +645,13 @@ buf_read_ibuf_merge_pages( ...@@ -641,11 +645,13 @@ buf_read_ibuf_merge_pages(
/* Flush pages from the end of the LRU list if necessary */ /* Flush pages from the end of the LRU list if necessary */
buf_flush_free_margin(); buf_flush_free_margin();
#ifdef UNIV_DEBUG
if (buf_debug_prints) { if (buf_debug_prints) {
fprintf(stderr, fprintf(stderr,
"Ibuf merge read-ahead space %lu pages %lu\n", "Ibuf merge read-ahead space %lu pages %lu\n",
(ulong) space_ids[0], (ulong) n_stored); (ulong) space_ids[0], (ulong) n_stored);
} }
#endif /* UNIV_DEBUG */
} }
/************************************************************************ /************************************************************************
...@@ -711,8 +717,10 @@ buf_read_recv_pages( ...@@ -711,8 +717,10 @@ buf_read_recv_pages(
/* Flush pages from the end of the LRU list if necessary */ /* Flush pages from the end of the LRU list if necessary */
buf_flush_free_margin(); buf_flush_free_margin();
#ifdef UNIV_DEBUG
if (buf_debug_prints) { if (buf_debug_prints) {
fprintf(stderr, fprintf(stderr,
"Recovery applies read-ahead pages %lu\n", (ulong) n_stored); "Recovery applies read-ahead pages %lu\n", (ulong) n_stored);
} }
#endif /* UNIV_DEBUG */
} }
...@@ -502,7 +502,7 @@ dtuple_convert_big_rec( ...@@ -502,7 +502,7 @@ dtuple_convert_big_rec(
size = rec_get_converted_size(index, entry); size = rec_get_converted_size(index, entry);
if (size > 1000000000) { if (UNIV_UNLIKELY(size > 1000000000)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Warning: tuple size very big: %lu\n", (ulong) size); "InnoDB: Warning: tuple size very big: %lu\n", (ulong) size);
fputs("InnoDB: Tuple contents: ", stderr); fputs("InnoDB: Tuple contents: ", stderr);
......
...@@ -39,7 +39,6 @@ column definitions, or records in the insert buffer, we use this ...@@ -39,7 +39,6 @@ column definitions, or records in the insert buffer, we use this
charset-collation code for them. */ charset-collation code for them. */
ulint data_mysql_default_charset_coll = 99999999; ulint data_mysql_default_charset_coll = 99999999;
ulint data_mysql_latin1_swedish_charset_coll = 99999999;
dtype_t dtype_binary_val = {DATA_BINARY, 0, 0, 0, 0, 0}; dtype_t dtype_binary_val = {DATA_BINARY, 0, 0, 0, 0, 0};
dtype_t* dtype_binary = &dtype_binary_val; dtype_t* dtype_binary = &dtype_binary_val;
...@@ -64,9 +63,10 @@ dtype_get_at_most_n_mbchars( ...@@ -64,9 +63,10 @@ dtype_get_at_most_n_mbchars(
{ {
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
ut_a(data_len != UNIV_SQL_NULL); ut_a(data_len != UNIV_SQL_NULL);
ut_a(!(prefix_len % dtype->mbmaxlen)); ut_ad(!dtype->mbmaxlen || !(prefix_len % dtype->mbmaxlen));
if (dtype->mbminlen != dtype->mbmaxlen) { if (dtype->mbminlen != dtype->mbmaxlen) {
ut_a(!(prefix_len % dtype->mbmaxlen));
return(innobase_get_at_most_n_mbchars( return(innobase_get_at_most_n_mbchars(
dtype_get_charset_coll(dtype->prtype), dtype_get_charset_coll(dtype->prtype),
prefix_len, data_len, str)); prefix_len, data_len, str));
......
...@@ -66,15 +66,6 @@ dict_hdr_get_new_id( ...@@ -66,15 +66,6 @@ dict_hdr_get_new_id(
dict_hdr = dict_hdr_get(&mtr); dict_hdr = dict_hdr_get(&mtr);
id = mtr_read_dulint(dict_hdr + type, &mtr); id = mtr_read_dulint(dict_hdr + type, &mtr);
/* Add some dummy code here because otherwise pgcc seems to
compile wrong */
if (0 == ut_dulint_cmp(id, ut_dulint_max)) {
/* TO DO: remove this code, or make it conditional */
ut_dbg_null_ptr = 0;
}
id = ut_dulint_add(id, 1); id = ut_dulint_add(id, 1);
mlog_write_dulint(dict_hdr + type, id, &mtr); mlog_write_dulint(dict_hdr + type, id, &mtr);
......
...@@ -736,7 +736,7 @@ dict_truncate_index_tree( ...@@ -736,7 +736,7 @@ dict_truncate_index_tree(
dulint index_id; dulint index_id;
byte* ptr; byte* ptr;
ulint len; ulint len;
ibool comp; ulint comp;
dict_index_t* index; dict_index_t* index;
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
......
...@@ -1453,7 +1453,7 @@ dict_index_add_to_cache( ...@@ -1453,7 +1453,7 @@ dict_index_add_to_cache(
/* Increment the ord_part counts in columns which are ordering */ /* Increment the ord_part counts in columns which are ordering */
if (index->type & DICT_UNIVERSAL) { if (UNIV_UNLIKELY(index->type & DICT_UNIVERSAL)) {
n_ord = new_index->n_fields; n_ord = new_index->n_fields;
} else { } else {
n_ord = dict_index_get_n_unique(new_index); n_ord = dict_index_get_n_unique(new_index);
...@@ -1482,7 +1482,7 @@ dict_index_add_to_cache( ...@@ -1482,7 +1482,7 @@ dict_index_add_to_cache(
new_index->tree = tree; new_index->tree = tree;
} }
if (!(new_index->type & DICT_UNIVERSAL)) { if (!UNIV_UNLIKELY(new_index->type & DICT_UNIVERSAL)) {
new_index->stat_n_diff_key_vals = new_index->stat_n_diff_key_vals =
mem_heap_alloc(new_index->heap, mem_heap_alloc(new_index->heap,
...@@ -1683,7 +1683,7 @@ dict_index_copy_types( ...@@ -1683,7 +1683,7 @@ dict_index_copy_types(
dtype_t* type; dtype_t* type;
ulint i; ulint i;
if (index->type & DICT_UNIVERSAL) { if (UNIV_UNLIKELY(index->type & DICT_UNIVERSAL)) {
dtuple_set_types_binary(tuple, n_fields); dtuple_set_types_binary(tuple, n_fields);
return; return;
...@@ -1779,7 +1779,7 @@ dict_index_build_internal_clust( ...@@ -1779,7 +1779,7 @@ dict_index_build_internal_clust(
dict_index_copy(new_index, index, 0, index->n_fields); dict_index_copy(new_index, index, 0, index->n_fields);
} }
if (index->type & DICT_UNIVERSAL) { if (UNIV_UNLIKELY(index->type & DICT_UNIVERSAL)) {
/* No fixed number of fields determines an entry uniquely */ /* No fixed number of fields determines an entry uniquely */
new_index->n_uniq = ULINT_MAX; new_index->n_uniq = ULINT_MAX;
...@@ -3682,7 +3682,7 @@ dict_tree_find_index_low( ...@@ -3682,7 +3682,7 @@ dict_tree_find_index_low(
table = index->table; table = index->table;
if ((index->type & DICT_CLUSTERED) if ((index->type & DICT_CLUSTERED)
&& (table->type != DICT_TABLE_ORDINARY)) { && UNIV_UNLIKELY(table->type != DICT_TABLE_ORDINARY)) {
/* Get the mix id of the record */ /* Get the mix id of the record */
ut_a(!table->comp); ut_a(!table->comp);
...@@ -3838,7 +3838,7 @@ dict_tree_build_node_ptr( ...@@ -3838,7 +3838,7 @@ dict_tree_build_node_ptr(
ind = dict_tree_find_index_low(tree, rec); ind = dict_tree_find_index_low(tree, rec);
if (tree->type & DICT_UNIVERSAL) { if (UNIV_UNLIKELY(tree->type & DICT_UNIVERSAL)) {
/* In a universal index tree, we take the whole record as /* In a universal index tree, we take the whole record as
the node pointer if the reord is on the leaf level, the node pointer if the reord is on the leaf level,
on non-leaf levels we remove the last field, which on non-leaf levels we remove the last field, which
...@@ -3903,9 +3903,10 @@ dict_tree_copy_rec_order_prefix( ...@@ -3903,9 +3903,10 @@ dict_tree_copy_rec_order_prefix(
dict_index_t* index; dict_index_t* index;
ulint n; ulint n;
UNIV_PREFETCH_R(rec);
index = dict_tree_find_index_low(tree, rec); index = dict_tree_find_index_low(tree, rec);
if (tree->type & DICT_UNIVERSAL) { if (UNIV_UNLIKELY(tree->type & DICT_UNIVERSAL)) {
ut_a(!index->table->comp); ut_a(!index->table->comp);
n = rec_get_n_fields_old(rec); n = rec_get_n_fields_old(rec);
} else { } else {
...@@ -3957,7 +3958,7 @@ dict_index_calc_min_rec_len( ...@@ -3957,7 +3958,7 @@ dict_index_calc_min_rec_len(
ulint sum = 0; ulint sum = 0;
ulint i; ulint i;
if (index->table->comp) { if (UNIV_LIKELY(index->table->comp)) {
ulint nullable = 0; ulint nullable = 0;
sum = REC_N_NEW_EXTRA_BYTES; sum = REC_N_NEW_EXTRA_BYTES;
for (i = 0; i < dict_index_get_n_fields(index); i++) { for (i = 0; i < dict_index_get_n_fields(index); i++) {
...@@ -4277,9 +4278,11 @@ dict_index_print_low( ...@@ -4277,9 +4278,11 @@ dict_index_print_low(
putc('\n', stderr); putc('\n', stderr);
/* btr_print_size(tree); */ #ifdef UNIV_BTR_PRINT
btr_print_size(tree);
/* btr_print_tree(tree, 7); */ btr_print_tree(tree, 7);
#endif /* UNIV_BTR_PRINT */
} }
/************************************************************************** /**************************************************************************
......
...@@ -42,6 +42,7 @@ dict_mem_table_create( ...@@ -42,6 +42,7 @@ dict_mem_table_create(
mem_heap_t* heap; mem_heap_t* heap;
ut_ad(name); ut_ad(name);
ut_ad(comp == FALSE || comp == TRUE);
heap = mem_heap_create(DICT_HEAP_SIZE); heap = mem_heap_create(DICT_HEAP_SIZE);
......
...@@ -99,7 +99,6 @@ ulint fil_n_pending_tablespace_flushes = 0; ...@@ -99,7 +99,6 @@ ulint fil_n_pending_tablespace_flushes = 0;
fil_addr_t fil_addr_null = {FIL_NULL, 0}; fil_addr_t fil_addr_null = {FIL_NULL, 0};
/* File node of a tablespace or the log data space */ /* File node of a tablespace or the log data space */
typedef struct fil_node_struct fil_node_t;
struct fil_node_struct { struct fil_node_struct {
fil_space_t* space; /* backpointer to the space where this node fil_space_t* space; /* backpointer to the space where this node
belongs */ belongs */
...@@ -4046,7 +4045,7 @@ fil_aio_wait( ...@@ -4046,7 +4045,7 @@ fil_aio_wait(
} else { } else {
srv_set_io_thread_op_info(segment, "simulated aio handle"); srv_set_io_thread_op_info(segment, "simulated aio handle");
ret = os_aio_simulated_handle(segment, (void**) &fil_node, ret = os_aio_simulated_handle(segment, &fil_node,
&message, &type); &message, &type);
} }
......
...@@ -2325,7 +2325,6 @@ fseg_alloc_free_page_low( ...@@ -2325,7 +2325,6 @@ fseg_alloc_free_page_low(
dulint seg_id; dulint seg_id;
ulint used; ulint used;
ulint reserved; ulint reserved;
fil_addr_t first;
xdes_t* descr; /* extent of the hinted page */ xdes_t* descr; /* extent of the hinted page */
ulint ret_page; /* the allocated page offset, FIL_NULL ulint ret_page; /* the allocated page offset, FIL_NULL
if could not be allocated */ if could not be allocated */
...@@ -2428,6 +2427,8 @@ fseg_alloc_free_page_low( ...@@ -2428,6 +2427,8 @@ fseg_alloc_free_page_low(
} else if (reserved - used > 0) { } else if (reserved - used > 0) {
/* 5. We take any unused page from the segment /* 5. We take any unused page from the segment
==============================================*/ ==============================================*/
fil_addr_t first;
if (flst_get_len(seg_inode + FSEG_NOT_FULL, mtr) > 0) { if (flst_get_len(seg_inode + FSEG_NOT_FULL, mtr) > 0) {
first = flst_get_first(seg_inode + FSEG_NOT_FULL, first = flst_get_first(seg_inode + FSEG_NOT_FULL,
mtr); mtr);
...@@ -2435,6 +2436,7 @@ fseg_alloc_free_page_low( ...@@ -2435,6 +2436,7 @@ fseg_alloc_free_page_low(
first = flst_get_first(seg_inode + FSEG_FREE, mtr); first = flst_get_first(seg_inode + FSEG_FREE, mtr);
} else { } else {
ut_error; ut_error;
return(FIL_NULL);
} }
ret_descr = xdes_lst_get_descriptor(space, first, mtr); ret_descr = xdes_lst_get_descriptor(space, first, mtr);
......
...@@ -1889,7 +1889,7 @@ ibuf_get_merge_page_nos( ...@@ -1889,7 +1889,7 @@ ibuf_get_merge_page_nos(
contract the tree, FALSE if this is called contract the tree, FALSE if this is called
when a single page becomes full and we look when a single page becomes full and we look
if it pays to read also nearby pages */ if it pays to read also nearby pages */
rec_t* first_rec,/* in: record from which we read up and down rec_t* rec, /* in: record from which we read up and down
in the chain of records */ in the chain of records */
ulint* space_ids,/* in/out: space id's of the pages */ ulint* space_ids,/* in/out: space id's of the pages */
ib_longlong* space_versions,/* in/out: tablespace version ib_longlong* space_versions,/* in/out: tablespace version
...@@ -1907,47 +1907,42 @@ ibuf_get_merge_page_nos( ...@@ -1907,47 +1907,42 @@ ibuf_get_merge_page_nos(
ulint first_space_id; ulint first_space_id;
ulint rec_page_no; ulint rec_page_no;
ulint rec_space_id; ulint rec_space_id;
rec_t* rec;
ulint sum_volumes; ulint sum_volumes;
ulint volume_for_page; ulint volume_for_page;
ulint rec_volume; ulint rec_volume;
ulint limit; ulint limit;
page_t* page;
ulint n_pages; ulint n_pages;
*n_stored = 0; *n_stored = 0;
limit = ut_min(IBUF_MAX_N_PAGES_MERGED, buf_pool->curr_size / 4); limit = ut_min(IBUF_MAX_N_PAGES_MERGED, buf_pool->curr_size / 4);
page = buf_frame_align(first_rec); if (page_rec_is_supremum(rec)) {
if (first_rec == page_get_supremum_rec(page)) {
first_rec = page_rec_get_prev(first_rec); rec = page_rec_get_prev(rec);
} }
if (first_rec == page_get_infimum_rec(page)) { if (page_rec_is_infimum(rec)) {
first_rec = page_rec_get_next(first_rec); rec = page_rec_get_next(rec);
} }
if (first_rec == page_get_supremum_rec(page)) { if (page_rec_is_supremum(rec)) {
return(0); return(0);
} }
rec = first_rec; first_page_no = ibuf_rec_get_page_no(rec);
first_page_no = ibuf_rec_get_page_no(first_rec); first_space_id = ibuf_rec_get_space(rec);
first_space_id = ibuf_rec_get_space(first_rec);
n_pages = 0; n_pages = 0;
prev_page_no = 0; prev_page_no = 0;
prev_space_id = 0; prev_space_id = 0;
/* Go backwards from the first_rec until we reach the border of the /* Go backwards from the first rec until we reach the border of the
'merge area', or the page start or the limit of storeable pages is 'merge area', or the page start or the limit of storeable pages is
reached */ reached */
while ((rec != page_get_infimum_rec(page)) && (n_pages < limit)) { while (!page_rec_is_infimum(rec) && UNIV_LIKELY(n_pages < limit)) {
rec_page_no = ibuf_rec_get_page_no(rec); rec_page_no = ibuf_rec_get_page_no(rec);
rec_space_id = ibuf_rec_get_space(rec); rec_space_id = ibuf_rec_get_space(rec);
...@@ -1982,7 +1977,7 @@ ibuf_get_merge_page_nos( ...@@ -1982,7 +1977,7 @@ ibuf_get_merge_page_nos(
volume_for_page = 0; volume_for_page = 0;
while (*n_stored < limit) { while (*n_stored < limit) {
if (rec == page_get_supremum_rec(page)) { if (page_rec_is_supremum(rec)) {
/* When no more records available, mark this with /* When no more records available, mark this with
another 'impossible' pair of space id, page no */ another 'impossible' pair of space id, page no */
rec_page_no = 1; rec_page_no = 1;
...@@ -2311,12 +2306,12 @@ ibuf_get_volume_buffered( ...@@ -2311,12 +2306,12 @@ ibuf_get_volume_buffered(
page = buf_frame_align(rec); page = buf_frame_align(rec);
if (rec == page_get_supremum_rec(page)) { if (page_rec_is_supremum(rec)) {
rec = page_rec_get_prev(rec); rec = page_rec_get_prev(rec);
} }
for (;;) { for (;;) {
if (rec == page_get_infimum_rec(page)) { if (page_rec_is_infimum(rec)) {
break; break;
} }
...@@ -2351,7 +2346,7 @@ ibuf_get_volume_buffered( ...@@ -2351,7 +2346,7 @@ ibuf_get_volume_buffered(
rec = page_rec_get_prev(rec); rec = page_rec_get_prev(rec);
for (;;) { for (;;) {
if (rec == page_get_infimum_rec(prev_page)) { if (page_rec_is_infimum(rec)) {
/* We cannot go to yet a previous page, because we /* We cannot go to yet a previous page, because we
do not have the x-latch on it, and cannot acquire one do not have the x-latch on it, and cannot acquire one
...@@ -2374,12 +2369,12 @@ ibuf_get_volume_buffered( ...@@ -2374,12 +2369,12 @@ ibuf_get_volume_buffered(
count_later: count_later:
rec = btr_pcur_get_rec(pcur); rec = btr_pcur_get_rec(pcur);
if (rec != page_get_supremum_rec(page)) { if (!page_rec_is_supremum(rec)) {
rec = page_rec_get_next(rec); rec = page_rec_get_next(rec);
} }
for (;;) { for (;;) {
if (rec == page_get_supremum_rec(page)) { if (page_rec_is_supremum(rec)) {
break; break;
} }
...@@ -2414,7 +2409,7 @@ count_later: ...@@ -2414,7 +2409,7 @@ count_later:
rec = page_rec_get_next(rec); rec = page_rec_get_next(rec);
for (;;) { for (;;) {
if (rec == page_get_supremum_rec(next_page)) { if (page_rec_is_supremum(rec)) {
/* We give up */ /* We give up */
...@@ -2815,7 +2810,7 @@ ibuf_insert_to_index_page( ...@@ -2815,7 +2810,7 @@ ibuf_insert_to_index_page(
ut_ad(ibuf_inside()); ut_ad(ibuf_inside());
ut_ad(dtuple_check_typed(entry)); ut_ad(dtuple_check_typed(entry));
if (index->table->comp != page_is_comp(page)) { if (UNIV_UNLIKELY(index->table->comp != !!page_is_comp(page))) {
fputs( fputs(
"InnoDB: Trying to insert a record from the insert buffer to an index page\n" "InnoDB: Trying to insert a record from the insert buffer to an index page\n"
"InnoDB: but the 'compact' flag does not match!\n", stderr); "InnoDB: but the 'compact' flag does not match!\n", stderr);
...@@ -2824,7 +2819,8 @@ ibuf_insert_to_index_page( ...@@ -2824,7 +2819,8 @@ ibuf_insert_to_index_page(
rec = page_rec_get_next(page_get_infimum_rec(page)); rec = page_rec_get_next(page_get_infimum_rec(page));
if (rec_get_n_fields(rec, index) != dtuple_get_n_fields(entry)) { if (UNIV_UNLIKELY(rec_get_n_fields(rec, index)
!= dtuple_get_n_fields(entry))) {
fputs( fputs(
"InnoDB: Trying to insert a record from the insert buffer to an index page\n" "InnoDB: Trying to insert a record from the insert buffer to an index page\n"
"InnoDB: but the number of fields does not match!\n", stderr); "InnoDB: but the number of fields does not match!\n", stderr);
...@@ -2848,7 +2844,7 @@ ibuf_insert_to_index_page( ...@@ -2848,7 +2844,7 @@ ibuf_insert_to_index_page(
if (low_match == dtuple_get_n_fields(entry)) { if (low_match == dtuple_get_n_fields(entry)) {
rec = page_cur_get_rec(&page_cur); rec = page_cur_get_rec(&page_cur);
btr_cur_del_unmark_for_ibuf(rec, index, mtr); btr_cur_del_unmark_for_ibuf(rec, mtr);
} else { } else {
rec = page_cur_tuple_insert(&page_cur, entry, index, mtr); rec = page_cur_tuple_insert(&page_cur, entry, index, mtr);
...@@ -2861,8 +2857,8 @@ ibuf_insert_to_index_page( ...@@ -2861,8 +2857,8 @@ ibuf_insert_to_index_page(
PAGE_CUR_LE, &page_cur); PAGE_CUR_LE, &page_cur);
/* This time the record must fit */ /* This time the record must fit */
if (!page_cur_tuple_insert(&page_cur, entry, if (UNIV_UNLIKELY(!page_cur_tuple_insert(
index, mtr)) { &page_cur, entry, index, mtr))) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
...@@ -2969,7 +2965,9 @@ ibuf_delete_rec( ...@@ -2969,7 +2965,9 @@ ibuf_delete_rec(
btr_pcur_commit_specify_mtr(pcur, mtr); btr_pcur_commit_specify_mtr(pcur, mtr);
fputs("InnoDB: Validating insert buffer tree:\n", stderr); fputs("InnoDB: Validating insert buffer tree:\n", stderr);
ut_a(btr_validate_tree(ibuf_data->index->tree)); if (!btr_validate_tree(ibuf_data->index->tree, NULL)) {
ut_error;
}
fprintf(stderr, "InnoDB: ibuf tree ok\n"); fprintf(stderr, "InnoDB: ibuf tree ok\n");
fflush(stderr); fflush(stderr);
......
...@@ -168,7 +168,7 @@ btr_create( ...@@ -168,7 +168,7 @@ btr_create(
ulint type, /* in: type of the index */ ulint type, /* in: type of the index */
ulint space, /* in: space where created */ ulint space, /* in: space where created */
dulint index_id,/* in: index id */ dulint index_id,/* in: index id */
ibool comp, /* in: TRUE=compact page format */ ulint comp, /* in: nonzero=compact page format */
mtr_t* mtr); /* in: mini-transaction handle */ mtr_t* mtr); /* in: mini-transaction handle */
/**************************************************************** /****************************************************************
Frees a B-tree except the root page, which MUST be freed after this Frees a B-tree except the root page, which MUST be freed after this
...@@ -276,7 +276,7 @@ void ...@@ -276,7 +276,7 @@ void
btr_set_min_rec_mark( btr_set_min_rec_mark(
/*=================*/ /*=================*/
rec_t* rec, /* in: record */ rec_t* rec, /* in: record */
ibool comp, /* in: TRUE=compact page format */ ulint comp, /* in: nonzero=compact page format */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
/***************************************************************** /*****************************************************************
Deletes on the upper level the node pointer to a page. */ Deletes on the upper level the node pointer to a page. */
...@@ -336,7 +336,7 @@ btr_parse_set_min_rec_mark( ...@@ -336,7 +336,7 @@ btr_parse_set_min_rec_mark(
/* out: end of log record or NULL */ /* out: end of log record or NULL */
byte* ptr, /* in: buffer */ byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */ byte* end_ptr,/* in: buffer end */
ibool comp, /* in: TRUE=compact page format */ ulint comp, /* in: nonzero=compact page format */
page_t* page, /* in: page or NULL */ page_t* page, /* in: page or NULL */
mtr_t* mtr); /* in: mtr or NULL */ mtr_t* mtr); /* in: mtr or NULL */
/*************************************************************** /***************************************************************
...@@ -398,6 +398,7 @@ btr_page_free_low( ...@@ -398,6 +398,7 @@ btr_page_free_low(
page_t* page, /* in: page to be freed, x-latched */ page_t* page, /* in: page to be freed, x-latched */
ulint level, /* in: page level */ ulint level, /* in: page level */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
#ifdef UNIV_BTR_PRINT
/***************************************************************** /*****************************************************************
Prints size info of a B-tree. */ Prints size info of a B-tree. */
...@@ -414,6 +415,7 @@ btr_print_tree( ...@@ -414,6 +415,7 @@ btr_print_tree(
dict_tree_t* tree, /* in: tree */ dict_tree_t* tree, /* in: tree */
ulint width); /* in: print this many entries from start ulint width); /* in: print this many entries from start
and end */ and end */
#endif /* UNIV_BTR_PRINT */
/**************************************************************** /****************************************************************
Checks the size and number of fields in a record based on the definition of Checks the size and number of fields in a record based on the definition of
the index. */ the index. */
...@@ -434,7 +436,8 @@ ibool ...@@ -434,7 +436,8 @@ ibool
btr_validate_tree( btr_validate_tree(
/*==============*/ /*==============*/
/* out: TRUE if ok */ /* out: TRUE if ok */
dict_tree_t* tree); /* in: tree */ dict_tree_t* tree, /* in: tree */
trx_t* trx); /* in: transaction or NULL */
#define BTR_N_LEAF_PAGES 1 #define BTR_N_LEAF_PAGES 1
#define BTR_TOTAL_SIZE 2 #define BTR_TOTAL_SIZE 2
......
...@@ -200,10 +200,10 @@ btr_node_ptr_get_child_page_no( ...@@ -200,10 +200,10 @@ btr_node_ptr_get_child_page_no(
page_no = mach_read_from_4(field); page_no = mach_read_from_4(field);
if (page_no == 0) { if (UNIV_UNLIKELY(page_no == 0)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: a nonsensical page number 0 in a node ptr record at offset %lu\n", "InnoDB: a nonsensical page number 0 in a node ptr record at offset %lu\n",
(unsigned long)(rec - buf_frame_align(rec))); (ulong) ut_align_offset(rec, UNIV_PAGE_SIZE));
buf_page_print(buf_frame_align(rec)); buf_page_print(buf_frame_align(rec));
} }
......
...@@ -284,7 +284,6 @@ void ...@@ -284,7 +284,6 @@ void
btr_cur_del_unmark_for_ibuf( btr_cur_del_unmark_for_ibuf(
/*========================*/ /*========================*/
rec_t* rec, /* in: record to delete unmark */ rec_t* rec, /* in: record to delete unmark */
dict_index_t* index, /* in: record descriptor */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
/***************************************************************** /*****************************************************************
Tries to compress a page of the tree on the leaf level. It is assumed Tries to compress a page of the tree on the leaf level. It is assumed
...@@ -389,7 +388,6 @@ btr_cur_parse_del_mark_set_sec_rec( ...@@ -389,7 +388,6 @@ btr_cur_parse_del_mark_set_sec_rec(
/* out: end of log record or NULL */ /* out: end of log record or NULL */
byte* ptr, /* in: buffer */ byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */ byte* end_ptr,/* in: buffer end */
dict_index_t* index, /* in: index corresponding to page */
page_t* page); /* in: page or NULL */ page_t* page); /* in: page or NULL */
/*********************************************************************** /***********************************************************************
Estimates the number of rows in a given index range. */ Estimates the number of rows in a given index range. */
......
...@@ -52,7 +52,9 @@ btr_cur_get_page( ...@@ -52,7 +52,9 @@ btr_cur_get_page(
/* out: pointer to page */ /* out: pointer to page */
btr_cur_t* cursor) /* in: tree cursor */ btr_cur_t* cursor) /* in: tree cursor */
{ {
return(buf_frame_align(page_cur_get_rec(&(cursor->page_cur)))); page_t* page = buf_frame_align(page_cur_get_rec(&(cursor->page_cur)));
ut_ad(!!page_is_comp(page) == cursor->index->table->comp);
return(page);
} }
/************************************************************* /*************************************************************
......
...@@ -56,9 +56,11 @@ Created 11/5/1995 Heikki Tuuri ...@@ -56,9 +56,11 @@ Created 11/5/1995 Heikki Tuuri
#define BUF_NO_CHECKSUM_MAGIC 0xDEADBEEFUL #define BUF_NO_CHECKSUM_MAGIC 0xDEADBEEFUL
extern buf_pool_t* buf_pool; /* The buffer pool of the database */ extern buf_pool_t* buf_pool; /* The buffer pool of the database */
#ifdef UNIV_DEBUG
extern ibool buf_debug_prints;/* If this is set TRUE, the program extern ibool buf_debug_prints;/* If this is set TRUE, the program
prints info whenever read or flush prints info whenever read or flush
occurs */ occurs */
#endif /* UNIV_DEBUG */
extern ulint srv_buf_pool_write_requests; /* variable to count write request extern ulint srv_buf_pool_write_requests; /* variable to count write request
issued */ issued */
...@@ -382,10 +384,10 @@ Returns the value of the modify clock. The caller must have an s-lock ...@@ -382,10 +384,10 @@ Returns the value of the modify clock. The caller must have an s-lock
or x-lock on the block. */ or x-lock on the block. */
UNIV_INLINE UNIV_INLINE
dulint dulint
buf_frame_get_modify_clock( buf_block_get_modify_clock(
/*=======================*/ /*=======================*/
/* out: value */ /* out: value */
buf_frame_t* frame); /* in: pointer to a frame */ buf_block_t* block); /* in: block */
/************************************************************************ /************************************************************************
Calculates a page checksum which is stored to the page when it is written Calculates a page checksum which is stored to the page when it is written
to a file. Note that we must be careful to calculate the same value to a file. Note that we must be careful to calculate the same value
...@@ -480,12 +482,20 @@ buf_pool_is_block( ...@@ -480,12 +482,20 @@ buf_pool_is_block(
/*==============*/ /*==============*/
/* out: TRUE if pointer to block */ /* out: TRUE if pointer to block */
void* ptr); /* in: pointer to memory */ void* ptr); /* in: pointer to memory */
#ifdef UNIV_DEBUG
/************************************************************************* /*************************************************************************
Validates the buffer pool data structure. */ Validates the buffer pool data structure. */
ibool ibool
buf_validate(void); buf_validate(void);
/*==============*/ /*==============*/
/*************************************************************************
Prints info of the buffer pool data structure. */
void
buf_print(void);
/*============*/
#endif /* UNIV_DEBUG */
/************************************************************************ /************************************************************************
Prints a page to stderr. */ Prints a page to stderr. */
...@@ -494,12 +504,6 @@ buf_page_print( ...@@ -494,12 +504,6 @@ buf_page_print(
/*===========*/ /*===========*/
byte* read_buf); /* in: a database page */ byte* read_buf); /* in: a database page */
/************************************************************************* /*************************************************************************
Prints info of the buffer pool data structure. */
void
buf_print(void);
/*============*/
/*************************************************************************
Returns the number of latched pages in the buffer pool. */ Returns the number of latched pages in the buffer pool. */
ulint ulint
......
...@@ -11,10 +11,11 @@ Created 11/5/1995 Heikki Tuuri ...@@ -11,10 +11,11 @@ Created 11/5/1995 Heikki Tuuri
#include "buf0rea.h" #include "buf0rea.h"
#include "mtr0mtr.h" #include "mtr0mtr.h"
#ifdef UNIV_DEBUG
extern ulint buf_dbg_counter; /* This is used to insert validation extern ulint buf_dbg_counter; /* This is used to insert validation
operations in execution in the operations in execution in the
debug version */ debug version */
#endif /* UNIV_DEBUG */
/************************************************************************ /************************************************************************
Recommends a move of a block to the start of the LRU list if there is danger Recommends a move of a block to the start of the LRU list if there is danger
of dropping from the buffer pool. NOTE: does not reserve the buffer pool of dropping from the buffer pool. NOTE: does not reserve the buffer pool
...@@ -26,12 +27,8 @@ buf_block_peek_if_too_old( ...@@ -26,12 +27,8 @@ buf_block_peek_if_too_old(
/* out: TRUE if should be made younger */ /* out: TRUE if should be made younger */
buf_block_t* block) /* in: block to make younger */ buf_block_t* block) /* in: block to make younger */
{ {
if (buf_pool->freed_page_clock >= block->freed_page_clock return(buf_pool->freed_page_clock >= block->freed_page_clock
+ 1 + (buf_pool->curr_size / 1024)) { + 1 + (buf_pool->curr_size / 1024));
return(TRUE);
}
return(FALSE);
} }
/************************************************************************* /*************************************************************************
...@@ -210,8 +207,8 @@ buf_block_align( ...@@ -210,8 +207,8 @@ buf_block_align(
frame_zero = buf_pool->frame_zero; frame_zero = buf_pool->frame_zero;
if ((ulint)ptr < (ulint)frame_zero if (UNIV_UNLIKELY((ulint)ptr < (ulint)frame_zero)
|| (ulint)ptr > (ulint)(buf_pool->high_end)) { || UNIV_UNLIKELY((ulint)ptr > (ulint)(buf_pool->high_end))) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
...@@ -246,8 +243,8 @@ buf_frame_align( ...@@ -246,8 +243,8 @@ buf_frame_align(
frame = ut_align_down(ptr, UNIV_PAGE_SIZE); frame = ut_align_down(ptr, UNIV_PAGE_SIZE);
if (((ulint)frame < (ulint)(buf_pool->frame_zero)) if (UNIV_UNLIKELY((ulint)frame < (ulint)(buf_pool->frame_zero))
|| (ulint)frame >= (ulint)(buf_pool->high_end)) { || UNIV_UNLIKELY((ulint)frame >= (ulint)(buf_pool->high_end))) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
...@@ -485,17 +482,11 @@ Returns the value of the modify clock. The caller must have an s-lock ...@@ -485,17 +482,11 @@ Returns the value of the modify clock. The caller must have an s-lock
or x-lock on the block. */ or x-lock on the block. */
UNIV_INLINE UNIV_INLINE
dulint dulint
buf_frame_get_modify_clock( buf_block_get_modify_clock(
/*=======================*/ /*=======================*/
/* out: value */ /* out: value */
buf_frame_t* frame) /* in: pointer to a frame */ buf_block_t* block) /* in: block */
{ {
buf_block_t* block;
ut_ad(frame);
block = buf_block_align(frame);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED) ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE)); || rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
......
...@@ -122,6 +122,7 @@ void ...@@ -122,6 +122,7 @@ void
buf_LRU_make_block_old( buf_LRU_make_block_old(
/*===================*/ /*===================*/
buf_block_t* block); /* in: control block */ buf_block_t* block); /* in: control block */
#ifdef UNIV_DEBUG
/************************************************************************** /**************************************************************************
Validates the LRU list. */ Validates the LRU list. */
...@@ -134,6 +135,7 @@ Prints the LRU list. */ ...@@ -134,6 +135,7 @@ Prints the LRU list. */
void void
buf_LRU_print(void); buf_LRU_print(void);
/*===============*/ /*===============*/
#endif /* UNIV_DEBUG */
#ifndef UNIV_NONINL #ifndef UNIV_NONINL
#include "buf0lru.ic" #include "buf0lru.ic"
......
...@@ -12,7 +12,7 @@ Created 1/16/1996 Heikki Tuuri ...@@ -12,7 +12,7 @@ Created 1/16/1996 Heikki Tuuri
#include "univ.i" #include "univ.i"
extern ulint data_mysql_default_charset_coll; extern ulint data_mysql_default_charset_coll;
extern ulint data_mysql_latin1_swedish_charset_coll; #define DATA_MYSQL_LATIN1_SWEDISH_CHARSET_COLL 8
/* SQL data type struct */ /* SQL data type struct */
typedef struct dtype_struct dtype_t; typedef struct dtype_struct dtype_t;
......
...@@ -388,8 +388,8 @@ dtype_get_fixed_size( ...@@ -388,8 +388,8 @@ dtype_get_fixed_size(
dtype_get_charset_coll(type->prtype), dtype_get_charset_coll(type->prtype),
&mbminlen, &mbmaxlen); &mbminlen, &mbmaxlen);
if (type->mbminlen != mbminlen if (UNIV_UNLIKELY(type->mbminlen != mbminlen)
|| type->mbmaxlen != mbmaxlen) { || UNIV_UNLIKELY(type->mbmaxlen != mbmaxlen)) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: " fprintf(stderr, " InnoDB: "
......
...@@ -132,7 +132,7 @@ void ...@@ -132,7 +132,7 @@ void
dyn_push_string( dyn_push_string(
/*============*/ /*============*/
dyn_array_t* arr, /* in: dyn array */ dyn_array_t* arr, /* in: dyn array */
byte* str, /* in: string to write */ const byte* str, /* in: string to write */
ulint len); /* in: string length */ ulint len); /* in: string length */
/*#################################################################*/ /*#################################################################*/
......
...@@ -324,10 +324,9 @@ void ...@@ -324,10 +324,9 @@ void
dyn_push_string( dyn_push_string(
/*============*/ /*============*/
dyn_array_t* arr, /* in: dyn array */ dyn_array_t* arr, /* in: dyn array */
byte* str, /* in: string to write */ const byte* str, /* in: string to write */
ulint len) /* in: string length */ ulint len) /* in: string length */
{ {
byte* ptr;
ulint n_copied; ulint n_copied;
while (len > 0) { while (len > 0) {
...@@ -337,9 +336,7 @@ dyn_push_string( ...@@ -337,9 +336,7 @@ dyn_push_string(
n_copied = len; n_copied = len;
} }
ptr = (byte*) dyn_array_push(arr, n_copied); memcpy(dyn_array_push(arr, n_copied), str, n_copied);
ut_memcpy(ptr, str, n_copied);
str += n_copied; str += n_copied;
len -= n_copied; len -= n_copied;
......
...@@ -19,7 +19,9 @@ Created 5/7/1996 Heikki Tuuri ...@@ -19,7 +19,9 @@ Created 5/7/1996 Heikki Tuuri
#include "read0types.h" #include "read0types.h"
#include "hash0hash.h" #include "hash0hash.h"
#ifdef UNIV_DEBUG
extern ibool lock_print_waits; extern ibool lock_print_waits;
#endif /* UNIV_DEBUG */
/* Buffer for storing information about the most recent deadlock error */ /* Buffer for storing information about the most recent deadlock error */
extern FILE* lock_latest_err_file; extern FILE* lock_latest_err_file;
...@@ -216,6 +218,7 @@ actual record is being moved. */ ...@@ -216,6 +218,7 @@ actual record is being moved. */
void void
lock_rec_store_on_page_infimum( lock_rec_store_on_page_infimum(
/*===========================*/ /*===========================*/
page_t* page, /* in: page containing the record */
rec_t* rec); /* in: record whose lock state is stored rec_t* rec); /* in: record whose lock state is stored
on the infimum record of the same page; lock on the infimum record of the same page; lock
bits are reset on the record */ bits are reset on the record */
...@@ -412,9 +415,7 @@ lock_table( ...@@ -412,9 +415,7 @@ lock_table(
/* out: DB_SUCCESS, DB_LOCK_WAIT, /* out: DB_SUCCESS, DB_LOCK_WAIT,
DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */ DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
ulint flags, /* in: if BTR_NO_LOCKING_FLAG bit is set, ulint flags, /* in: if BTR_NO_LOCKING_FLAG bit is set,
does nothing; does nothing */
if LOCK_TABLE_EXP bits are set,
creates an explicit table lock */
dict_table_t* table, /* in: database table in dictionary cache */ dict_table_t* table, /* in: database table in dictionary cache */
ulint mode, /* in: lock mode */ ulint mode, /* in: lock mode */
que_thr_t* thr); /* in: query thread */ que_thr_t* thr); /* in: query thread */
...@@ -451,15 +452,6 @@ lock_release_off_kernel( ...@@ -451,15 +452,6 @@ lock_release_off_kernel(
/*====================*/ /*====================*/
trx_t* trx); /* in: transaction */ trx_t* trx); /* in: transaction */
/************************************************************************* /*************************************************************************
Releases table locks explicitly requested with LOCK TABLES (indicated by
lock type LOCK_TABLE_EXP), and releases possible other transactions waiting
because of these locks. */
void
lock_release_tables_off_kernel(
/*===========================*/
trx_t* trx); /* in: transaction */
/*************************************************************************
Cancels a waiting lock request and releases possible other transactions Cancels a waiting lock request and releases possible other transactions
waiting behind it. */ waiting behind it. */
...@@ -618,9 +610,6 @@ extern lock_sys_t* lock_sys; ...@@ -618,9 +610,6 @@ extern lock_sys_t* lock_sys;
/* Lock types */ /* Lock types */
#define LOCK_TABLE 16 /* these type values should be so high that */ #define LOCK_TABLE 16 /* these type values should be so high that */
#define LOCK_REC 32 /* they can be ORed to the lock mode */ #define LOCK_REC 32 /* they can be ORed to the lock mode */
#define LOCK_TABLE_EXP 80 /* explicit table lock (80 = 16 + 64) */
#define LOCK_TABLE_TRANSACTIONAL 144
/* transactional table lock (144 = 16 + 128)*/
#define LOCK_TYPE_MASK 0xF0UL /* mask used to extract lock type from the #define LOCK_TYPE_MASK 0xF0UL /* mask used to extract lock type from the
type_mode field in a lock */ type_mode field in a lock */
/* Waiting lock flag */ /* Waiting lock flag */
......
...@@ -17,8 +17,12 @@ Created 12/9/1995 Heikki Tuuri ...@@ -17,8 +17,12 @@ Created 12/9/1995 Heikki Tuuri
typedef struct log_struct log_t; typedef struct log_struct log_t;
typedef struct log_group_struct log_group_t; typedef struct log_group_struct log_group_t;
#ifdef UNIV_DEBUG
extern ibool log_do_write; extern ibool log_do_write;
extern ibool log_debug_writes; extern ibool log_debug_writes;
#else /* UNIV_DEBUG */
# define log_do_write TRUE
#endif /* UNIV_DEBUG */
/* Wait modes for log_write_up_to */ /* Wait modes for log_write_up_to */
#define LOG_NO_WAIT 91 #define LOG_NO_WAIT 91
......
...@@ -52,6 +52,27 @@ mach_read_from_2( ...@@ -52,6 +52,27 @@ mach_read_from_2(
/*=============*/ /*=============*/
/* out: ulint integer, >= 0, < 64k */ /* out: ulint integer, >= 0, < 64k */
byte* b); /* in: pointer to two bytes */ byte* b); /* in: pointer to two bytes */
/************************************************************
The following function is used to convert a 16-bit data item
to the canonical format, for fast bytewise equality test
against memory. */
UNIV_INLINE
uint16
mach_encode_2(
/*==========*/
/* out: 16-bit integer in canonical format */
ulint n); /* in: integer in machine-dependent format */
/************************************************************
The following function is used to convert a 16-bit data item
from the canonical format, for fast bytewise equality test
against memory. */
UNIV_INLINE
ulint
mach_decode_2(
/*==========*/
/* out: integer in machine-dependent format */
uint16 n); /* in: 16-bit integer in canonical format */
/*********************************************************** /***********************************************************
The following function is used to store data in 3 consecutive The following function is used to store data in 3 consecutive
bytes. We store the most significant byte to the lowest address. */ bytes. We store the most significant byte to the lowest address. */
......
...@@ -68,6 +68,37 @@ mach_read_from_2( ...@@ -68,6 +68,37 @@ mach_read_from_2(
); );
} }
/************************************************************
The following function is used to convert a 16-bit data item
to the canonical format, for fast bytewise equality test
against memory. */
UNIV_INLINE
uint16
mach_encode_2(
/*==========*/
/* out: 16-bit integer in canonical format */
ulint n) /* in: integer in machine-dependent format */
{
uint16 ret;
ut_ad(2 == sizeof ret);
mach_write_to_2((byte*) &ret, n);
return(ret);
}
/************************************************************
The following function is used to convert a 16-bit data item
from the canonical format, for fast bytewise equality test
against memory. */
UNIV_INLINE
ulint
mach_decode_2(
/*==========*/
/* out: integer in machine-dependent format */
uint16 n) /* in: 16-bit integer in canonical format */
{
ut_ad(2 == sizeof n);
return(mach_read_from_2((byte*) &n));
}
/*********************************************************** /***********************************************************
The following function is used to store data in 3 consecutive The following function is used to store data in 3 consecutive
bytes. We store the most significant byte to the lowest address. */ bytes. We store the most significant byte to the lowest address. */
......
...@@ -623,7 +623,7 @@ mem_strdupq( ...@@ -623,7 +623,7 @@ mem_strdupq(
} }
*d++ = q; *d++ = q;
*d++ = '\0'; *d++ = '\0';
ut_ad(len == d - dst); ut_ad((ssize_t) len == d - dst);
return(dst); return(dst);
} }
......
...@@ -41,10 +41,10 @@ corresponding log record to the mini-transaction log. */ ...@@ -41,10 +41,10 @@ corresponding log record to the mini-transaction log. */
void void
mlog_write_string( mlog_write_string(
/*==============*/ /*==============*/
byte* ptr, /* in: pointer where to write */ byte* ptr, /* in: pointer where to write */
byte* str, /* in: string to write */ const byte* str, /* in: string to write */
ulint len, /* in: string length */ ulint len, /* in: string length */
mtr_t* mtr); /* in: mini-transaction handle */ mtr_t* mtr); /* in: mini-transaction handle */
/************************************************************ /************************************************************
Writes initial part of a log record consisting of one-byte item Writes initial part of a log record consisting of one-byte item
type and four-byte space and page numbers. */ type and four-byte space and page numbers. */
...@@ -85,9 +85,9 @@ Catenates n bytes to the mtr log. */ ...@@ -85,9 +85,9 @@ Catenates n bytes to the mtr log. */
void void
mlog_catenate_string( mlog_catenate_string(
/*=================*/ /*=================*/
mtr_t* mtr, /* in: mtr */ mtr_t* mtr, /* in: mtr */
byte* str, /* in: string to write */ const byte* str, /* in: string to write */
ulint len); /* in: string length */ ulint len); /* in: string length */
/************************************************************ /************************************************************
Catenates a compressed ulint to mlog. */ Catenates a compressed ulint to mlog. */
UNIV_INLINE UNIV_INLINE
......
...@@ -112,7 +112,11 @@ flag value must give the length also! */ ...@@ -112,7 +112,11 @@ flag value must give the length also! */
/* mark compact clustered index /* mark compact clustered index
record deleted */ record deleted */
#define MLOG_COMP_REC_SEC_DELETE_MARK ((byte)40)/* mark compact secondary index #define MLOG_COMP_REC_SEC_DELETE_MARK ((byte)40)/* mark compact secondary index
record deleted */ record deleted; this log
record type is redundant, as
MLOG_REC_SEC_DELETE_MARK is
independent of the record
format. */
#define MLOG_COMP_REC_UPDATE_IN_PLACE ((byte)41)/* update of a compact record, #define MLOG_COMP_REC_UPDATE_IN_PLACE ((byte)41)/* update of a compact record,
preserves record field sizes */ preserves record field sizes */
#define MLOG_COMP_REC_DELETE ((byte)42) /* delete a compact record #define MLOG_COMP_REC_DELETE ((byte)42) /* delete a compact record
......
...@@ -17,6 +17,8 @@ Created 10/21/1995 Heikki Tuuri ...@@ -17,6 +17,8 @@ Created 10/21/1995 Heikki Tuuri
#include <time.h> #include <time.h>
#endif #endif
typedef struct fil_node_struct fil_node_t;
extern ibool os_do_not_call_flush_at_each_write; extern ibool os_do_not_call_flush_at_each_write;
extern ibool os_has_said_disk_full; extern ibool os_has_said_disk_full;
extern ibool os_aio_print_debug; extern ibool os_aio_print_debug;
...@@ -563,7 +565,7 @@ os_aio( ...@@ -563,7 +565,7 @@ os_aio(
ulint offset_high, /* in: most significant 32 bits of ulint offset_high, /* in: most significant 32 bits of
offset */ offset */
ulint n, /* in: number of bytes to read or write */ ulint n, /* in: number of bytes to read or write */
void* message1,/* in: messages for the aio handler (these fil_node_t* message1,/* in: messages for the aio handler (these
can be used to identify a completed aio can be used to identify a completed aio
operation); if mode is OS_AIO_SYNC, these operation); if mode is OS_AIO_SYNC, these
are ignored */ are ignored */
...@@ -621,7 +623,7 @@ os_aio_windows_handle( ...@@ -621,7 +623,7 @@ os_aio_windows_handle(
ignored */ ignored */
ulint pos, /* this parameter is used only in sync aio: ulint pos, /* this parameter is used only in sync aio:
wait for the aio slot at this position */ wait for the aio slot at this position */
void** message1, /* out: the messages passed with the aio fil_node_t**message1, /* out: the messages passed with the aio
request; note that also in the case where request; note that also in the case where
the aio operation failed, these output the aio operation failed, these output
parameters are valid and can be used to parameters are valid and can be used to
...@@ -641,7 +643,7 @@ os_aio_posix_handle( ...@@ -641,7 +643,7 @@ os_aio_posix_handle(
/*================*/ /*================*/
/* out: TRUE if the aio operation succeeded */ /* out: TRUE if the aio operation succeeded */
ulint array_no, /* in: array number 0 - 3 */ ulint array_no, /* in: array number 0 - 3 */
void** message1, /* out: the messages passed with the aio fil_node_t**message1, /* out: the messages passed with the aio
request; note that also in the case where request; note that also in the case where
the aio operation failed, these output the aio operation failed, these output
parameters are valid and can be used to parameters are valid and can be used to
...@@ -661,7 +663,7 @@ os_aio_simulated_handle( ...@@ -661,7 +663,7 @@ os_aio_simulated_handle(
i/o thread, segment 1 the log i/o thread, i/o thread, segment 1 the log i/o thread,
then follow the non-ibuf read threads, and as then follow the non-ibuf read threads, and as
the last are the non-ibuf write threads */ the last are the non-ibuf write threads */
void** message1, /* out: the messages passed with the aio fil_node_t**message1, /* out: the messages passed with the aio
request; note that also in the case where request; note that also in the case where
the aio operation failed, these output the aio operation failed, these output
parameters are valid and can be used to parameters are valid and can be used to
...@@ -688,6 +690,8 @@ Refreshes the statistics used to print per-second averages. */ ...@@ -688,6 +690,8 @@ Refreshes the statistics used to print per-second averages. */
void void
os_aio_refresh_stats(void); os_aio_refresh_stats(void);
/*======================*/ /*======================*/
#ifdef UNIV_DEBUG
/************************************************************************** /**************************************************************************
Checks that all slots in the system have been freed, that is, there are Checks that all slots in the system have been freed, that is, there are
no pending io operations. */ no pending io operations. */
...@@ -695,6 +699,7 @@ no pending io operations. */ ...@@ -695,6 +699,7 @@ no pending io operations. */
ibool ibool
os_aio_all_slots_free(void); os_aio_all_slots_free(void);
/*=======================*/ /*=======================*/
#endif /* UNIV_DEBUG */
/*********************************************************************** /***********************************************************************
This function returns information about the specified file */ This function returns information about the specified file */
......
...@@ -78,16 +78,16 @@ UNIV_INLINE ...@@ -78,16 +78,16 @@ UNIV_INLINE
ibool ibool
page_cur_is_before_first( page_cur_is_before_first(
/*=====================*/ /*=====================*/
/* out: TRUE if at start */ /* out: TRUE if at start */
page_cur_t* cur); /* in: cursor */ const page_cur_t* cur); /* in: cursor */
/************************************************************* /*************************************************************
Returns TRUE if the cursor is after last user record. */ Returns TRUE if the cursor is after last user record. */
UNIV_INLINE UNIV_INLINE
ibool ibool
page_cur_is_after_last( page_cur_is_after_last(
/*===================*/ /*===================*/
/* out: TRUE if at end */ /* out: TRUE if at end */
page_cur_t* cur); /* in: cursor */ const page_cur_t* cur); /* in: cursor */
/************************************************************** /**************************************************************
Positions the cursor on the given record. */ Positions the cursor on the given record. */
UNIV_INLINE UNIV_INLINE
......
...@@ -69,15 +69,10 @@ UNIV_INLINE ...@@ -69,15 +69,10 @@ UNIV_INLINE
ibool ibool
page_cur_is_before_first( page_cur_is_before_first(
/*=====================*/ /*=====================*/
/* out: TRUE if at start */ /* out: TRUE if at start */
page_cur_t* cur) /* in: cursor */ const page_cur_t* cur) /* in: cursor */
{ {
if (page_get_infimum_rec(page_cur_get_page(cur)) == cur->rec) { return(page_rec_is_infimum(cur->rec));
return(TRUE);
}
return(FALSE);
} }
/************************************************************* /*************************************************************
...@@ -86,15 +81,10 @@ UNIV_INLINE ...@@ -86,15 +81,10 @@ UNIV_INLINE
ibool ibool
page_cur_is_after_last( page_cur_is_after_last(
/*===================*/ /*===================*/
/* out: TRUE if at end */ /* out: TRUE if at end */
page_cur_t* cur) /* in: cursor */ const page_cur_t* cur) /* in: cursor */
{ {
if (page_get_supremum_rec(page_cur_get_page(cur)) == cur->rec) { return(page_rec_is_supremum(cur->rec));
return(TRUE);
}
return(FALSE);
} }
/************************************************************** /**************************************************************
......
...@@ -373,13 +373,21 @@ page_dir_find_owner_slot( ...@@ -373,13 +373,21 @@ page_dir_find_owner_slot(
/**************************************************************** /****************************************************************
Determine whether the page is in new-style compact format. */ Determine whether the page is in new-style compact format. */
UNIV_INLINE UNIV_INLINE
ibool ulint
page_is_comp( page_is_comp(
/*=========*/ /*=========*/
/* out: TRUE if the page is in compact format /* out: nonzero if the page is in compact
FALSE if it is in old-style format */ format, zero if it is in old-style format */
page_t* page); /* in: index page */ page_t* page); /* in: index page */
/**************************************************************** /****************************************************************
TRUE if the record is on a page in compact format. */
UNIV_INLINE
ulint
page_rec_is_comp(
/*=============*/
/* out: nonzero if in compact format */
const rec_t* rec); /* in: record */
/****************************************************************
Gets the pointer to the next record on the page. */ Gets the pointer to the next record on the page. */
UNIV_INLINE UNIV_INLINE
rec_t* rec_t*
...@@ -407,47 +415,55 @@ page_rec_get_prev( ...@@ -407,47 +415,55 @@ page_rec_get_prev(
/* out: pointer to previous record */ /* out: pointer to previous record */
rec_t* rec); /* in: pointer to record, rec_t* rec); /* in: pointer to record,
must not be page infimum */ must not be page infimum */
/**************************************************************** /****************************************************************
TRUE if the record is a user record on the page. */ TRUE if the record is a user record on the page. */
UNIV_INLINE UNIV_INLINE
ibool ibool
page_rec_is_user_rec( page_rec_is_user_rec_low(
/*=================*/ /*=====================*/
/* out: TRUE if a user record */ /* out: TRUE if a user record */
rec_t* rec); /* in: record */ ulint offset);/* in: record offset on page */
/**************************************************************** /****************************************************************
TRUE if the record is the supremum record on a page. */ TRUE if the record is the supremum record on a page. */
UNIV_INLINE UNIV_INLINE
ibool ibool
page_rec_is_supremum( page_rec_is_supremum_low(
/*=================*/ /*=====================*/
/* out: TRUE if the supremum record */ /* out: TRUE if the supremum record */
rec_t* rec); /* in: record */ ulint offset);/* in: record offset on page */
/**************************************************************** /****************************************************************
TRUE if the record is the infimum record on a page. */ TRUE if the record is the infimum record on a page. */
UNIV_INLINE UNIV_INLINE
ibool ibool
page_rec_is_infimum( page_rec_is_infimum_low(
/*================*/ /*=====================*/
/* out: TRUE if the infimum record */ /* out: TRUE if the infimum record */
rec_t* rec); /* in: record */ ulint offset);/* in: record offset on page */
/**************************************************************** /****************************************************************
TRUE if the record is the first user record on the page. */ TRUE if the record is a user record on the page. */
UNIV_INLINE UNIV_INLINE
ibool ibool
page_rec_is_first_user_rec( page_rec_is_user_rec(
/*=======================*/ /*=================*/
/* out: TRUE if first user record */ /* out: TRUE if a user record */
rec_t* rec); /* in: record */ const rec_t* rec); /* in: record */
/**************************************************************** /****************************************************************
TRUE if the record is the last user record on the page. */ TRUE if the record is the supremum record on a page. */
UNIV_INLINE UNIV_INLINE
ibool ibool
page_rec_is_last_user_rec( page_rec_is_supremum(
/*======================*/ /*=================*/
/* out: TRUE if last user record */ /* out: TRUE if the supremum record */
rec_t* rec); /* in: record */ const rec_t* rec); /* in: record */
/****************************************************************
TRUE if the record is the infimum record on a page. */
UNIV_INLINE
ibool
page_rec_is_infimum(
/*================*/
/* out: TRUE if the infimum record */
const rec_t* rec); /* in: record */
/******************************************************************* /*******************************************************************
Looks for the record which owns the given record. */ Looks for the record which owns the given record. */
UNIV_INLINE UNIV_INLINE
...@@ -495,7 +511,7 @@ ulint ...@@ -495,7 +511,7 @@ ulint
page_get_free_space_of_empty( page_get_free_space_of_empty(
/*=========================*/ /*=========================*/
/* out: free space */ /* out: free space */
ibool comp) /* in: TRUE=compact page format */ ulint comp) /* in: nonzero=compact page format */
__attribute__((const)); __attribute__((const));
/**************************************************************** /****************************************************************
Returns the sum of the sizes of the records in the record list Returns the sum of the sizes of the records in the record list
...@@ -539,7 +555,7 @@ page_create( ...@@ -539,7 +555,7 @@ page_create(
buf_frame_t* frame, /* in: a buffer frame where the page is buf_frame_t* frame, /* in: a buffer frame where the page is
created */ created */
mtr_t* mtr, /* in: mini-transaction handle */ mtr_t* mtr, /* in: mini-transaction handle */
ibool comp); /* in: TRUE=compact page format */ ulint comp); /* in: nonzero=compact page format */
/***************************************************************** /*****************************************************************
Differs from page_copy_rec_list_end, because this function does not Differs from page_copy_rec_list_end, because this function does not
touch the lock table and max trx id on page. */ touch the lock table and max trx id on page. */
...@@ -673,7 +689,7 @@ page_parse_create( ...@@ -673,7 +689,7 @@ page_parse_create(
/* out: end of log record or NULL */ /* out: end of log record or NULL */
byte* ptr, /* in: buffer */ byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */ byte* end_ptr,/* in: buffer end */
ibool comp, /* in: TRUE=compact page format */ ulint comp, /* in: nonzero=compact page format */
page_t* page, /* in: page or NULL */ page_t* page, /* in: page or NULL */
mtr_t* mtr); /* in: mtr or NULL */ mtr_t* mtr); /* in: mtr or NULL */
/**************************************************************** /****************************************************************
......
This diff is collapsed.
...@@ -71,13 +71,8 @@ read_view_sees_trx_id( ...@@ -71,13 +71,8 @@ read_view_sees_trx_id(
cmp = ut_dulint_cmp(trx_id, cmp = ut_dulint_cmp(trx_id,
read_view_get_nth_trx_id(view, n_ids - i - 1)); read_view_get_nth_trx_id(view, n_ids - i - 1));
if (0 == cmp) { if (cmp <= 0) {
return(cmp < 0);
return(FALSE);
} else if (cmp < 0) {
return(TRUE);
} }
} }
......
...@@ -51,7 +51,7 @@ rec_get_next_offs( ...@@ -51,7 +51,7 @@ rec_get_next_offs(
/* out: the page offset of the next /* out: the page offset of the next
chained record */ chained record */
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp); /* in: TRUE=compact page format */ ulint comp); /* in: nonzero=compact page format */
/********************************************************** /**********************************************************
The following function is used to set the next record offset field The following function is used to set the next record offset field
of the record. */ of the record. */
...@@ -60,7 +60,7 @@ void ...@@ -60,7 +60,7 @@ void
rec_set_next_offs( rec_set_next_offs(
/*==============*/ /*==============*/
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp, /* in: TRUE=compact page format */ ulint comp, /* in: nonzero=compact page format */
ulint next); /* in: offset of the next record */ ulint next); /* in: offset of the next record */
/********************************************************** /**********************************************************
The following function is used to get the number of fields The following function is used to get the number of fields
...@@ -90,7 +90,7 @@ rec_get_n_owned( ...@@ -90,7 +90,7 @@ rec_get_n_owned(
/*============*/ /*============*/
/* out: number of owned records */ /* out: number of owned records */
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp); /* in: TRUE=compact page format */ ulint comp); /* in: nonzero=compact page format */
/********************************************************** /**********************************************************
The following function is used to set the number of owned The following function is used to set the number of owned
records. */ records. */
...@@ -99,7 +99,7 @@ void ...@@ -99,7 +99,7 @@ void
rec_set_n_owned( rec_set_n_owned(
/*============*/ /*============*/
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp, /* in: TRUE=compact page format */ ulint comp, /* in: nonzero=compact page format */
ulint n_owned); /* in: the number of owned */ ulint n_owned); /* in: the number of owned */
/********************************************************** /**********************************************************
The following function is used to retrieve the info bits of The following function is used to retrieve the info bits of
...@@ -110,7 +110,7 @@ rec_get_info_bits( ...@@ -110,7 +110,7 @@ rec_get_info_bits(
/*==============*/ /*==============*/
/* out: info bits */ /* out: info bits */
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp); /* in: TRUE=compact page format */ ulint comp); /* in: nonzero=compact page format */
/********************************************************** /**********************************************************
The following function is used to set the info bits of a record. */ The following function is used to set the info bits of a record. */
UNIV_INLINE UNIV_INLINE
...@@ -118,7 +118,7 @@ void ...@@ -118,7 +118,7 @@ void
rec_set_info_bits( rec_set_info_bits(
/*==============*/ /*==============*/
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp, /* in: TRUE=compact page format */ ulint comp, /* in: nonzero=compact page format */
ulint bits); /* in: info bits */ ulint bits); /* in: info bits */
/********************************************************** /**********************************************************
The following function retrieves the status bits of a new-style record. */ The following function retrieves the status bits of a new-style record. */
...@@ -147,7 +147,7 @@ rec_get_info_and_status_bits( ...@@ -147,7 +147,7 @@ rec_get_info_and_status_bits(
/*=========================*/ /*=========================*/
/* out: info bits */ /* out: info bits */
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp); /* in: TRUE=compact page format */ ulint comp); /* in: nonzero=compact page format */
/********************************************************** /**********************************************************
The following function is used to set the info and status The following function is used to set the info and status
bits of a record. (Only compact records have status bits.) */ bits of a record. (Only compact records have status bits.) */
...@@ -156,18 +156,18 @@ void ...@@ -156,18 +156,18 @@ void
rec_set_info_and_status_bits( rec_set_info_and_status_bits(
/*=========================*/ /*=========================*/
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp, /* in: TRUE=compact page format */ ulint comp, /* in: nonzero=compact page format */
ulint bits); /* in: info bits */ ulint bits); /* in: info bits */
/********************************************************** /**********************************************************
The following function tells if record is delete marked. */ The following function tells if record is delete marked. */
UNIV_INLINE UNIV_INLINE
ibool ulint
rec_get_deleted_flag( rec_get_deleted_flag(
/*=================*/ /*=================*/
/* out: TRUE if delete marked */ /* out: nonzero if delete marked */
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp); /* in: TRUE=compact page format */ ulint comp); /* in: nonzero=compact page format */
/********************************************************** /**********************************************************
The following function is used to set the deleted bit. */ The following function is used to set the deleted bit. */
UNIV_INLINE UNIV_INLINE
...@@ -175,8 +175,8 @@ void ...@@ -175,8 +175,8 @@ void
rec_set_deleted_flag( rec_set_deleted_flag(
/*=================*/ /*=================*/
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp, /* in: TRUE=compact page format */ ulint comp, /* in: nonzero=compact page format */
ibool flag); /* in: TRUE if delete marked */ ulint flag); /* in: nonzero if delete marked */
/********************************************************** /**********************************************************
The following function tells if a new-style record is a node pointer. */ The following function tells if a new-style record is a node pointer. */
UNIV_INLINE UNIV_INLINE
...@@ -186,14 +186,6 @@ rec_get_node_ptr_flag( ...@@ -186,14 +186,6 @@ rec_get_node_ptr_flag(
/* out: TRUE if node pointer */ /* out: TRUE if node pointer */
rec_t* rec); /* in: physical record */ rec_t* rec); /* in: physical record */
/********************************************************** /**********************************************************
The following function is used to flag a record as a node pointer. */
UNIV_INLINE
void
rec_set_node_ptr_flag(
/*=================*/
rec_t* rec, /* in: physical record */
ibool flag); /* in: TRUE if the record is a node pointer */
/**********************************************************
The following function is used to get the order number The following function is used to get the order number
of the record in the heap of the index page. */ of the record in the heap of the index page. */
UNIV_INLINE UNIV_INLINE
...@@ -202,7 +194,7 @@ rec_get_heap_no( ...@@ -202,7 +194,7 @@ rec_get_heap_no(
/*=============*/ /*=============*/
/* out: heap order number */ /* out: heap order number */
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp); /* in: TRUE=compact page format */ ulint comp); /* in: nonzero=compact page format */
/********************************************************** /**********************************************************
The following function is used to set the heap number The following function is used to set the heap number
field in the record. */ field in the record. */
...@@ -211,7 +203,7 @@ void ...@@ -211,7 +203,7 @@ void
rec_set_heap_no( rec_set_heap_no(
/*=============*/ /*=============*/
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp, /* in: TRUE=compact page format */ ulint comp, /* in: nonzero=compact page format */
ulint heap_no);/* in: the heap number */ ulint heap_no);/* in: the heap number */
/********************************************************** /**********************************************************
The following function is used to test whether the data offsets The following function is used to test whether the data offsets
...@@ -305,27 +297,18 @@ rec_get_nth_field( ...@@ -305,27 +297,18 @@ rec_get_nth_field(
Determine if the offsets are for a record in the new Determine if the offsets are for a record in the new
compact format. */ compact format. */
UNIV_INLINE UNIV_INLINE
ibool ulint
rec_offs_comp( rec_offs_comp(
/*==========*/ /*==========*/
/* out: TRUE if compact format */ /* out: nonzero if compact format */
const ulint* offsets);/* in: array returned by rec_get_offsets() */ const ulint* offsets);/* in: array returned by rec_get_offsets() */
/********************************************************** /**********************************************************
Returns TRUE if the nth field of rec is SQL NULL. */ Returns nonzero if the extern bit is set in nth field of rec. */
UNIV_INLINE UNIV_INLINE
ibool ulint
rec_offs_nth_null(
/*==============*/
/* out: TRUE if SQL NULL */
const ulint* offsets,/* in: array returned by rec_get_offsets() */
ulint n); /* in: nth field */
/**********************************************************
Returns TRUE if the extern bit is set in nth field of rec. */
UNIV_INLINE
ibool
rec_offs_nth_extern( rec_offs_nth_extern(
/*================*/ /*================*/
/* out: TRUE if externally stored */ /* out: nonzero if externally stored */
const ulint* offsets,/* in: array returned by rec_get_offsets() */ const ulint* offsets,/* in: array returned by rec_get_offsets() */
ulint n); /* in: nth field */ ulint n); /* in: nth field */
/********************************************************** /**********************************************************
......
...@@ -265,7 +265,7 @@ rec_get_next_offs( ...@@ -265,7 +265,7 @@ rec_get_next_offs(
/* out: the page offset of the next chained record, or /* out: the page offset of the next chained record, or
0 if none */ 0 if none */
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp) /* in: TRUE=compact page format */ ulint comp) /* in: nonzero=compact page format */
{ {
ulint field_value; ulint field_value;
...@@ -312,7 +312,7 @@ void ...@@ -312,7 +312,7 @@ void
rec_set_next_offs( rec_set_next_offs(
/*==============*/ /*==============*/
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp, /* in: TRUE=compact page format */ ulint comp, /* in: nonzero=compact page format */
ulint next) /* in: offset of the next record, or 0 if none */ ulint next) /* in: offset of the next record, or 0 if none */
{ {
ut_ad(rec); ut_ad(rec);
...@@ -414,7 +414,7 @@ rec_get_n_fields( ...@@ -414,7 +414,7 @@ rec_get_n_fields(
{ {
ut_ad(rec); ut_ad(rec);
ut_ad(index); ut_ad(index);
if (!index->table->comp) { if (UNIV_UNLIKELY(!index->table->comp)) {
return(rec_get_n_fields_old(rec)); return(rec_get_n_fields_old(rec));
} }
switch (rec_get_status(rec)) { switch (rec_get_status(rec)) {
...@@ -440,7 +440,7 @@ rec_get_n_owned( ...@@ -440,7 +440,7 @@ rec_get_n_owned(
/*============*/ /*============*/
/* out: number of owned records */ /* out: number of owned records */
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp) /* in: TRUE=compact page format */ ulint comp) /* in: nonzero=compact page format */
{ {
ulint ret; ulint ret;
...@@ -461,7 +461,7 @@ void ...@@ -461,7 +461,7 @@ void
rec_set_n_owned( rec_set_n_owned(
/*============*/ /*============*/
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp, /* in: TRUE=compact page format */ ulint comp, /* in: nonzero=compact page format */
ulint n_owned) /* in: the number of owned */ ulint n_owned) /* in: the number of owned */
{ {
ut_ad(rec); ut_ad(rec);
...@@ -480,7 +480,7 @@ rec_get_info_bits( ...@@ -480,7 +480,7 @@ rec_get_info_bits(
/*==============*/ /*==============*/
/* out: info bits */ /* out: info bits */
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp) /* in: TRUE=compact page format */ ulint comp) /* in: nonzero=compact page format */
{ {
ulint ret; ulint ret;
...@@ -501,7 +501,7 @@ void ...@@ -501,7 +501,7 @@ void
rec_set_info_bits( rec_set_info_bits(
/*==============*/ /*==============*/
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp, /* in: TRUE=compact page format */ ulint comp, /* in: nonzero=compact page format */
ulint bits) /* in: info bits */ ulint bits) /* in: info bits */
{ {
ut_ad(rec); ut_ad(rec);
...@@ -537,14 +537,14 @@ rec_get_info_and_status_bits( ...@@ -537,14 +537,14 @@ rec_get_info_and_status_bits(
/*=========================*/ /*=========================*/
/* out: info bits */ /* out: info bits */
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp) /* in: TRUE=compact page format */ ulint comp) /* in: nonzero=compact page format */
{ {
ulint bits; ulint bits;
#if (REC_NEW_STATUS_MASK >> REC_NEW_STATUS_SHIFT) \ #if (REC_NEW_STATUS_MASK >> REC_NEW_STATUS_SHIFT) \
& (REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT) & (REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT)
# error "REC_NEW_STATUS_MASK and REC_INFO_BITS_MASK overlap" # error "REC_NEW_STATUS_MASK and REC_INFO_BITS_MASK overlap"
#endif #endif
if (comp) { if (UNIV_EXPECT(comp, REC_OFFS_COMPACT)) {
bits = rec_get_info_bits(rec, TRUE) | rec_get_status(rec); bits = rec_get_info_bits(rec, TRUE) | rec_get_status(rec);
} else { } else {
bits = rec_get_info_bits(rec, FALSE); bits = rec_get_info_bits(rec, FALSE);
...@@ -560,7 +560,7 @@ void ...@@ -560,7 +560,7 @@ void
rec_set_info_and_status_bits( rec_set_info_and_status_bits(
/*=========================*/ /*=========================*/
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp, /* in: TRUE=compact page format */ ulint comp, /* in: nonzero=compact page format */
ulint bits) /* in: info bits */ ulint bits) /* in: info bits */
{ {
#if (REC_NEW_STATUS_MASK >> REC_NEW_STATUS_SHIFT) \ #if (REC_NEW_STATUS_MASK >> REC_NEW_STATUS_SHIFT) \
...@@ -578,19 +578,22 @@ rec_set_info_and_status_bits( ...@@ -578,19 +578,22 @@ rec_set_info_and_status_bits(
/********************************************************** /**********************************************************
The following function tells if record is delete marked. */ The following function tells if record is delete marked. */
UNIV_INLINE UNIV_INLINE
ibool ulint
rec_get_deleted_flag( rec_get_deleted_flag(
/*=================*/ /*=================*/
/* out: TRUE if delete marked */ /* out: nonzero if delete marked */
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp) /* in: TRUE=compact page format */ ulint comp) /* in: nonzero=compact page format */
{ {
if (REC_INFO_DELETED_FLAG & rec_get_info_bits(rec, comp)) { if (UNIV_EXPECT(comp, REC_OFFS_COMPACT)) {
return(UNIV_UNLIKELY(rec_get_bit_field_1(rec,
return(TRUE); REC_NEW_INFO_BITS, REC_INFO_DELETED_FLAG,
REC_INFO_BITS_SHIFT)));
} else {
return(UNIV_UNLIKELY(rec_get_bit_field_1(rec,
REC_OLD_INFO_BITS, REC_INFO_DELETED_FLAG,
REC_INFO_BITS_SHIFT)));
} }
return(FALSE);
} }
/********************************************************** /**********************************************************
...@@ -600,24 +603,20 @@ void ...@@ -600,24 +603,20 @@ void
rec_set_deleted_flag( rec_set_deleted_flag(
/*=================*/ /*=================*/
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp, /* in: TRUE=compact page format */ ulint comp, /* in: nonzero=compact page format */
ibool flag) /* in: TRUE if delete marked */ ulint flag) /* in: nonzero if delete marked */
{ {
ulint old_val; ulint val;
ulint new_val;
ut_ad(TRUE == 1);
ut_ad(flag <= TRUE);
old_val = rec_get_info_bits(rec, comp); val = rec_get_info_bits(rec, comp);
if (flag) { if (flag) {
new_val = REC_INFO_DELETED_FLAG | old_val; val |= REC_INFO_DELETED_FLAG;
} else { } else {
new_val = ~REC_INFO_DELETED_FLAG & old_val; val &= ~REC_INFO_DELETED_FLAG;
} }
rec_set_info_bits(rec, comp, new_val); rec_set_info_bits(rec, comp, val);
} }
/********************************************************** /**********************************************************
...@@ -632,26 +631,6 @@ rec_get_node_ptr_flag( ...@@ -632,26 +631,6 @@ rec_get_node_ptr_flag(
return(REC_STATUS_NODE_PTR == rec_get_status(rec)); return(REC_STATUS_NODE_PTR == rec_get_status(rec));
} }
/**********************************************************
The following function is used to flag a record as a node pointer. */
UNIV_INLINE
void
rec_set_node_ptr_flag(
/*=================*/
rec_t* rec, /* in: physical record */
ibool flag) /* in: TRUE if the record is a node pointer */
{
ulint status;
ut_ad(flag <= TRUE);
ut_ad(REC_STATUS_NODE_PTR >= rec_get_status(rec));
if (flag) {
status = REC_STATUS_NODE_PTR;
} else {
status = REC_STATUS_ORDINARY;
}
rec_set_status(rec, status);
}
/********************************************************** /**********************************************************
The following function is used to get the order number of the record in the The following function is used to get the order number of the record in the
heap of the index page. */ heap of the index page. */
...@@ -661,7 +640,7 @@ rec_get_heap_no( ...@@ -661,7 +640,7 @@ rec_get_heap_no(
/*=============*/ /*=============*/
/* out: heap order number */ /* out: heap order number */
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp) /* in: TRUE=compact page format */ ulint comp) /* in: nonzero=compact page format */
{ {
ulint ret; ulint ret;
...@@ -682,7 +661,7 @@ void ...@@ -682,7 +661,7 @@ void
rec_set_heap_no( rec_set_heap_no(
/*=============*/ /*=============*/
rec_t* rec, /* in: physical record */ rec_t* rec, /* in: physical record */
ibool comp, /* in: TRUE=compact page format */ ulint comp, /* in: nonzero=compact page format */
ulint heap_no)/* in: the heap number */ ulint heap_no)/* in: the heap number */
{ {
ut_ad(heap_no <= REC_MAX_HEAP_NO); ut_ad(heap_no <= REC_MAX_HEAP_NO);
...@@ -843,7 +822,7 @@ rec_offs_validate( ...@@ -843,7 +822,7 @@ rec_offs_validate(
{ {
ulint i = rec_offs_n_fields(offsets); ulint i = rec_offs_n_fields(offsets);
ulint last = ULINT_MAX; ulint last = ULINT_MAX;
ibool comp = (*rec_offs_base(offsets) & REC_OFFS_COMPACT) != 0; ulint comp = *rec_offs_base(offsets) & REC_OFFS_COMPACT;
if (rec) { if (rec) {
ut_ad((ulint) rec == offsets[2]); ut_ad((ulint) rec == offsets[2]);
...@@ -926,7 +905,7 @@ rec_get_nth_field( ...@@ -926,7 +905,7 @@ rec_get_nth_field(
ut_ad(n < rec_offs_n_fields(offsets)); ut_ad(n < rec_offs_n_fields(offsets));
ut_ad(len); ut_ad(len);
if (n == 0) { if (UNIV_UNLIKELY(n == 0)) {
field = rec; field = rec;
} else { } else {
field = rec + (rec_offs_base(offsets)[n] & REC_OFFS_MASK); field = rec + (rec_offs_base(offsets)[n] & REC_OFFS_MASK);
...@@ -949,43 +928,30 @@ rec_get_nth_field( ...@@ -949,43 +928,30 @@ rec_get_nth_field(
Determine if the offsets are for a record in the new Determine if the offsets are for a record in the new
compact format. */ compact format. */
UNIV_INLINE UNIV_INLINE
ibool ulint
rec_offs_comp( rec_offs_comp(
/*==========*/ /*==========*/
/* out: TRUE if compact format */ /* out: nonzero if compact format */
const ulint* offsets)/* in: array returned by rec_get_offsets() */ const ulint* offsets)/* in: array returned by rec_get_offsets() */
{ {
ut_ad(rec_offs_validate(NULL, NULL, offsets)); ut_ad(rec_offs_validate(NULL, NULL, offsets));
return((*rec_offs_base(offsets) & REC_OFFS_COMPACT) != 0); return(*rec_offs_base(offsets) & REC_OFFS_COMPACT);
} }
/********************************************************** /**********************************************************
Returns TRUE if the nth field of rec is SQL NULL. */ Returns nonzero if the extern bit is set in nth field of rec. */
UNIV_INLINE
ibool
rec_offs_nth_null(
/*==============*/
/* out: TRUE if SQL NULL */
const ulint* offsets,/* in: array returned by rec_get_offsets() */
ulint n) /* in: nth field */
{
ut_ad(rec_offs_validate(NULL, NULL, offsets));
ut_ad(n < rec_offs_n_fields(offsets));
return((rec_offs_base(offsets)[1 + n] & REC_OFFS_SQL_NULL) != 0);
}
/**********************************************************
Returns TRUE if the extern bit is set in nth field of rec. */
UNIV_INLINE UNIV_INLINE
ibool ulint
rec_offs_nth_extern( rec_offs_nth_extern(
/*================*/ /*================*/
/* out: TRUE if externally stored */ /* out: nonzero if externally stored */
const ulint* offsets,/* in: array returned by rec_get_offsets() */ const ulint* offsets,/* in: array returned by rec_get_offsets() */
ulint n) /* in: nth field */ ulint n) /* in: nth field */
{ {
ut_ad(rec_offs_validate(NULL, NULL, offsets)); ut_ad(rec_offs_validate(NULL, NULL, offsets));
ut_ad(n < rec_offs_n_fields(offsets)); ut_ad(n < rec_offs_n_fields(offsets));
return((rec_offs_base(offsets)[1 + n] & REC_OFFS_EXTERNAL) != 0); return(UNIV_UNLIKELY(rec_offs_base(offsets)[1 + n]
& REC_OFFS_EXTERNAL));
} }
/********************************************************** /**********************************************************
...@@ -1037,7 +1003,7 @@ rec_set_nth_field_extern_bit( ...@@ -1037,7 +1003,7 @@ rec_set_nth_field_extern_bit(
where rec is, or NULL; in the NULL case where rec is, or NULL; in the NULL case
we do not write to log about the change */ we do not write to log about the change */
{ {
if (index->table->comp) { if (UNIV_LIKELY(index->table->comp)) {
rec_set_nth_field_extern_bit_new(rec, index, i, val, mtr); rec_set_nth_field_extern_bit_new(rec, index, i, val, mtr);
} else { } else {
rec_set_nth_field_extern_bit_old(rec, i, val, mtr); rec_set_nth_field_extern_bit_old(rec, i, val, mtr);
...@@ -1048,7 +1014,7 @@ rec_set_nth_field_extern_bit( ...@@ -1048,7 +1014,7 @@ rec_set_nth_field_extern_bit(
Returns the offset of n - 1th field end if the record is stored in the 1-byte Returns the offset of n - 1th field end if the record is stored in the 1-byte
offsets form. If the field is SQL null, the flag is ORed in the returned offsets form. If the field is SQL null, the flag is ORed in the returned
value. This function and the 2-byte counterpart are defined here because the value. This function and the 2-byte counterpart are defined here because the
C-compilerwas not able to sum negative and positive constant offsets, and C-compiler was not able to sum negative and positive constant offsets, and
warned of constant arithmetic overflow within the compiler. */ warned of constant arithmetic overflow within the compiler. */
UNIV_INLINE UNIV_INLINE
ulint ulint
...@@ -1452,7 +1418,7 @@ rec_get_converted_size( ...@@ -1452,7 +1418,7 @@ rec_get_converted_size(
? dict_index_get_n_unique_in_tree(index) + 1 ? dict_index_get_n_unique_in_tree(index) + 1
: dict_index_get_n_fields(index))); : dict_index_get_n_fields(index)));
if (index->table->comp) { if (UNIV_LIKELY(index->table->comp)) {
return(rec_get_converted_size_new(index, dtuple)); return(rec_get_converted_size_new(index, dtuple));
} }
......
...@@ -110,7 +110,7 @@ row_mysql_store_col_in_innobase_format( ...@@ -110,7 +110,7 @@ row_mysql_store_col_in_innobase_format(
necessarily the length of the actual necessarily the length of the actual
payload data; if the column is a true payload data; if the column is a true
VARCHAR then this is irrelevant */ VARCHAR then this is irrelevant */
ibool comp); /* in: TRUE = compact format */ ulint comp); /* in: nonzero=compact format */
/******************************************************************** /********************************************************************
Handles user errors and lock waits detected by the database engine. */ Handles user errors and lock waits detected by the database engine. */
...@@ -172,14 +172,6 @@ row_lock_table_autoinc_for_mysql( ...@@ -172,14 +172,6 @@ row_lock_table_autoinc_for_mysql(
row_prebuilt_t* prebuilt); /* in: prebuilt struct in the MySQL row_prebuilt_t* prebuilt); /* in: prebuilt struct in the MySQL
table handle */ table handle */
/************************************************************************* /*************************************************************************
Unlocks all table locks explicitly requested by trx (with LOCK TABLES,
lock type LOCK_TABLE_EXP). */
void
row_unlock_tables_for_mysql(
/*========================*/
trx_t* trx); /* in: transaction */
/*************************************************************************
Sets a table lock on the table mentioned in prebuilt. */ Sets a table lock on the table mentioned in prebuilt. */
int int
...@@ -190,9 +182,10 @@ row_lock_table_for_mysql( ...@@ -190,9 +182,10 @@ row_lock_table_for_mysql(
table handle */ table handle */
dict_table_t* table, /* in: table to lock, or NULL dict_table_t* table, /* in: table to lock, or NULL
if prebuilt->table should be if prebuilt->table should be
locked as LOCK_TABLE_EXP | locked as
prebuilt->select_lock_type */ prebuilt->select_lock_type */
ulint mode); /* in: lock mode of table */ ulint mode); /* in: lock mode of table
(ignored if table==NULL) */
/************************************************************************* /*************************************************************************
Does an insert for MySQL. */ Does an insert for MySQL. */
...@@ -599,6 +592,8 @@ struct row_prebuilt_struct { ...@@ -599,6 +592,8 @@ struct row_prebuilt_struct {
that was decided in ha_innodb.cc, that was decided in ha_innodb.cc,
::store_lock(), ::external_lock(), ::store_lock(), ::external_lock(),
etc. */ etc. */
ulint mysql_prefix_len;/* byte offset of the end of
the last requested column */
ulint mysql_row_len; /* length in bytes of a row in the ulint mysql_row_len; /* length in bytes of a row in the
MySQL format */ MySQL format */
ulint n_rows_fetched; /* number of rows fetched after ulint n_rows_fetched; /* number of rows fetched after
......
...@@ -75,7 +75,7 @@ open_step( ...@@ -75,7 +75,7 @@ open_step(
} }
} }
if (err != DB_SUCCESS) { if (UNIV_EXPECT(err, DB_SUCCESS) != DB_SUCCESS) {
/* SQL error detected */ /* SQL error detected */
fprintf(stderr, "SQL error %lu\n", (ulong) err); fprintf(stderr, "SQL error %lu\n", (ulong) err);
......
...@@ -83,7 +83,7 @@ upd_field_set_field_no( ...@@ -83,7 +83,7 @@ upd_field_set_field_no(
{ {
upd_field->field_no = field_no; upd_field->field_no = field_no;
if (field_no >= dict_index_get_n_fields(index)) { if (UNIV_UNLIKELY(field_no >= dict_index_get_n_fields(index))) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: trying to access field %lu in ", "InnoDB: Error: trying to access field %lu in ",
(ulong) field_no); (ulong) field_no);
......
...@@ -138,7 +138,7 @@ rw_lock_s_lock_low( ...@@ -138,7 +138,7 @@ rw_lock_s_lock_low(
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
/* Check if the writer field is free */ /* Check if the writer field is free */
if (lock->writer == RW_LOCK_NOT_LOCKED) { if (UNIV_LIKELY(lock->writer == RW_LOCK_NOT_LOCKED)) {
/* Set the shared lock by incrementing the reader count */ /* Set the shared lock by incrementing the reader count */
lock->reader_count++; lock->reader_count++;
...@@ -243,7 +243,7 @@ rw_lock_s_lock_func( ...@@ -243,7 +243,7 @@ rw_lock_s_lock_func(
mutex_enter(rw_lock_get_mutex(lock)); mutex_enter(rw_lock_get_mutex(lock));
if (TRUE == rw_lock_s_lock_low(lock, pass, file_name, line)) { if (UNIV_LIKELY(rw_lock_s_lock_low(lock, pass, file_name, line))) {
mutex_exit(rw_lock_get_mutex(lock)); mutex_exit(rw_lock_get_mutex(lock));
return; /* Success */ return; /* Success */
...@@ -307,21 +307,18 @@ rw_lock_x_lock_func_nowait( ...@@ -307,21 +307,18 @@ rw_lock_x_lock_func_nowait(
const char* file_name,/* in: file name where lock requested */ const char* file_name,/* in: file name where lock requested */
ulint line) /* in: line where requested */ ulint line) /* in: line where requested */
{ {
ibool success = FALSE; ibool success = FALSE;
os_thread_id_t curr_thread = os_thread_get_curr_id();
mutex_enter(rw_lock_get_mutex(lock)); mutex_enter(rw_lock_get_mutex(lock));
if ((rw_lock_get_reader_count(lock) == 0) if (UNIV_UNLIKELY(rw_lock_get_reader_count(lock) != 0)) {
&& ((rw_lock_get_writer(lock) == RW_LOCK_NOT_LOCKED) } else if (UNIV_LIKELY(rw_lock_get_writer(lock)
|| ((rw_lock_get_writer(lock) == RW_LOCK_EX) == RW_LOCK_NOT_LOCKED)) {
&& (lock->pass == 0)
&& os_thread_eq(lock->writer_thread,
os_thread_get_curr_id())))) {
rw_lock_set_writer(lock, RW_LOCK_EX); rw_lock_set_writer(lock, RW_LOCK_EX);
lock->writer_thread = os_thread_get_curr_id(); lock->writer_thread = curr_thread;
lock->writer_count++;
lock->pass = 0; lock->pass = 0;
relock:
lock->writer_count++;
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
rw_lock_add_debug_info(lock, 0, RW_LOCK_EX, file_name, line); rw_lock_add_debug_info(lock, 0, RW_LOCK_EX, file_name, line);
...@@ -331,6 +328,10 @@ rw_lock_x_lock_func_nowait( ...@@ -331,6 +328,10 @@ rw_lock_x_lock_func_nowait(
lock->last_x_line = line; lock->last_x_line = line;
success = TRUE; success = TRUE;
} else if (rw_lock_get_writer(lock) == RW_LOCK_EX
&& lock->pass == 0
&& os_thread_eq(lock->writer_thread, curr_thread)) {
goto relock;
} }
mutex_exit(rw_lock_get_mutex(lock)); mutex_exit(rw_lock_get_mutex(lock));
...@@ -361,7 +362,7 @@ rw_lock_s_unlock_func( ...@@ -361,7 +362,7 @@ rw_lock_s_unlock_func(
/* Reset the shared lock by decrementing the reader count */ /* Reset the shared lock by decrementing the reader count */
ut_a(lock->reader_count > 0); ut_ad(lock->reader_count > 0);
lock->reader_count--; lock->reader_count--;
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
...@@ -371,7 +372,8 @@ rw_lock_s_unlock_func( ...@@ -371,7 +372,8 @@ rw_lock_s_unlock_func(
/* If there may be waiters and this was the last s-lock, /* If there may be waiters and this was the last s-lock,
signal the object */ signal the object */
if (lock->waiters && (lock->reader_count == 0)) { if (UNIV_UNLIKELY(lock->waiters)
&& lock->reader_count == 0) {
sg = TRUE; sg = TRUE;
rw_lock_set_waiters(lock, 0); rw_lock_set_waiters(lock, 0);
...@@ -379,7 +381,7 @@ rw_lock_s_unlock_func( ...@@ -379,7 +381,7 @@ rw_lock_s_unlock_func(
mutex_exit(mutex); mutex_exit(mutex);
if (sg == TRUE) { if (UNIV_UNLIKELY(sg)) {
sync_array_signal_object(sync_primary_wait_array, lock); sync_array_signal_object(sync_primary_wait_array, lock);
} }
...@@ -450,7 +452,8 @@ rw_lock_x_unlock_func( ...@@ -450,7 +452,8 @@ rw_lock_x_unlock_func(
#endif #endif
/* If there may be waiters, signal the lock */ /* If there may be waiters, signal the lock */
if (lock->waiters && (lock->writer_count == 0)) { if (UNIV_UNLIKELY(lock->waiters)
&& lock->writer_count == 0) {
sg = TRUE; sg = TRUE;
rw_lock_set_waiters(lock, 0); rw_lock_set_waiters(lock, 0);
...@@ -458,7 +461,7 @@ rw_lock_x_unlock_func( ...@@ -458,7 +461,7 @@ rw_lock_x_unlock_func(
mutex_exit(&(lock->mutex)); mutex_exit(&(lock->mutex));
if (sg == TRUE) { if (UNIV_UNLIKELY(sg)) {
sync_array_signal_object(sync_primary_wait_array, lock); sync_array_signal_object(sync_primary_wait_array, lock);
} }
......
...@@ -65,7 +65,7 @@ trx_rsegf_get_nth_undo( ...@@ -65,7 +65,7 @@ trx_rsegf_get_nth_undo(
ulint n, /* in: index of slot */ ulint n, /* in: index of slot */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
if (n >= TRX_RSEG_N_SLOTS) { if (UNIV_UNLIKELY(n >= TRX_RSEG_N_SLOTS)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: trying to get slot %lu of rseg\n", (unsigned long) n); "InnoDB: Error: trying to get slot %lu of rseg\n", (unsigned long) n);
ut_error; ut_error;
...@@ -86,7 +86,7 @@ trx_rsegf_set_nth_undo( ...@@ -86,7 +86,7 @@ trx_rsegf_set_nth_undo(
ulint page_no,/* in: page number of the undo log segment */ ulint page_no,/* in: page number of the undo log segment */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
if (n >= TRX_RSEG_N_SLOTS) { if (UNIV_UNLIKELY(n >= TRX_RSEG_N_SLOTS)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: trying to set slot %lu of rseg\n", (unsigned long) n); "InnoDB: Error: trying to set slot %lu of rseg\n", (unsigned long) n);
ut_error; ut_error;
......
...@@ -312,6 +312,19 @@ trx_print( ...@@ -312,6 +312,19 @@ trx_print(
FILE* f, /* in: output stream */ FILE* f, /* in: output stream */
trx_t* trx); /* in: transaction */ trx_t* trx); /* in: transaction */
#ifndef UNIV_HOTBACKUP
/**************************************************************************
Determines if the currently running transaction has been interrupted. */
ibool
trx_is_interrupted(
/*===============*/
/* out: TRUE if interrupted */
trx_t* trx); /* in: transaction */
#else /* !UNIV_HOTBACKUP */
#define trx_is_interrupted(trx) FALSE
#endif /* !UNIV_HOTBACKUP */
/* Signal to a transaction */ /* Signal to a transaction */
struct trx_sig_struct{ struct trx_sig_struct{
...@@ -484,13 +497,6 @@ struct trx_struct{ ...@@ -484,13 +497,6 @@ struct trx_struct{
in the lock list trx_locks */ in the lock list trx_locks */
ibool trx_create_lock;/* this is TRUE if we have created a ibool trx_create_lock;/* this is TRUE if we have created a
new lock for a record accessed */ new lock for a record accessed */
ulint n_lock_table_exp;/* number of explicit table locks
(LOCK TABLES) reserved by the
transaction, stored in trx_locks */
ulint n_lock_table_transactional;
/* number of transactional table locks
(LOCK TABLES..WHERE ENGINE) reserved by
the transaction, stored in trx_locks */
UT_LIST_NODE_T(trx_t) UT_LIST_NODE_T(trx_t)
trx_list; /* list of transactions */ trx_list; /* list of transactions */
UT_LIST_NODE_T(trx_t) UT_LIST_NODE_T(trx_t)
......
...@@ -181,7 +181,7 @@ management to ensure correct alignment for doubles etc. */ ...@@ -181,7 +181,7 @@ management to ensure correct alignment for doubles etc. */
/* Another basic type we use is unsigned long integer which should be equal to /* Another basic type we use is unsigned long integer which should be equal to
the word size of the machine, that is on a 32-bit platform 32 bits, and on a the word size of the machine, that is on a 32-bit platform 32 bits, and on a
64-bit platform 64 bits. We also give the printf format for the type as a 64-bit platform 64 bits. We also give the printf format for the type as a
macro PRULINT. */ macro ULINTPF. */
#ifdef _WIN64 #ifdef _WIN64
typedef unsigned __int64 ulint; typedef unsigned __int64 ulint;
...@@ -243,6 +243,30 @@ contains the sum of the following flag and the locally stored len. */ ...@@ -243,6 +243,30 @@ contains the sum of the following flag and the locally stored len. */
#define UNIV_EXTERN_STORAGE_FIELD (UNIV_SQL_NULL - UNIV_PAGE_SIZE) #define UNIV_EXTERN_STORAGE_FIELD (UNIV_SQL_NULL - UNIV_PAGE_SIZE)
/* Some macros to improve branch prediction and reduce cache misses */
#if defined(__GNUC__) && (__GNUC__ > 2)
/* Tell the compiler that 'expr' probably evaluates to 'constant'. */
# define UNIV_EXPECT(expr,constant) __builtin_expect(expr, constant)
/* Tell the compiler that a pointer is likely to be NULL */
# define UNIV_LIKELY_NULL(ptr) __builtin_expect((ulint) ptr, 0)
/* Minimize cache-miss latency by moving data at addr into a cache before
it is read. */
# define UNIV_PREFETCH_R(addr) __builtin_prefetch(addr, 0, 3)
/* Minimize cache-miss latency by moving data at addr into a cache before
it is read or written. */
# define UNIV_PREFETCH_RW(addr) __builtin_prefetch(addr, 1, 3)
#else
/* Dummy versions of the macros */
# define UNIV_EXPECT(expr,value) (expr)
# define UNIV_LIKELY_NULL(expr) (expr)
# define UNIV_PREFETCH_R(addr) ((void) 0)
# define UNIV_PREFETCH_RW(addr) ((void) 0)
#endif
/* Tell the compiler that cond is likely to hold */
#define UNIV_LIKELY(cond) UNIV_EXPECT(cond, TRUE)
/* Tell the compiler that cond is unlikely to hold */
#define UNIV_UNLIKELY(cond) UNIV_EXPECT(cond, FALSE)
#include <stdio.h> #include <stdio.h>
#include "ut0dbg.h" #include "ut0dbg.h"
#include "ut0ut.h" #include "ut0ut.h"
......
...@@ -13,74 +13,75 @@ Created 1/30/1994 Heikki Tuuri ...@@ -13,74 +13,75 @@ Created 1/30/1994 Heikki Tuuri
#include <stdlib.h> #include <stdlib.h>
#include "os0thread.h" #include "os0thread.h"
#if defined(__GNUC__) && (__GNUC__ > 2)
# define UT_DBG_FAIL(EXPR) UNIV_UNLIKELY(!((ulint)(EXPR)))
#else
extern ulint ut_dbg_zero; /* This is used to eliminate extern ulint ut_dbg_zero; /* This is used to eliminate
compiler warnings */ compiler warnings */
# define UT_DBG_FAIL(EXPR) !((ulint)(EXPR) + ut_dbg_zero)
#endif
/*****************************************************************
Report a failed assertion. */
void
ut_dbg_assertion_failed(
/*====================*/
const char* expr, /* in: the failed assertion */
const char* file, /* in: source file containing the assertion */
ulint line); /* in: line number of the assertion */
#ifdef __NETWARE__
/* Flag for ignoring further assertion failures.
On NetWare, have a graceful exit rather than a segfault to avoid abends. */
extern ibool panic_shutdown;
/* Abort the execution. */
void ut_dbg_panic(void);
# define UT_DBG_PANIC ut_dbg_panic()
/* Stop threads in ut_a(). */
# define UT_DBG_STOP while (0) /* We do not do this on NetWare */
#else /* __NETWARE__ */
/* Flag for indicating that all threads should stop. This will be set
by ut_dbg_assertion_failed(). */
extern ibool ut_dbg_stop_threads; extern ibool ut_dbg_stop_threads;
/* A null pointer that will be dereferenced to trigger a memory trap */
extern ulint* ut_dbg_null_ptr; extern ulint* ut_dbg_null_ptr;
extern const char* ut_dbg_msg_assert_fail; /*****************************************************************
extern const char* ut_dbg_msg_trap; Stop a thread after assertion failure. */
extern const char* ut_dbg_msg_stop;
/* Have a graceful exit on NetWare rather than a segfault to avoid abends */ void
#ifdef __NETWARE__ ut_dbg_stop_thread(
extern ibool panic_shutdown; /*===============*/
#define ut_a(EXPR) do {\ const char* file,
if (!((ulint)(EXPR) + ut_dbg_zero)) {\ ulint line);
ut_print_timestamp(stderr);\
fprintf(stderr, ut_dbg_msg_assert_fail,\ /* Abort the execution. */
os_thread_pf(os_thread_get_curr_id()), __FILE__,\ # define UT_DBG_PANIC \
(ulint)__LINE__);\ if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL
fputs("InnoDB: Failing assertion: " #EXPR "\n", stderr);\ /* Stop threads in ut_a(). */
fputs(ut_dbg_msg_trap, stderr);\ # define UT_DBG_STOP do \
ut_dbg_stop_threads = TRUE;\ if (UNIV_UNLIKELY(ut_dbg_stop_threads)) { \
if (ut_dbg_stop_threads) {\ ut_dbg_stop_thread(__FILE__, (ulint) __LINE__); \
fprintf(stderr, ut_dbg_msg_stop,\ } while (0)
os_thread_pf(os_thread_get_curr_id()), __FILE__, (ulint)__LINE__);\ #endif /* __NETWARE__ */
}\
if(!panic_shutdown){\ /* Abort execution if EXPR does not evaluate to nonzero. */
panic_shutdown = TRUE;\ #define ut_a(EXPR) do { \
innobase_shutdown_for_mysql();}\ if (UT_DBG_FAIL(EXPR)) { \
exit(1);\ ut_dbg_assertion_failed(#EXPR, \
}\ __FILE__, (ulint) __LINE__); \
} while (0) UT_DBG_PANIC; \
#define ut_error do {\ } \
ut_print_timestamp(stderr);\ UT_DBG_STOP; \
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(!panic_shutdown){panic_shutdown = TRUE;\
innobase_shutdown_for_mysql();}\
} while (0)
#else
#define ut_a(EXPR) do {\
if (!((ulint)(EXPR) + ut_dbg_zero)) {\
ut_print_timestamp(stderr);\
fprintf(stderr, ut_dbg_msg_assert_fail,\
os_thread_pf(os_thread_get_curr_id()), __FILE__,\
(ulint)__LINE__);\
fputs("InnoDB: Failing assertion: " #EXPR "\n", stderr);\
fputs(ut_dbg_msg_trap, stderr);\
ut_dbg_stop_threads = TRUE;\
if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL;\
}\
if (ut_dbg_stop_threads) {\
fprintf(stderr, ut_dbg_msg_stop,\
os_thread_pf(os_thread_get_curr_id()), __FILE__, (ulint)__LINE__);\
os_thread_sleep(1000000000);\
}\
} while (0) } while (0)
#define ut_error do {\ /* Abort execution. */
ut_print_timestamp(stderr);\ #define ut_error do { \
fprintf(stderr, ut_dbg_msg_assert_fail,\ ut_dbg_assertion_failed(0, __FILE__, (ulint) __LINE__); \
os_thread_pf(os_thread_get_curr_id()), __FILE__, (ulint)__LINE__);\ UT_DBG_PANIC; \
fprintf(stderr, ut_dbg_msg_trap);\
ut_dbg_stop_threads = TRUE;\
if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL;\
} while (0) } while (0)
#endif
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
#define ut_ad(EXPR) ut_a(EXPR) #define ut_ad(EXPR) ut_a(EXPR)
......
...@@ -207,12 +207,12 @@ ut_fold_binary( ...@@ -207,12 +207,12 @@ ut_fold_binary(
const byte* str, /* in: string of bytes */ const byte* str, /* in: string of bytes */
ulint len) /* in: length */ ulint len) /* in: length */
{ {
ulint i; const byte* str_end = str + len;
ulint fold = 0; ulint fold = 0;
ut_ad(str); ut_ad(str);
for (i = 0; i < len; i++) { while (str < str_end) {
fold = ut_fold_ulint_pair(fold, (ulint)(*str)); fold = ut_fold_ulint_pair(fold, (ulint)(*str));
str++; str++;
......
This diff is collapsed.
...@@ -57,10 +57,11 @@ ulint log_fsp_current_free_limit = 0; ...@@ -57,10 +57,11 @@ ulint log_fsp_current_free_limit = 0;
/* Global log system variable */ /* Global log system variable */
log_t* log_sys = NULL; log_t* log_sys = NULL;
#ifdef UNIV_DEBUG
ibool log_do_write = TRUE; ibool log_do_write = TRUE;
ibool log_debug_writes = FALSE; ibool log_debug_writes = FALSE;
#endif /* UNIV_DEBUG */
/* These control how often we print warnings if the last checkpoint is too /* These control how often we print warnings if the last checkpoint is too
old */ old */
...@@ -974,22 +975,24 @@ log_group_check_flush_completion( ...@@ -974,22 +975,24 @@ log_group_check_flush_completion(
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
if (!log_sys->one_flushed && group->n_pending_writes == 0) { if (!log_sys->one_flushed && group->n_pending_writes == 0) {
#ifdef UNIV_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"Log flushed first to group %lu\n", (ulong) group->id); "Log flushed first to group %lu\n", (ulong) group->id);
} }
#endif /* UNIV_DEBUG */
log_sys->written_to_some_lsn = log_sys->write_lsn; log_sys->written_to_some_lsn = log_sys->write_lsn;
log_sys->one_flushed = TRUE; log_sys->one_flushed = TRUE;
return(LOG_UNLOCK_NONE_FLUSHED_LOCK); return(LOG_UNLOCK_NONE_FLUSHED_LOCK);
} }
#ifdef UNIV_DEBUG
if (log_debug_writes && (group->n_pending_writes == 0)) { if (log_debug_writes && (group->n_pending_writes == 0)) {
fprintf(stderr, "Log flushed to group %lu\n", (ulong) group->id); fprintf(stderr, "Log flushed to group %lu\n", (ulong) group->id);
} }
#endif /* UNIV_DEBUG */
return(0); return(0);
} }
...@@ -1066,12 +1069,13 @@ log_io_complete( ...@@ -1066,12 +1069,13 @@ log_io_complete(
fil_flush(group->space_id); fil_flush(group->space_id);
} }
#ifdef UNIV_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"Checkpoint info written to group %lu\n", "Checkpoint info written to group %lu\n",
group->id); group->id);
} }
#endif /* UNIV_DEBUG */
log_io_complete_checkpoint(); log_io_complete_checkpoint();
return; return;
...@@ -1133,12 +1137,13 @@ log_group_file_header_flush( ...@@ -1133,12 +1137,13 @@ log_group_file_header_flush(
dest_offset = nth_file * group->file_size; dest_offset = nth_file * group->file_size;
#ifdef UNIV_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"Writing log file header to group %lu file %lu\n", "Writing log file header to group %lu file %lu\n",
(ulong) group->id, (ulong) nth_file); (ulong) group->id, (ulong) nth_file);
} }
#endif /* UNIV_DEBUG */
if (log_do_write) { if (log_do_write) {
log_sys->n_log_ios++; log_sys->n_log_ios++;
...@@ -1226,7 +1231,8 @@ loop: ...@@ -1226,7 +1231,8 @@ loop:
} else { } else {
write_len = len; write_len = len;
} }
#ifdef UNIV_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
...@@ -1250,7 +1256,7 @@ loop: ...@@ -1250,7 +1256,7 @@ loop:
+ i * OS_FILE_LOG_BLOCK_SIZE)); + i * OS_FILE_LOG_BLOCK_SIZE));
} }
} }
#endif /* UNIV_DEBUG */
/* Calculate the checksums for each log block and write them to /* Calculate the checksums for each log block and write them to
the trailer fields of the log blocks */ the trailer fields of the log blocks */
...@@ -1384,6 +1390,7 @@ loop: ...@@ -1384,6 +1390,7 @@ loop:
return; return;
} }
#ifdef UNIV_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"Writing log from %lu %lu up to lsn %lu %lu\n", "Writing log from %lu %lu up to lsn %lu %lu\n",
...@@ -1392,7 +1399,7 @@ loop: ...@@ -1392,7 +1399,7 @@ loop:
(ulong) ut_dulint_get_high(log_sys->lsn), (ulong) ut_dulint_get_high(log_sys->lsn),
(ulong) ut_dulint_get_low(log_sys->lsn)); (ulong) ut_dulint_get_low(log_sys->lsn));
} }
#endif /* UNIV_DEBUG */
log_sys->n_pending_writes++; log_sys->n_pending_writes++;
group = UT_LIST_GET_FIRST(log_sys->log_groups); group = UT_LIST_GET_FIRST(log_sys->log_groups);
...@@ -1961,12 +1968,14 @@ log_checkpoint( ...@@ -1961,12 +1968,14 @@ log_checkpoint(
log_sys->next_checkpoint_lsn = oldest_lsn; log_sys->next_checkpoint_lsn = oldest_lsn;
#ifdef UNIV_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, "Making checkpoint no %lu at lsn %lu %lu\n", fprintf(stderr, "Making checkpoint no %lu at lsn %lu %lu\n",
(ulong) ut_dulint_get_low(log_sys->next_checkpoint_no), (ulong) ut_dulint_get_low(log_sys->next_checkpoint_no),
(ulong) ut_dulint_get_high(oldest_lsn), (ulong) ut_dulint_get_high(oldest_lsn),
(ulong) ut_dulint_get_low(oldest_lsn)); (ulong) ut_dulint_get_low(oldest_lsn));
} }
#endif /* UNIV_DEBUG */
log_groups_write_checkpoint_info(); log_groups_write_checkpoint_info();
...@@ -2029,8 +2038,6 @@ log_checkpoint_margin(void) ...@@ -2029,8 +2038,6 @@ log_checkpoint_margin(void)
ulint checkpoint_age; ulint checkpoint_age;
ulint advance; ulint advance;
dulint oldest_lsn; dulint oldest_lsn;
dulint new_oldest;
ibool do_preflush;
ibool sync; ibool sync;
ibool checkpoint_sync; ibool checkpoint_sync;
ibool do_checkpoint; ibool do_checkpoint;
...@@ -2038,7 +2045,6 @@ log_checkpoint_margin(void) ...@@ -2038,7 +2045,6 @@ log_checkpoint_margin(void)
loop: loop:
sync = FALSE; sync = FALSE;
checkpoint_sync = FALSE; checkpoint_sync = FALSE;
do_preflush = FALSE;
do_checkpoint = FALSE; do_checkpoint = FALSE;
mutex_enter(&(log->mutex)); mutex_enter(&(log->mutex));
...@@ -2058,21 +2064,13 @@ loop: ...@@ -2058,21 +2064,13 @@ loop:
/* A flush is urgent: we have to do a synchronous preflush */ /* A flush is urgent: we have to do a synchronous preflush */
sync = TRUE; sync = TRUE;
advance = 2 * (age - log->max_modified_age_async);
advance = 2 * (age - log->max_modified_age_sync);
new_oldest = ut_dulint_add(oldest_lsn, advance);
do_preflush = TRUE;
} else if (age > log->max_modified_age_async) { } else if (age > log->max_modified_age_async) {
/* A flush is not urgent: we do an asynchronous preflush */ /* A flush is not urgent: we do an asynchronous preflush */
advance = age - log->max_modified_age_async; advance = age - log->max_modified_age_async;
} else {
new_oldest = ut_dulint_add(oldest_lsn, advance); advance = 0;
do_preflush = TRUE;
} }
checkpoint_age = ut_dulint_minus(log->lsn, log->last_checkpoint_lsn); checkpoint_age = ut_dulint_minus(log->lsn, log->last_checkpoint_lsn);
...@@ -2096,7 +2094,9 @@ loop: ...@@ -2096,7 +2094,9 @@ loop:
mutex_exit(&(log->mutex)); mutex_exit(&(log->mutex));
if (do_preflush) { if (advance) {
dulint new_oldest = ut_dulint_add(oldest_lsn, advance);
success = log_preflush_pool_modified_pages(new_oldest, sync); success = log_preflush_pool_modified_pages(new_oldest, sync);
/* If the flush succeeded, this thread has done its part /* If the flush succeeded, this thread has done its part
...@@ -2347,9 +2347,11 @@ loop: ...@@ -2347,9 +2347,11 @@ loop:
exit(1); exit(1);
} }
#ifdef UNIV_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, "Created archive file %s\n", name); fprintf(stderr, "Created archive file %s\n", name);
} }
#endif /* UNIV_DEBUG */
ret = os_file_close(file_handle); ret = os_file_close(file_handle);
...@@ -2375,7 +2377,8 @@ loop: ...@@ -2375,7 +2377,8 @@ loop:
len = group->file_size - (next_offset % group->file_size); len = group->file_size - (next_offset % group->file_size);
} }
#ifdef UNIV_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"Archiving starting at lsn %lu %lu, len %lu to group %lu\n", "Archiving starting at lsn %lu %lu, len %lu to group %lu\n",
...@@ -2383,6 +2386,7 @@ loop: ...@@ -2383,6 +2386,7 @@ loop:
(ulong) ut_dulint_get_low(start_lsn), (ulong) ut_dulint_get_low(start_lsn),
(ulong) len, (ulong) group->id); (ulong) len, (ulong) group->id);
} }
#endif /* UNIV_DEBUG */
log_sys->n_pending_archive_ios++; log_sys->n_pending_archive_ios++;
...@@ -2473,11 +2477,13 @@ log_archive_write_complete_groups(void) ...@@ -2473,11 +2477,13 @@ log_archive_write_complete_groups(void)
trunc_files = n_files - 1; trunc_files = n_files - 1;
} }
#ifdef UNIV_DEBUG
if (log_debug_writes && trunc_files) { if (log_debug_writes && trunc_files) {
fprintf(stderr, fprintf(stderr,
"Complete file(s) archived to group %lu\n", "Complete file(s) archived to group %lu\n",
(ulong) group->id); (ulong) group->id);
} }
#endif /* UNIV_DEBUG */
/* Calculate the archive file space start lsn */ /* Calculate the archive file space start lsn */
start_lsn = ut_dulint_subtract(log_sys->next_archived_lsn, start_lsn = ut_dulint_subtract(log_sys->next_archived_lsn,
...@@ -2500,9 +2506,11 @@ log_archive_write_complete_groups(void) ...@@ -2500,9 +2506,11 @@ log_archive_write_complete_groups(void)
fil_space_truncate_start(group->archive_space_id, fil_space_truncate_start(group->archive_space_id,
trunc_files * group->file_size); trunc_files * group->file_size);
#ifdef UNIV_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fputs("Archiving writes completed\n", stderr); fputs("Archiving writes completed\n", stderr);
} }
#endif /* UNIV_DEBUG */
} }
/********************************************************** /**********************************************************
...@@ -2519,9 +2527,11 @@ log_archive_check_completion_low(void) ...@@ -2519,9 +2527,11 @@ log_archive_check_completion_low(void)
if (log_sys->n_pending_archive_ios == 0 if (log_sys->n_pending_archive_ios == 0
&& log_sys->archiving_phase == LOG_ARCHIVE_READ) { && log_sys->archiving_phase == LOG_ARCHIVE_READ) {
#ifdef UNIV_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fputs("Archiving read completed\n", stderr); fputs("Archiving read completed\n", stderr);
} }
#endif /* UNIV_DEBUG */
/* Archive buffer has now been read in: start archive writes */ /* Archive buffer has now been read in: start archive writes */
...@@ -2665,6 +2675,7 @@ loop: ...@@ -2665,6 +2675,7 @@ loop:
log_sys->next_archived_lsn = limit_lsn; log_sys->next_archived_lsn = limit_lsn;
#ifdef UNIV_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"Archiving from lsn %lu %lu to lsn %lu %lu\n", "Archiving from lsn %lu %lu to lsn %lu %lu\n",
...@@ -2673,6 +2684,7 @@ loop: ...@@ -2673,6 +2684,7 @@ loop:
(ulong) ut_dulint_get_high(limit_lsn), (ulong) ut_dulint_get_high(limit_lsn),
(ulong) ut_dulint_get_low(limit_lsn)); (ulong) ut_dulint_get_low(limit_lsn));
} }
#endif /* UNIV_DEBUG */
/* Read the log segment to the archive buffer */ /* Read the log segment to the archive buffer */
...@@ -2775,12 +2787,14 @@ log_archive_close_groups( ...@@ -2775,12 +2787,14 @@ log_archive_close_groups(
group->archived_file_no += 2; group->archived_file_no += 2;
} }
#ifdef UNIV_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"Incrementing arch file no to %lu in log group %lu\n", "Incrementing arch file no to %lu in log group %lu\n",
(ulong) group->archived_file_no + 2, (ulong) group->archived_file_no + 2,
(ulong) group->id); (ulong) group->id);
} }
#endif /* UNIV_DEBUG */
} }
} }
......
...@@ -489,6 +489,7 @@ recv_find_max_checkpoint( ...@@ -489,6 +489,7 @@ recv_find_max_checkpoint(
log_group_read_checkpoint_info(group, field); log_group_read_checkpoint_info(group, field);
if (!recv_check_cp_is_consistent(buf)) { if (!recv_check_cp_is_consistent(buf)) {
#ifdef UNIV_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Checkpoint in group %lu at %lu invalid, %lu\n", "InnoDB: Checkpoint in group %lu at %lu invalid, %lu\n",
...@@ -498,7 +499,7 @@ recv_find_max_checkpoint( ...@@ -498,7 +499,7 @@ recv_find_max_checkpoint(
+ LOG_CHECKPOINT_CHECKSUM_1)); + LOG_CHECKPOINT_CHECKSUM_1));
} }
#endif /* UNIV_DEBUG */
goto not_consistent; goto not_consistent;
} }
...@@ -511,13 +512,15 @@ recv_find_max_checkpoint( ...@@ -511,13 +512,15 @@ recv_find_max_checkpoint(
checkpoint_no = checkpoint_no =
mach_read_from_8(buf + LOG_CHECKPOINT_NO); mach_read_from_8(buf + LOG_CHECKPOINT_NO);
#ifdef UNIV_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Checkpoint number %lu found in group %lu\n", "InnoDB: Checkpoint number %lu found in group %lu\n",
(ulong) ut_dulint_get_low(checkpoint_no), (ulong) ut_dulint_get_low(checkpoint_no),
(ulong) group->id); (ulong) group->id);
} }
#endif /* UNIV_DEBUG */
if (ut_dulint_cmp(checkpoint_no, max_no) >= 0) { if (ut_dulint_cmp(checkpoint_no, max_no) >= 0) {
*max_group = group; *max_group = group;
*max_field = field; *max_field = field;
...@@ -540,7 +543,7 @@ recv_find_max_checkpoint( ...@@ -540,7 +543,7 @@ recv_find_max_checkpoint(
"InnoDB: to create the InnoDB data files, but log file creation failed.\n" "InnoDB: to create the InnoDB data files, but log file creation failed.\n"
"InnoDB: If that is the case, please refer to\n" "InnoDB: If that is the case, please refer to\n"
"InnoDB: http://dev.mysql.com/doc/mysql/en/Error_creating_InnoDB.html\n"); "InnoDB: http://dev.mysql.com/doc/mysql/en/Error_creating_InnoDB.html\n");
*max_field = 0;
return(DB_ERROR); return(DB_ERROR);
} }
...@@ -765,6 +768,7 @@ recv_parse_or_apply_log_rec_body( ...@@ -765,6 +768,7 @@ recv_parse_or_apply_log_rec_body(
case MLOG_REC_INSERT: case MLOG_COMP_REC_INSERT: case MLOG_REC_INSERT: case MLOG_COMP_REC_INSERT:
if (NULL != (ptr = mlog_parse_index(ptr, end_ptr, if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
type == MLOG_COMP_REC_INSERT, &index))) { type == MLOG_COMP_REC_INSERT, &index))) {
ut_a(!page||!!page_is_comp(page)==index->table->comp);
ptr = page_cur_parse_insert_rec(FALSE, ptr, end_ptr, ptr = page_cur_parse_insert_rec(FALSE, ptr, end_ptr,
index, page, mtr); index, page, mtr);
} }
...@@ -772,20 +776,27 @@ recv_parse_or_apply_log_rec_body( ...@@ -772,20 +776,27 @@ recv_parse_or_apply_log_rec_body(
case MLOG_REC_CLUST_DELETE_MARK: case MLOG_COMP_REC_CLUST_DELETE_MARK: case MLOG_REC_CLUST_DELETE_MARK: case MLOG_COMP_REC_CLUST_DELETE_MARK:
if (NULL != (ptr = mlog_parse_index(ptr, end_ptr, if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
type == MLOG_COMP_REC_CLUST_DELETE_MARK, &index))) { type == MLOG_COMP_REC_CLUST_DELETE_MARK, &index))) {
ut_a(!page||!!page_is_comp(page)==index->table->comp);
ptr = btr_cur_parse_del_mark_set_clust_rec(ptr, ptr = btr_cur_parse_del_mark_set_clust_rec(ptr,
end_ptr, index, page); end_ptr, index, page);
} }
break; break;
case MLOG_REC_SEC_DELETE_MARK: case MLOG_COMP_REC_SEC_DELETE_MARK: case MLOG_COMP_REC_SEC_DELETE_MARK:
if (NULL != (ptr = mlog_parse_index(ptr, end_ptr, /* This log record type is obsolete, but we process it for
type == MLOG_COMP_REC_SEC_DELETE_MARK, &index))) { backward compatibility with MySQL 5.0.3 and 5.0.4. */
ptr = btr_cur_parse_del_mark_set_sec_rec(ptr, end_ptr, ut_a(!page || page_is_comp(page));
index, page); ptr = mlog_parse_index(ptr, end_ptr, TRUE, &index);
if (!ptr) {
break;
} }
/* Fall through */
case MLOG_REC_SEC_DELETE_MARK:
ptr = btr_cur_parse_del_mark_set_sec_rec(ptr, end_ptr, page);
break; break;
case MLOG_REC_UPDATE_IN_PLACE: case MLOG_COMP_REC_UPDATE_IN_PLACE: case MLOG_REC_UPDATE_IN_PLACE: case MLOG_COMP_REC_UPDATE_IN_PLACE:
if (NULL != (ptr = mlog_parse_index(ptr, end_ptr, if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
type == MLOG_COMP_REC_UPDATE_IN_PLACE, &index))) { type == MLOG_COMP_REC_UPDATE_IN_PLACE, &index))) {
ut_a(!page||!!page_is_comp(page)==index->table->comp);
ptr = btr_cur_parse_update_in_place(ptr, end_ptr, ptr = btr_cur_parse_update_in_place(ptr, end_ptr,
page, index); page, index);
} }
...@@ -795,6 +806,7 @@ recv_parse_or_apply_log_rec_body( ...@@ -795,6 +806,7 @@ recv_parse_or_apply_log_rec_body(
if (NULL != (ptr = mlog_parse_index(ptr, end_ptr, if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
type == MLOG_COMP_LIST_END_DELETE type == MLOG_COMP_LIST_END_DELETE
|| type == MLOG_COMP_LIST_START_DELETE, &index))) { || type == MLOG_COMP_LIST_START_DELETE, &index))) {
ut_a(!page||!!page_is_comp(page)==index->table->comp);
ptr = page_parse_delete_rec_list(type, ptr, end_ptr, ptr = page_parse_delete_rec_list(type, ptr, end_ptr,
index, page, mtr); index, page, mtr);
} }
...@@ -802,6 +814,7 @@ recv_parse_or_apply_log_rec_body( ...@@ -802,6 +814,7 @@ recv_parse_or_apply_log_rec_body(
case MLOG_LIST_END_COPY_CREATED: case MLOG_COMP_LIST_END_COPY_CREATED: case MLOG_LIST_END_COPY_CREATED: case MLOG_COMP_LIST_END_COPY_CREATED:
if (NULL != (ptr = mlog_parse_index(ptr, end_ptr, if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
type == MLOG_COMP_LIST_END_COPY_CREATED, &index))) { type == MLOG_COMP_LIST_END_COPY_CREATED, &index))) {
ut_a(!page||!!page_is_comp(page)==index->table->comp);
ptr = page_parse_copy_rec_list_to_created_page(ptr, ptr = page_parse_copy_rec_list_to_created_page(ptr,
end_ptr, index, page, mtr); end_ptr, index, page, mtr);
} }
...@@ -809,6 +822,7 @@ recv_parse_or_apply_log_rec_body( ...@@ -809,6 +822,7 @@ recv_parse_or_apply_log_rec_body(
case MLOG_PAGE_REORGANIZE: case MLOG_COMP_PAGE_REORGANIZE: case MLOG_PAGE_REORGANIZE: case MLOG_COMP_PAGE_REORGANIZE:
if (NULL != (ptr = mlog_parse_index(ptr, end_ptr, if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
type == MLOG_COMP_PAGE_REORGANIZE, &index))) { type == MLOG_COMP_PAGE_REORGANIZE, &index))) {
ut_a(!page||!!page_is_comp(page)==index->table->comp);
ptr = btr_parse_page_reorganize(ptr, end_ptr, index, ptr = btr_parse_page_reorganize(ptr, end_ptr, index,
page, mtr); page, mtr);
} }
...@@ -841,6 +855,7 @@ recv_parse_or_apply_log_rec_body( ...@@ -841,6 +855,7 @@ recv_parse_or_apply_log_rec_body(
case MLOG_REC_DELETE: case MLOG_COMP_REC_DELETE: case MLOG_REC_DELETE: case MLOG_COMP_REC_DELETE:
if (NULL != (ptr = mlog_parse_index(ptr, end_ptr, if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
type == MLOG_COMP_REC_DELETE, &index))) { type == MLOG_COMP_REC_DELETE, &index))) {
ut_a(!page||!!page_is_comp(page)==index->table->comp);
ptr = page_cur_parse_delete_rec(ptr, end_ptr, ptr = page_cur_parse_delete_rec(ptr, end_ptr,
index, page, mtr); index, page, mtr);
} }
...@@ -1186,6 +1201,7 @@ recv_recover_page( ...@@ -1186,6 +1201,7 @@ recv_recover_page(
start_lsn = recv->start_lsn; start_lsn = recv->start_lsn;
} }
#ifdef UNIV_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Applying log rec type %lu len %lu to space %lu page no %lu\n", "InnoDB: Applying log rec type %lu len %lu to space %lu page no %lu\n",
...@@ -1193,6 +1209,7 @@ recv_recover_page( ...@@ -1193,6 +1209,7 @@ recv_recover_page(
(ulong) recv_addr->space, (ulong) recv_addr->space,
(ulong) recv_addr->page_no); (ulong) recv_addr->page_no);
} }
#endif /* UNIV_DEBUG */
recv_parse_or_apply_log_rec_body(recv->type, buf, recv_parse_or_apply_log_rec_body(recv->type, buf,
buf + recv->len, page, &mtr); buf + recv->len, page, &mtr);
...@@ -1801,25 +1818,25 @@ recv_parse_log_rec( ...@@ -1801,25 +1818,25 @@ recv_parse_log_rec(
new_ptr = mlog_parse_initial_log_record(ptr, end_ptr, type, space, new_ptr = mlog_parse_initial_log_record(ptr, end_ptr, type, space,
page_no); page_no);
if (!new_ptr) { *body = new_ptr;
if (UNIV_UNLIKELY(!new_ptr)) {
return(0); return(0);
} }
/* Check that page_no is sensible */ /* Check that page_no is sensible */
if (*page_no > 0x8FFFFFFFUL) { if (UNIV_UNLIKELY(*page_no > 0x8FFFFFFFUL)) {
recv_sys->found_corrupt_log = TRUE; recv_sys->found_corrupt_log = TRUE;
return(0); return(0);
} }
*body = new_ptr;
new_ptr = recv_parse_or_apply_log_rec_body(*type, new_ptr, end_ptr, new_ptr = recv_parse_or_apply_log_rec_body(*type, new_ptr, end_ptr,
NULL, NULL); NULL, NULL);
if (new_ptr == NULL) { if (UNIV_UNLIKELY(new_ptr == NULL)) {
return(0); return(0);
} }
...@@ -2013,12 +2030,14 @@ loop: ...@@ -2013,12 +2030,14 @@ loop:
recv_sys->recovered_offset += len; recv_sys->recovered_offset += len;
recv_sys->recovered_lsn = new_recovered_lsn; recv_sys->recovered_lsn = new_recovered_lsn;
#ifdef UNIV_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Parsed a single log rec type %lu len %lu space %lu page no %lu\n", "InnoDB: Parsed a single log rec type %lu len %lu space %lu page no %lu\n",
(ulong) type, (ulong) len, (ulong) space, (ulong) type, (ulong) len, (ulong) space,
(ulong) page_no); (ulong) page_no);
} }
#endif /* UNIV_DEBUG */
if (type == MLOG_DUMMY_RECORD) { if (type == MLOG_DUMMY_RECORD) {
/* Do nothing */ /* Do nothing */
...@@ -2101,13 +2120,15 @@ loop: ...@@ -2101,13 +2120,15 @@ loop:
body, ptr + len); body, ptr + len);
#endif /* UNIV_LOG_REPLICATE */ #endif /* UNIV_LOG_REPLICATE */
} }
#ifdef UNIV_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Parsed a multi log rec type %lu len %lu space %lu page no %lu\n", "InnoDB: Parsed a multi log rec type %lu len %lu space %lu page no %lu\n",
(ulong) type, (ulong) len, (ulong) space, (ulong) type, (ulong) len, (ulong) space,
(ulong) page_no); (ulong) page_no);
} }
#endif /* UNIV_DEBUG */
total_len += len; total_len += len;
n_recs++; n_recs++;
...@@ -2514,6 +2535,7 @@ recv_group_scan_log_recs( ...@@ -2514,6 +2535,7 @@ recv_group_scan_log_recs(
start_lsn = end_lsn; start_lsn = end_lsn;
} }
#ifdef UNIV_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Scanned group %lu up to log sequence number %lu %lu\n", "InnoDB: Scanned group %lu up to log sequence number %lu %lu\n",
...@@ -2521,6 +2543,7 @@ recv_group_scan_log_recs( ...@@ -2521,6 +2543,7 @@ recv_group_scan_log_recs(
(ulong) ut_dulint_get_high(*group_scanned_lsn), (ulong) ut_dulint_get_high(*group_scanned_lsn),
(ulong) ut_dulint_get_low(*group_scanned_lsn)); (ulong) ut_dulint_get_low(*group_scanned_lsn));
} }
#endif /* UNIV_DEBUG */
} }
/************************************************************ /************************************************************
...@@ -2906,10 +2929,12 @@ recv_recovery_from_checkpoint_finish(void) ...@@ -2906,10 +2929,12 @@ recv_recovery_from_checkpoint_finish(void)
recv_apply_hashed_log_recs(TRUE); recv_apply_hashed_log_recs(TRUE);
} }
#ifdef UNIV_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Log records applied to the database\n"); "InnoDB: Log records applied to the database\n");
} }
#endif /* UNIV_DEBUG */
if (recv_needed_recovery) { if (recv_needed_recovery) {
trx_sys_print_mysql_master_log_pos(); trx_sys_print_mysql_master_log_pos();
...@@ -3246,6 +3271,7 @@ ask_again: ...@@ -3246,6 +3271,7 @@ ask_again:
break; break;
} }
#ifdef UNIV_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Archive read starting at lsn %lu %lu, len %lu from file %s\n", "InnoDB: Archive read starting at lsn %lu %lu, len %lu from file %s\n",
...@@ -3253,6 +3279,7 @@ ask_again: ...@@ -3253,6 +3279,7 @@ ask_again:
(ulong) ut_dulint_get_low(start_lsn), (ulong) ut_dulint_get_low(start_lsn),
(ulong) len, name); (ulong) len, name);
} }
#endif /* UNIV_DEBUG */
fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE, fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE,
group->archive_space_id, read_offset / UNIV_PAGE_SIZE, group->archive_space_id, read_offset / UNIV_PAGE_SIZE,
......
...@@ -15,6 +15,7 @@ Created 12/7/1995 Heikki Tuuri ...@@ -15,6 +15,7 @@ Created 12/7/1995 Heikki Tuuri
#include "buf0buf.h" #include "buf0buf.h"
#include "dict0boot.h" #include "dict0boot.h"
#include "log0recv.h" #include "log0recv.h"
#include "page0page.h"
/************************************************************ /************************************************************
Catenates n bytes to the mtr log. */ Catenates n bytes to the mtr log. */
...@@ -22,9 +23,9 @@ Catenates n bytes to the mtr log. */ ...@@ -22,9 +23,9 @@ Catenates n bytes to the mtr log. */
void void
mlog_catenate_string( mlog_catenate_string(
/*=================*/ /*=================*/
mtr_t* mtr, /* in: mtr */ mtr_t* mtr, /* in: mtr */
byte* str, /* in: string to write */ const byte* str, /* in: string to write */
ulint len) /* in: string length */ ulint len) /* in: string length */
{ {
dyn_array_t* mlog; dyn_array_t* mlog;
...@@ -301,14 +302,15 @@ corresponding log record to the mini-transaction log. */ ...@@ -301,14 +302,15 @@ corresponding log record to the mini-transaction log. */
void void
mlog_write_string( mlog_write_string(
/*==============*/ /*==============*/
byte* ptr, /* in: pointer where to write */ byte* ptr, /* in: pointer where to write */
byte* str, /* in: string to write */ const byte* str, /* in: string to write */
ulint len, /* in: string length */ ulint len, /* in: string length */
mtr_t* mtr) /* in: mini-transaction handle */ mtr_t* mtr) /* in: mini-transaction handle */
{ {
byte* log_ptr; byte* log_ptr;
if (ptr < buf_pool->frame_zero || ptr >= buf_pool->high_end) { if (UNIV_UNLIKELY(ptr < buf_pool->frame_zero)
|| UNIV_UNLIKELY(ptr >= buf_pool->high_end)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: trying to write to a stray memory location %p\n", ptr); "InnoDB: Error: trying to write to a stray memory location %p\n", ptr);
ut_error; ut_error;
...@@ -405,7 +407,9 @@ mlog_open_and_write_index( ...@@ -405,7 +407,9 @@ mlog_open_and_write_index(
const byte* log_start; const byte* log_start;
const byte* log_end; const byte* log_end;
if (!index->table->comp) { ut_ad(!!page_rec_is_comp(rec) == index->table->comp);
if (!page_rec_is_comp(rec)) {
log_start = log_ptr = mlog_open(mtr, 11 + size); log_start = log_ptr = mlog_open(mtr, 11 + size);
if (!log_ptr) { if (!log_ptr) {
return(NULL); /* logging is disabled */ return(NULL); /* logging is disabled */
...@@ -498,6 +502,8 @@ mlog_parse_index( ...@@ -498,6 +502,8 @@ mlog_parse_index(
dict_table_t* table; dict_table_t* table;
dict_index_t* ind; dict_index_t* ind;
ut_ad(comp == FALSE || comp == TRUE);
if (comp) { if (comp) {
if (end_ptr < ptr + 4) { if (end_ptr < ptr + 4) {
return(NULL); return(NULL);
......
...@@ -48,16 +48,11 @@ mtr_memo_slot_release( ...@@ -48,16 +48,11 @@ mtr_memo_slot_release(
object = slot->object; object = slot->object;
type = slot->type; type = slot->type;
if (object != NULL) { if (UNIV_LIKELY(object != NULL)) {
if (type <= MTR_MEMO_BUF_FIX) { if (type <= MTR_MEMO_BUF_FIX) {
buf_page_release((buf_block_t*)object, type, mtr); buf_page_release((buf_block_t*)object, type, mtr);
} else if (type == MTR_MEMO_S_LOCK) { } else if (type == MTR_MEMO_S_LOCK) {
rw_lock_s_unlock((rw_lock_t*)object); rw_lock_s_unlock((rw_lock_t*)object);
#ifndef UNIV_DEBUG
} else {
rw_lock_x_unlock((rw_lock_t*)object);
}
#endif
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
} else if (type == MTR_MEMO_X_LOCK) { } else if (type == MTR_MEMO_X_LOCK) {
rw_lock_x_unlock((rw_lock_t*)object); rw_lock_x_unlock((rw_lock_t*)object);
...@@ -65,8 +60,11 @@ mtr_memo_slot_release( ...@@ -65,8 +60,11 @@ mtr_memo_slot_release(
ut_ad(type == MTR_MEMO_MODIFY); ut_ad(type == MTR_MEMO_MODIFY);
ut_ad(mtr_memo_contains(mtr, object, ut_ad(mtr_memo_contains(mtr, object,
MTR_MEMO_PAGE_X_FIX)); MTR_MEMO_PAGE_X_FIX));
} #else
} else {
rw_lock_x_unlock((rw_lock_t*)object);
#endif #endif
}
} }
slot->object = NULL; slot->object = NULL;
......
...@@ -83,7 +83,7 @@ struct os_aio_slot_struct{ ...@@ -83,7 +83,7 @@ struct os_aio_slot_struct{
made and only the slot message made and only the slot message
needs to be passed to the caller needs to be passed to the caller
of os_aio_simulated_handle */ of os_aio_simulated_handle */
void* message1; /* message which is given by the */ fil_node_t* message1; /* message which is given by the */
void* message2; /* the requester of an aio operation void* message2; /* the requester of an aio operation
and which can be used to identify and which can be used to identify
which pending aio operation was which pending aio operation was
...@@ -133,17 +133,17 @@ os_event_t* os_aio_segment_wait_events = NULL; ...@@ -133,17 +133,17 @@ os_event_t* os_aio_segment_wait_events = NULL;
/* The aio arrays for non-ibuf i/o and ibuf i/o, as well as sync aio. These /* The aio arrays for non-ibuf i/o and ibuf i/o, as well as sync aio. These
are NULL when the module has not yet been initialized. */ are NULL when the module has not yet been initialized. */
os_aio_array_t* os_aio_read_array = NULL; static os_aio_array_t* os_aio_read_array = NULL;
os_aio_array_t* os_aio_write_array = NULL; static os_aio_array_t* os_aio_write_array = NULL;
os_aio_array_t* os_aio_ibuf_array = NULL; static os_aio_array_t* os_aio_ibuf_array = NULL;
os_aio_array_t* os_aio_log_array = NULL; static os_aio_array_t* os_aio_log_array = NULL;
os_aio_array_t* os_aio_sync_array = NULL; static os_aio_array_t* os_aio_sync_array = NULL;
ulint os_aio_n_segments = ULINT_UNDEFINED; static ulint os_aio_n_segments = ULINT_UNDEFINED;
/* If the following is TRUE, read i/o handler threads try to /* If the following is TRUE, read i/o handler threads try to
wait until a batch of new read requests have been posted */ wait until a batch of new read requests have been posted */
ibool os_aio_recommend_sleep_for_read_threads = FALSE; static ibool os_aio_recommend_sleep_for_read_threads = FALSE;
ulint os_n_file_reads = 0; ulint os_n_file_reads = 0;
ulint os_bytes_read_since_printout = 0; ulint os_bytes_read_since_printout = 0;
...@@ -158,7 +158,7 @@ ibool os_has_said_disk_full = FALSE; ...@@ -158,7 +158,7 @@ ibool os_has_said_disk_full = FALSE;
/* The mutex protecting the following counts of pending pread and pwrite /* The mutex protecting the following counts of pending pread and pwrite
operations */ operations */
os_mutex_t os_file_count_mutex; static os_mutex_t os_file_count_mutex;
ulint os_file_n_pending_preads = 0; ulint os_file_n_pending_preads = 0;
ulint os_file_n_pending_pwrites = 0; ulint os_file_n_pending_pwrites = 0;
...@@ -3025,7 +3025,7 @@ os_aio_array_reserve_slot( ...@@ -3025,7 +3025,7 @@ os_aio_array_reserve_slot(
/* out: pointer to slot */ /* out: pointer to slot */
ulint type, /* in: OS_FILE_READ or OS_FILE_WRITE */ ulint type, /* in: OS_FILE_READ or OS_FILE_WRITE */
os_aio_array_t* array, /* in: aio array */ os_aio_array_t* array, /* in: aio array */
void* message1,/* in: message to be passed along with fil_node_t* message1,/* in: message to be passed along with
the aio operation */ the aio operation */
void* message2,/* in: message to be passed along with void* message2,/* in: message to be passed along with
the aio operation */ the aio operation */
...@@ -3287,7 +3287,7 @@ os_aio( ...@@ -3287,7 +3287,7 @@ os_aio(
ulint offset_high, /* in: most significant 32 bits of ulint offset_high, /* in: most significant 32 bits of
offset */ offset */
ulint n, /* in: number of bytes to read or write */ ulint n, /* in: number of bytes to read or write */
void* message1,/* in: messages for the aio handler (these fil_node_t* message1,/* in: messages for the aio handler (these
can be used to identify a completed aio can be used to identify a completed aio
operation); if mode is OS_AIO_SYNC, these operation); if mode is OS_AIO_SYNC, these
are ignored */ are ignored */
...@@ -3472,7 +3472,7 @@ os_aio_windows_handle( ...@@ -3472,7 +3472,7 @@ os_aio_windows_handle(
ignored */ ignored */
ulint pos, /* this parameter is used only in sync aio: ulint pos, /* this parameter is used only in sync aio:
wait for the aio slot at this position */ wait for the aio slot at this position */
void** message1, /* out: the messages passed with the aio fil_node_t**message1, /* out: the messages passed with the aio
request; note that also in the case where request; note that also in the case where
the aio operation failed, these output the aio operation failed, these output
parameters are valid and can be used to parameters are valid and can be used to
...@@ -3563,7 +3563,7 @@ os_aio_posix_handle( ...@@ -3563,7 +3563,7 @@ os_aio_posix_handle(
/*================*/ /*================*/
/* out: TRUE if the aio operation succeeded */ /* out: TRUE if the aio operation succeeded */
ulint array_no, /* in: array number 0 - 3 */ ulint array_no, /* in: array number 0 - 3 */
void** message1, /* out: the messages passed with the aio fil_node_t**message1, /* out: the messages passed with the aio
request; note that also in the case where request; note that also in the case where
the aio operation failed, these output the aio operation failed, these output
parameters are valid and can be used to parameters are valid and can be used to
...@@ -3644,7 +3644,7 @@ os_aio_simulated_handle( ...@@ -3644,7 +3644,7 @@ os_aio_simulated_handle(
i/o thread, segment 1 the log i/o thread, i/o thread, segment 1 the log i/o thread,
then follow the non-ibuf read threads, and as then follow the non-ibuf read threads, and as
the last are the non-ibuf write threads */ the last are the non-ibuf write threads */
void** message1, /* out: the messages passed with the aio fil_node_t**message1, /* out: the messages passed with the aio
request; note that also in the case where request; note that also in the case where
the aio operation failed, these output the aio operation failed, these output
parameters are valid and can be used to parameters are valid and can be used to
...@@ -4182,6 +4182,7 @@ os_aio_refresh_stats(void) ...@@ -4182,6 +4182,7 @@ os_aio_refresh_stats(void)
os_last_printout = time(NULL); os_last_printout = time(NULL);
} }
#ifdef UNIV_DEBUG
/************************************************************************** /**************************************************************************
Checks that all slots in the system have been freed, that is, there are Checks that all slots in the system have been freed, that is, there are
no pending io operations. */ no pending io operations. */
...@@ -4241,3 +4242,4 @@ os_aio_all_slots_free(void) ...@@ -4241,3 +4242,4 @@ os_aio_all_slots_free(void)
return(FALSE); return(FALSE);
} }
#endif /* UNIV_DEBUG */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -126,7 +126,7 @@ row_purge_remove_clust_if_poss_low( ...@@ -126,7 +126,7 @@ row_purge_remove_clust_if_poss_low(
if (0 != ut_dulint_cmp(node->roll_ptr, if (0 != ut_dulint_cmp(node->roll_ptr,
row_get_rec_roll_ptr(rec, index, rec_get_offsets( row_get_rec_roll_ptr(rec, index, rec_get_offsets(
rec, index, offsets_, ULINT_UNDEFINED, &heap)))) { rec, index, offsets_, ULINT_UNDEFINED, &heap)))) {
if (heap) { if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap); mem_heap_free(heap);
} }
/* Someone else has modified the record later: do not remove */ /* Someone else has modified the record later: do not remove */
...@@ -135,7 +135,7 @@ row_purge_remove_clust_if_poss_low( ...@@ -135,7 +135,7 @@ row_purge_remove_clust_if_poss_low(
return(TRUE); return(TRUE);
} }
if (heap) { if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap); mem_heap_free(heap);
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -190,7 +190,7 @@ row_undo_search_clust_to_pcur( ...@@ -190,7 +190,7 @@ row_undo_search_clust_to_pcur(
btr_pcur_commit_specify_mtr(&(node->pcur), &mtr); btr_pcur_commit_specify_mtr(&(node->pcur), &mtr);
if (heap) { if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap); mem_heap_free(heap);
} }
return(ret); return(ret);
......
This diff is collapsed.
This diff is collapsed.
...@@ -1040,7 +1040,9 @@ innobase_start_or_create_for_mysql(void) ...@@ -1040,7 +1040,9 @@ innobase_start_or_create_for_mysql(void)
srv_start_has_been_called = TRUE; srv_start_has_been_called = TRUE;
#ifdef UNIV_DEBUG
log_do_write = TRUE; log_do_write = TRUE;
#endif /* UNIV_DEBUG */
/* yydebug = TRUE; */ /* yydebug = TRUE; */
srv_is_being_started = TRUE; srv_is_being_started = TRUE;
...@@ -1554,8 +1556,9 @@ NetWare. */ ...@@ -1554,8 +1556,9 @@ NetWare. */
os_thread_create(&srv_master_thread, NULL, thread_ids + 1 + os_thread_create(&srv_master_thread, NULL, thread_ids + 1 +
SRV_MAX_N_IO_THREADS); SRV_MAX_N_IO_THREADS);
#ifdef UNIV_DEBUG
/* buf_debug_prints = TRUE; */ /* buf_debug_prints = TRUE; */
#endif /* UNIV_DEBUG */
sum_of_data_file_sizes = 0; sum_of_data_file_sizes = 0;
for (i = 0; i < srv_n_data_files; i++) { for (i = 0; i < srv_n_data_files; i++) {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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