Commit fbd72506 authored by heikki@donna.mysql.fi's avatar heikki@donna.mysql.fi

buf0buf.c Several bug fixes

buf0flu.c	Several bug fixes
buf0rea.c	Several bug fixes
buf0lru.c	Clearer error message
parent e9067935
......@@ -241,6 +241,8 @@ buf_block_init(
block->modify_clock = ut_dulint_zero;
block->file_page_was_freed = FALSE;
rw_lock_create(&(block->lock));
ut_ad(rw_lock_validate(&(block->lock)));
......@@ -542,6 +544,64 @@ buf_page_peek(
return(FALSE);
}
/************************************************************************
Sets file_page_was_freed TRUE if the page is found in the buffer pool.
This function should be called when we free a file page and want the
debug version to check that it is not accessed any more unless
reallocated. */
buf_block_t*
buf_page_set_file_page_was_freed(
/*=============================*/
/* out: control block if found from page hash table,
otherwise NULL */
ulint space, /* in: space id */
ulint offset) /* in: page number */
{
buf_block_t* block;
mutex_enter_fast(&(buf_pool->mutex));
block = buf_page_hash_get(space, offset);
if (block) {
block->file_page_was_freed = TRUE;
}
mutex_exit(&(buf_pool->mutex));
return(block);
}
/************************************************************************
Sets file_page_was_freed FALSE if the page is found in the buffer pool.
This function should be called when we free a file page and want the
debug version to check that it is not accessed any more unless
reallocated. */
buf_block_t*
buf_page_reset_file_page_was_freed(
/*===============================*/
/* out: control block if found from page hash table,
otherwise NULL */
ulint space, /* in: space id */
ulint offset) /* in: page number */
{
buf_block_t* block;
mutex_enter_fast(&(buf_pool->mutex));
block = buf_page_hash_get(space, offset);
if (block) {
block->file_page_was_freed = FALSE;
}
mutex_exit(&(buf_pool->mutex));
return(block);
}
/************************************************************************
This is the general function used to get access to a database page. */
......@@ -646,6 +706,9 @@ buf_page_get_gen(
block->accessed = TRUE;
#ifdef UNIV_DEBUG_FILE_ACCESSES
ut_a(block->file_page_was_freed == FALSE);
#endif
mutex_exit(&(buf_pool->mutex));
#ifdef UNIV_DEBUG
......@@ -842,6 +905,9 @@ buf_page_optimistic_get_func(
ut_ad(block->buf_fix_count > 0);
ut_ad(block->state == BUF_BLOCK_FILE_PAGE);
#ifdef UNIV_DEBUG_FILE_ACCESSES
ut_a(block->file_page_was_freed == FALSE);
#endif
if (!accessed) {
/* In the case of a first access, try to apply linear
read-ahead */
......@@ -949,6 +1015,9 @@ buf_page_get_known_nowait(
#endif
ut_ad(block->buf_fix_count > 0);
ut_ad(block->state == BUF_BLOCK_FILE_PAGE);
#ifdef UNIV_DEBUG_FILE_ACCESSES
ut_a(block->file_page_was_freed == FALSE);
#endif
#ifdef UNIV_IBUF_DEBUG
ut_a((mode == BUF_KEEP_OLD)
......@@ -996,6 +1065,8 @@ buf_page_init(
block->n_hash_helps = 0;
block->is_hashed = FALSE;
block->file_page_was_freed = FALSE;
}
/************************************************************************
......@@ -1126,6 +1197,8 @@ buf_page_create(
#ifdef UNIV_IBUF_DEBUG
ut_a(ibuf_count_get(block->space, block->offset) == 0);
#endif
block->file_page_was_freed = FALSE;
/* Page can be found in buf_pool */
mutex_exit(&(buf_pool->mutex));
......
......@@ -182,8 +182,8 @@ buf_flush_write_complete(
buf_pool->LRU_flush_ended++;
}
/* printf("n pending flush %lu\n",
buf_pool->n_flush[block->flush_type]); */
/* printf("n pending flush %lu\n",
buf_pool->n_flush[block->flush_type]); */
if ((buf_pool->n_flush[block->flush_type] == 0)
&& (buf_pool->init_flush[block->flush_type] == FALSE)) {
......@@ -421,6 +421,8 @@ buf_flush_try_neighbors(
/* In simulated aio we wake up the i/o-handler threads now that
we have posted a batch of writes: */
/* printf("Flush count %lu ; Waking i/o handlers\n", count); */
os_aio_simulated_wake_handler_threads();
return(count);
......
......@@ -260,9 +260,9 @@ buf_LRU_get_free_block(void)
*/
if (n_iterations > 30) {
fprintf(stderr,
"Innobase: Warning: difficult to find free blocks from\n"
"Innobase: the buffer pool! Consider increasing the\n"
"Innobase: buffer pool size.\n");
"InnoDB: Warning: difficult to find free blocks from\n"
"InnoDB: the buffer pool (%lu search iterations)! Consider\n"
"InnoDB: increasing the buffer pool size.\n", n_iterations);
}
}
......
......@@ -18,6 +18,7 @@ Created 11/5/1995 Heikki Tuuri
#include "log0recv.h"
#include "trx0sys.h"
#include "os0file.h"
#include "srv0start.h"
/* The size in blocks of the area where the random read-ahead algorithm counts
the accessed pages when deciding whether to read-ahead */
......@@ -132,10 +133,16 @@ buf_read_ahead_random(
ulint low, high;
ulint i;
if (ibuf_bitmap_page(offset)) {
if (srv_startup_is_before_trx_rollback_phase) {
/* No read-ahead to avoid thread deadlocks */
return(0);
}
if (ibuf_bitmap_page(offset) || trx_sys_hdr_page(space, offset)) {
/* If it is an ibuf bitmap page, we do no read-ahead, as
that could break the ibuf page access order */
/* If it is an ibuf bitmap page or trx sys hdr, we do
no read-ahead, as that could break the ibuf page access
order */
return(0);
}
......@@ -301,9 +308,16 @@ buf_read_ahead_linear(
ulint low, high;
ulint i;
if (ibuf_bitmap_page(offset)) {
/* If it is an ibuf bitmap page, we do no read-ahead, as
that could break the ibuf page access order */
if (srv_startup_is_before_trx_rollback_phase) {
/* No read-ahead to avoid thread deadlocks */
return(0);
}
if (ibuf_bitmap_page(offset) || trx_sys_hdr_page(space, offset)) {
/* If it is an ibuf bitmap page or trx sys hdr, we do
no read-ahead, as that could break the ibuf page access
order */
return(0);
}
......
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