Commit 449e6af3 authored by inaam's avatar inaam

branches/zip rb://138

The current implementation is to try to flush the neighbors of every
page that we flush. This patch makes the following distinction:

1) If the flush is from flush_list AND
2) If the flush is intended to move the oldest_modification LSN ahead
(this happens when a user thread sees little space in the log file and
attempts to flush pages from the buffer pool so that a checkpoint can
be made)

THEN

Do not try to flush the neighbors. Just focus on flushing dirty pages at
the end of flush_list

Approved by: Heikki
parent 46211114
...@@ -979,6 +979,7 @@ buf_flush_batch( ...@@ -979,6 +979,7 @@ buf_flush_batch(
ulint old_page_count; ulint old_page_count;
ulint space; ulint space;
ulint offset; ulint offset;
ibool try_neighbors = TRUE;
ut_ad((flush_type == BUF_FLUSH_LRU) ut_ad((flush_type == BUF_FLUSH_LRU)
|| (flush_type == BUF_FLUSH_LIST)); || (flush_type == BUF_FLUSH_LIST));
...@@ -986,6 +987,17 @@ buf_flush_batch( ...@@ -986,6 +987,17 @@ buf_flush_batch(
ut_ad((flush_type != BUF_FLUSH_LIST) ut_ad((flush_type != BUF_FLUSH_LIST)
|| sync_thread_levels_empty_gen(TRUE)); || sync_thread_levels_empty_gen(TRUE));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
/* If we are being asked to do a BUF_FLUSH_LIST flush and
min_n is ULINT_MAX and lsn_limit is provided then we are doing
this flush from within a query thread i.e.: not in background
and therefore we should not try to flush the neighbors and just
focus on getting the flushed LSN to the lsn_limit. */
if (flush_type == BUF_FLUSH_LIST && min_n == ULINT_MAX
&& lsn_limit != IB_ULONGLONG_MAX) {
try_neighbors = FALSE;
}
buf_pool_mutex_enter(); buf_pool_mutex_enter();
if ((buf_pool->n_flush[flush_type] > 0) if ((buf_pool->n_flush[flush_type] > 0)
...@@ -1045,18 +1057,36 @@ buf_flush_batch( ...@@ -1045,18 +1057,36 @@ buf_flush_batch(
if (ready) { if (ready) {
space = buf_page_get_space(bpage); space = buf_page_get_space(bpage);
offset = buf_page_get_page_no(bpage); offset = buf_page_get_page_no(bpage);
old_page_count = page_count;
buf_pool_mutex_exit(); if (try_neighbors) {
old_page_count = page_count; buf_pool_mutex_exit();
/* Try to flush also all the
neighbors */
page_count += buf_flush_try_neighbors(
space, offset, flush_type);
/* fprintf(stderr,
"Flush type %lu, page no %lu,"
" neighb %lu\n",
flush_type, offset,
page_count - old_page_count); */
} else {
/* Just flush this page. */
mutex_enter(block_mutex);
ut_a(buf_page_in_file(bpage));
ut_ad(bpage->in_page_hash);
/* Try to flush also all the neighbors */ /* buf_pool and block mutexes are
page_count += buf_flush_try_neighbors( released inside the following
space, offset, flush_type); function. */
/* fprintf(stderr, buf_flush_page(bpage, flush_type);
"Flush type %lu, page no %lu, neighb %lu\n", ++page_count;
flush_type, offset, }
page_count - old_page_count); */
buf_pool_mutex_enter(); buf_pool_mutex_enter();
goto flush_next; goto flush_next;
......
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