Commit e2a3bb5a authored by Inaam Rana's avatar Inaam Rana

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.
parent 75d28784
...@@ -1748,6 +1748,7 @@ buf_flush_list( ...@@ -1748,6 +1748,7 @@ buf_flush_list(
{ {
ulint i; ulint i;
ulint total_page_count = 0; ulint total_page_count = 0;
ibool skipped = FALSE;
if (min_n != ULINT_MAX) { if (min_n != ULINT_MAX) {
/* Ensure that flushing is spread evenly amongst the /* Ensure that flushing is spread evenly amongst the
...@@ -1758,10 +1759,6 @@ buf_flush_list( ...@@ -1758,10 +1759,6 @@ buf_flush_list(
/ srv_buf_pool_instances; / 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 */ /* Flush to lsn_limit in all buffer pool instances */
for (i = 0; i < srv_buf_pool_instances; i++) { for (i = 0; i < srv_buf_pool_instances; i++) {
buf_pool_t* buf_pool; buf_pool_t* buf_pool;
...@@ -1770,6 +1767,18 @@ buf_flush_list( ...@@ -1770,6 +1767,18 @@ buf_flush_list(
buf_pool = buf_pool_from_array(i); buf_pool = buf_pool_from_array(i);
if (!buf_flush_start(buf_pool, BUF_FLUSH_LIST)) { 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; continue;
} }
...@@ -1783,7 +1792,8 @@ buf_flush_list( ...@@ -1783,7 +1792,8 @@ buf_flush_list(
total_page_count += page_count; total_page_count += page_count;
} }
return(total_page_count); return(lsn_limit != IB_ULONGLONG_MAX && skipped
? ULINT_UNDEFINED : total_page_count);
} }
/******************************************************************//** /******************************************************************//**
......
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