Commit b6cb94ed 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 a1955cd2
......@@ -979,6 +979,7 @@ buf_flush_batch(
ulint old_page_count;
ulint space;
ulint offset;
ibool try_neighbors = TRUE;
ut_ad((flush_type == BUF_FLUSH_LRU)
|| (flush_type == BUF_FLUSH_LIST));
......@@ -986,6 +987,17 @@ buf_flush_batch(
ut_ad((flush_type != BUF_FLUSH_LIST)
|| sync_thread_levels_empty_gen(TRUE));
#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();
if ((buf_pool->n_flush[flush_type] > 0)
......@@ -1045,19 +1057,37 @@ flush_next:
if (ready) {
space = buf_page_get_space(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 */
/* 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 %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);
/* buf_pool and block mutexes are
released inside the following
function. */
buf_flush_page(bpage, flush_type);
++page_count;
}
buf_pool_mutex_enter();
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