summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2023-01-17 18:03:58 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2023-01-17 18:03:58 +0200
commit2b3423c4622971048b09f68dbfb6833df4013397 (patch)
tree41940df2efa6e052953f1dae0464407dfef2c573
parent3e8b6a79b7169f1b0526169b5c752920e8babf44 (diff)
parent489b556947087f7606224d6fc09f302eabef14c8 (diff)
downloadmariadb-git-2b3423c4622971048b09f68dbfb6833df4013397.tar.gz
Merge 10.3 into 10.4
m---------libmariadb0
-rw-r--r--storage/innobase/buf/buf0flu.cc15
2 files changed, 11 insertions, 4 deletions
diff --git a/libmariadb b/libmariadb
-Subproject 7fdb3eab66384a355475704332d11cc1ab82499
+Subproject d204e83104222844251b221e9be7eb3dd9f8d63
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index 8f9486276f1..2287b57af28 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -3297,20 +3297,27 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(void*)
bool success;
do {
+ /* In case an asynchronous read request was posted by
+ any thread (other than something invoking
+ ibuf_merge_in_background()), it is possible that the
+ change buffer will be merged to the page once the read
+ completes. To avoid race conditions and corruption due
+ to that, we will loop here until there are no pending
+ page read operations. */
+ success = !buf_get_n_pending_read_ios();
pc_request(ULINT_MAX, LSN_MAX);
while (pc_flush_slot() > 0) {}
ulint n_flushed_lru = 0;
ulint n_flushed_list = 0;
- success = pc_wait_finished(&n_flushed_lru, &n_flushed_list);
-
- n_flushed = n_flushed_lru + n_flushed_list;
+ success = pc_wait_finished(&n_flushed_lru, &n_flushed_list)
+ && success && !n_flushed_lru && !n_flushed_list;
buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
buf_flush_wait_LRU_batch_end();
- } while (!success || n_flushed > 0);
+ } while (!success);
/* Some sanity checks */
ut_a(srv_get_active_thread_type() == SRV_NONE);