summaryrefslogtreecommitdiff
path: root/innobase/buf
diff options
context:
space:
mode:
authormonty@donna.mysql.fi <>2001-10-30 17:38:44 +0200
committermonty@donna.mysql.fi <>2001-10-30 17:38:44 +0200
commit7fcbd7e3da3920a7e4d5c1a2b4c4f824fffe33ef (patch)
tree097886eb981160413975cb915243d4ae60718154 /innobase/buf
parentd4dd3b09b8917fcc8233d8f43bfbf5ab4b98cc8b (diff)
downloadmariadb-git-7fcbd7e3da3920a7e4d5c1a2b4c4f824fffe33ef.tar.gz
Merge
Diffstat (limited to 'innobase/buf')
-rw-r--r--innobase/buf/buf0flu.c11
-rw-r--r--innobase/buf/buf0lru.c67
2 files changed, 50 insertions, 28 deletions
diff --git a/innobase/buf/buf0flu.c b/innobase/buf/buf0flu.c
index 25c74f21fd3..4217a3ba99b 100644
--- a/innobase/buf/buf0flu.c
+++ b/innobase/buf/buf0flu.c
@@ -410,9 +410,9 @@ buf_flush_try_page(
block->io_fix = BUF_IO_WRITE;
block->flush_type = flush_type;
- if (buf_pool->n_flush[block->flush_type] == 0) {
+ if (buf_pool->n_flush[flush_type] == 0) {
- os_event_reset(buf_pool->no_flush[block->flush_type]);
+ os_event_reset(buf_pool->no_flush[flush_type]);
}
(buf_pool->n_flush[flush_type])++;
@@ -460,6 +460,11 @@ buf_flush_try_page(
block->io_fix = BUF_IO_WRITE;
block->flush_type = flush_type;
+ if (buf_pool->n_flush[flush_type] == 0) {
+
+ os_event_reset(buf_pool->no_flush[flush_type]);
+ }
+
(buf_pool->n_flush[flush_type])++;
rw_lock_s_lock_gen(&(block->lock), BUF_IO_WRITE);
@@ -609,7 +614,7 @@ buf_flush_batch(
ut_ad((flush_type == BUF_FLUSH_LRU) || (flush_type == BUF_FLUSH_LIST));
ut_ad((flush_type != BUF_FLUSH_LIST) ||
sync_thread_levels_empty_gen(TRUE));
-
+
mutex_enter(&(buf_pool->mutex));
if ((buf_pool->n_flush[flush_type] > 0)
diff --git a/innobase/buf/buf0lru.c b/innobase/buf/buf0lru.c
index eb63fa99f4a..82777e4ef2f 100644
--- a/innobase/buf/buf0lru.c
+++ b/innobase/buf/buf0lru.c
@@ -107,20 +107,15 @@ buf_LRU_search_and_free_block(
means that we should search farther */
{
buf_block_t* block;
- ulint distance;
ibool freed;
- ulint i;
mutex_enter(&(buf_pool->mutex));
freed = FALSE;
- distance = BUF_LRU_FREE_SEARCH_LEN * (1 + n_iterations / 5);
-
- i = 0;
block = UT_LIST_GET_LAST(buf_pool->LRU);
- while (i < distance && block != NULL) {
+ while (block != NULL) {
if (buf_flush_ready_for_replace(block)) {
@@ -203,6 +198,8 @@ buf_LRU_get_free_block(void)
buf_block_t* block = NULL;
ibool freed;
ulint n_iterations = 0;
+ ibool mon_value_was;
+ ibool started_monitor = FALSE;
loop:
mutex_enter(&(buf_pool->mutex));
@@ -222,7 +219,11 @@ loop:
block->state = BUF_BLOCK_READY_FOR_USE;
mutex_exit(&(buf_pool->mutex));
-
+
+ if (started_monitor) {
+ srv_print_innodb_monitor = mon_value_was;
+ }
+
return(block);
}
@@ -237,14 +238,41 @@ loop:
goto loop;
}
- /* No free block was found near the end of the list: try to flush
- the LRU list */
-
- buf_flush_free_margin();
+ if (n_iterations > 30) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " ***********************************************\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);
+ fprintf(stderr,
+ "InnoDB: It is also possible that in your Unix version\n"
+ "InnoDB: fsync is very slow, or completely frozen inside\n"
+ "InnoDB: the OS kernel. Then upgrading to a newer version\n"
+ "InnoDB: of your operating system may help. Look at the\n"
+ "InnoDB: number of fsyncs in diagnostic info below.\n");
+
+ fprintf(stderr,
+ "InnoDB: Pending flushes (fsync) log: %lu; buffer pool: %lu\n",
+ fil_n_pending_log_flushes,
+ fil_n_pending_tablespace_flushes);
+ fprintf(stderr,
+ "InnoDB: %lu OS file reads, %lu OS file writes, %lu OS fsyncs\n",
+ os_n_file_reads, os_n_file_writes, os_n_fsyncs);
+
+ fprintf(stderr,
+ "InnoDB: Starting InnoDB Monitor to print further\n"
+ "InnoDB: diagnostics to the standard output.\n");
+
+ mon_value_was = srv_print_innodb_monitor;
+ started_monitor = TRUE;
+ srv_print_innodb_monitor = TRUE;
+ }
- os_event_wait(buf_pool->no_flush[BUF_FLUSH_LRU]);
+ /* No free block was found: try to flush the LRU list */
- n_iterations++;
+ buf_flush_free_margin();
os_aio_simulated_wake_handler_threads();
@@ -253,18 +281,7 @@ loop:
os_thread_sleep(500000);
}
- if (n_iterations > 20) {
-/* buf_print();
- os_aio_print();
- rw_lock_list_print_info();
-*/
- if (n_iterations > 30) {
- fprintf(stderr,
- "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);
- }
- }
+ n_iterations++;
goto loop;
}