From e2a3bb5acc3a75e4aa4e382eb048db728eae7cdd Mon Sep 17 00:00:00 2001 From: Inaam Rana Date: Mon, 26 Apr 2010 23:24:45 -0400 Subject: [PATCH] buf_flush_list() should return failure if one of the buffer pool was skipped because another flush batch was active. This is to ensure that the when we return success then it is guaranteed that all pages up to the lsn_limit have been flushed to the disk. --- storage/innobase/buf/buf0flu.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c index bb126a35867..4d5566d79c0 100644 --- a/storage/innobase/buf/buf0flu.c +++ b/storage/innobase/buf/buf0flu.c @@ -1748,6 +1748,7 @@ buf_flush_list( { ulint i; ulint total_page_count = 0; + ibool skipped = FALSE; if (min_n != ULINT_MAX) { /* Ensure that flushing is spread evenly amongst the @@ -1758,10 +1759,6 @@ buf_flush_list( / srv_buf_pool_instances; } - /* We use buffer pool instance 0 to control start and end of - flushing of the flush list since we always flush all instances - at once in this case. */ - /* Flush to lsn_limit in all buffer pool instances */ for (i = 0; i < srv_buf_pool_instances; i++) { buf_pool_t* buf_pool; @@ -1770,6 +1767,18 @@ buf_flush_list( buf_pool = buf_pool_from_array(i); if (!buf_flush_start(buf_pool, BUF_FLUSH_LIST)) { + /* We have two choices here. If lsn_limit was + specified then skipping an instance of buffer + pool means we cannot guarantee that all pages + up to lsn_limit has been flushed. We can + return right now with failure or we can try + to flush remaining buffer pools up to the + lsn_limit. We attempt to flush other buffer + pools based on the assumption that it will + help in the retry which will follow the + failure. */ + skipped = TRUE; + continue; } @@ -1783,7 +1792,8 @@ buf_flush_list( total_page_count += page_count; } - return(total_page_count); + return(lsn_limit != IB_ULONGLONG_MAX && skipped + ? ULINT_UNDEFINED : total_page_count); } /******************************************************************//**