summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <heikki@donna.mysql.fi>2001-06-24 19:33:50 +0300
committerunknown <heikki@donna.mysql.fi>2001-06-24 19:33:50 +0300
commitecb14493f23019c7b59b78e2eaeb3ad168aaca77 (patch)
tree1f9c934b292fca9f4520646c2acdd86f29bc3bcb
parentf85d72e1feb5c36fe87568b4dd5b2533be3e56a1 (diff)
downloadmariadb-git-ecb14493f23019c7b59b78e2eaeb3ad168aaca77.tar.gz
buf0buf.c Several bug fixes
buf0flu.c Several bug fixes buf0rea.c Several bug fixes buf0lru.c Clearer error message innobase/buf/buf0lru.c: Clearer error message innobase/buf/buf0buf.c: Several bug fixes innobase/buf/buf0flu.c: Several bug fixes innobase/buf/buf0rea.c: Several bug fixes
-rw-r--r--innobase/buf/buf0buf.c73
-rw-r--r--innobase/buf/buf0flu.c6
-rw-r--r--innobase/buf/buf0lru.c6
-rw-r--r--innobase/buf/buf0rea.c26
4 files changed, 100 insertions, 11 deletions
diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c
index 0046a3761a6..ede9e621462 100644
--- a/innobase/buf/buf0buf.c
+++ b/innobase/buf/buf0buf.c
@@ -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)));
@@ -543,6 +545,64 @@ buf_page_peek(
}
/************************************************************************
+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. */
buf_frame_t*
@@ -646,6 +706,9 @@ loop:
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));
diff --git a/innobase/buf/buf0flu.c b/innobase/buf/buf0flu.c
index 90bdde1ebc6..7129b8d20a9 100644
--- a/innobase/buf/buf0flu.c
+++ b/innobase/buf/buf0flu.c
@@ -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);
diff --git a/innobase/buf/buf0lru.c b/innobase/buf/buf0lru.c
index 4626dc2757b..142beaaaa15 100644
--- a/innobase/buf/buf0lru.c
+++ b/innobase/buf/buf0lru.c
@@ -260,9 +260,9 @@ loop:
*/
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);
}
}
diff --git a/innobase/buf/buf0rea.c b/innobase/buf/buf0rea.c
index 644dd226a0e..728bf4404b8 100644
--- a/innobase/buf/buf0rea.c
+++ b/innobase/buf/buf0rea.c
@@ -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);
}