mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
buf0buf.c Several bug fixes
buf0flu.c Several bug fixes buf0rea.c Several bug fixes buf0lru.c Clearer error message
This commit is contained in:
@ -241,6 +241,8 @@ buf_block_init(
|
|||||||
|
|
||||||
block->modify_clock = ut_dulint_zero;
|
block->modify_clock = ut_dulint_zero;
|
||||||
|
|
||||||
|
block->file_page_was_freed = FALSE;
|
||||||
|
|
||||||
rw_lock_create(&(block->lock));
|
rw_lock_create(&(block->lock));
|
||||||
ut_ad(rw_lock_validate(&(block->lock)));
|
ut_ad(rw_lock_validate(&(block->lock)));
|
||||||
|
|
||||||
@ -542,6 +544,64 @@ buf_page_peek(
|
|||||||
return(FALSE);
|
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. */
|
This is the general function used to get access to a database page. */
|
||||||
|
|
||||||
@ -646,6 +706,9 @@ loop:
|
|||||||
|
|
||||||
block->accessed = TRUE;
|
block->accessed = TRUE;
|
||||||
|
|
||||||
|
#ifdef UNIV_DEBUG_FILE_ACCESSES
|
||||||
|
ut_a(block->file_page_was_freed == FALSE);
|
||||||
|
#endif
|
||||||
mutex_exit(&(buf_pool->mutex));
|
mutex_exit(&(buf_pool->mutex));
|
||||||
|
|
||||||
#ifdef UNIV_DEBUG
|
#ifdef UNIV_DEBUG
|
||||||
@ -842,6 +905,9 @@ buf_page_optimistic_get_func(
|
|||||||
ut_ad(block->buf_fix_count > 0);
|
ut_ad(block->buf_fix_count > 0);
|
||||||
ut_ad(block->state == BUF_BLOCK_FILE_PAGE);
|
ut_ad(block->state == BUF_BLOCK_FILE_PAGE);
|
||||||
|
|
||||||
|
#ifdef UNIV_DEBUG_FILE_ACCESSES
|
||||||
|
ut_a(block->file_page_was_freed == FALSE);
|
||||||
|
#endif
|
||||||
if (!accessed) {
|
if (!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 */
|
||||||
@ -949,6 +1015,9 @@ buf_page_get_known_nowait(
|
|||||||
#endif
|
#endif
|
||||||
ut_ad(block->buf_fix_count > 0);
|
ut_ad(block->buf_fix_count > 0);
|
||||||
ut_ad(block->state == BUF_BLOCK_FILE_PAGE);
|
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
|
#ifdef UNIV_IBUF_DEBUG
|
||||||
ut_a((mode == BUF_KEEP_OLD)
|
ut_a((mode == BUF_KEEP_OLD)
|
||||||
@ -996,6 +1065,8 @@ buf_page_init(
|
|||||||
|
|
||||||
block->n_hash_helps = 0;
|
block->n_hash_helps = 0;
|
||||||
block->is_hashed = FALSE;
|
block->is_hashed = FALSE;
|
||||||
|
|
||||||
|
block->file_page_was_freed = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@ -1126,6 +1197,8 @@ buf_page_create(
|
|||||||
#ifdef UNIV_IBUF_DEBUG
|
#ifdef UNIV_IBUF_DEBUG
|
||||||
ut_a(ibuf_count_get(block->space, block->offset) == 0);
|
ut_a(ibuf_count_get(block->space, block->offset) == 0);
|
||||||
#endif
|
#endif
|
||||||
|
block->file_page_was_freed = FALSE;
|
||||||
|
|
||||||
/* Page can be found in buf_pool */
|
/* Page can be found in buf_pool */
|
||||||
mutex_exit(&(buf_pool->mutex));
|
mutex_exit(&(buf_pool->mutex));
|
||||||
|
|
||||||
|
@ -182,8 +182,8 @@ buf_flush_write_complete(
|
|||||||
buf_pool->LRU_flush_ended++;
|
buf_pool->LRU_flush_ended++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* printf("n pending flush %lu\n",
|
/* printf("n pending flush %lu\n",
|
||||||
buf_pool->n_flush[block->flush_type]); */
|
buf_pool->n_flush[block->flush_type]); */
|
||||||
|
|
||||||
if ((buf_pool->n_flush[block->flush_type] == 0)
|
if ((buf_pool->n_flush[block->flush_type] == 0)
|
||||||
&& (buf_pool->init_flush[block->flush_type] == FALSE)) {
|
&& (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
|
/* In simulated aio we wake up the i/o-handler threads now that
|
||||||
we have posted a batch of writes: */
|
we have posted a batch of writes: */
|
||||||
|
|
||||||
|
/* printf("Flush count %lu ; Waking i/o handlers\n", count); */
|
||||||
|
|
||||||
os_aio_simulated_wake_handler_threads();
|
os_aio_simulated_wake_handler_threads();
|
||||||
|
|
||||||
return(count);
|
return(count);
|
||||||
|
@ -260,9 +260,9 @@ loop:
|
|||||||
*/
|
*/
|
||||||
if (n_iterations > 30) {
|
if (n_iterations > 30) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Innobase: Warning: difficult to find free blocks from\n"
|
"InnoDB: Warning: difficult to find free blocks from\n"
|
||||||
"Innobase: the buffer pool! Consider increasing the\n"
|
"InnoDB: the buffer pool (%lu search iterations)! Consider\n"
|
||||||
"Innobase: buffer pool size.\n");
|
"InnoDB: increasing the buffer pool size.\n", n_iterations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ Created 11/5/1995 Heikki Tuuri
|
|||||||
#include "log0recv.h"
|
#include "log0recv.h"
|
||||||
#include "trx0sys.h"
|
#include "trx0sys.h"
|
||||||
#include "os0file.h"
|
#include "os0file.h"
|
||||||
|
#include "srv0start.h"
|
||||||
|
|
||||||
/* The size in blocks of the area where the random read-ahead algorithm counts
|
/* The size in blocks of the area where the random read-ahead algorithm counts
|
||||||
the accessed pages when deciding whether to read-ahead */
|
the accessed pages when deciding whether to read-ahead */
|
||||||
@ -132,10 +133,16 @@ buf_read_ahead_random(
|
|||||||
ulint low, high;
|
ulint low, high;
|
||||||
ulint i;
|
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 it is an ibuf bitmap page, we do no read-ahead, as
|
if (ibuf_bitmap_page(offset) || trx_sys_hdr_page(space, offset)) {
|
||||||
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);
|
return(0);
|
||||||
}
|
}
|
||||||
@ -301,9 +308,16 @@ buf_read_ahead_linear(
|
|||||||
ulint low, high;
|
ulint low, high;
|
||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
if (ibuf_bitmap_page(offset)) {
|
if (srv_startup_is_before_trx_rollback_phase) {
|
||||||
/* If it is an ibuf bitmap page, we do no read-ahead, as
|
/* No read-ahead to avoid thread deadlocks */
|
||||||
that could break the ibuf page access order */
|
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);
|
return(0);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user