Skip to content

Commit 489b556

Browse files
committed
MDEV-30422 Merge new release of InnoDB 5.7.41 to 10.3
MySQL 5.7.41 includes one InnoDB change mysql/mysql-server@d2d6b2d that seems to be applicable to MariaDB Server 10.3 and 10.4. Even though commit 5b9ee8d seems to have fixed sporadic failures on our CI systems, it is theoretically possible that another race condition remained. buf_flush_page_cleaner_coordinator(): In the final loop, wait also for buf_get_n_pending_read_ios() to reach 0. In this way, if a secondary index leaf page was read into the buffer pool and ibuf_merge_or_delete_for_page() modified that page or some change buffer pages, the flush loop would execute until the buffer pool really is in a clean state. This potential data corruption bug does not affect MariaDB Server 10.5 or later, thanks to commit b42294b which removed change buffer merges that are not explicitly requested.
1 parent 834650c commit 489b556

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

storage/innobase/buf/buf0flu.cc

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3324,20 +3324,27 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(void*)
33243324
bool success;
33253325

33263326
do {
3327+
/* In case an asynchronous read request was posted by
3328+
any thread (other than something invoking
3329+
ibuf_merge_in_background()), it is possible that the
3330+
change buffer will be merged to the page once the read
3331+
completes. To avoid race conditions and corruption due
3332+
to that, we will loop here until there are no pending
3333+
page read operations. */
3334+
success = !buf_get_n_pending_read_ios();
33273335
pc_request(ULINT_MAX, LSN_MAX);
33283336

33293337
while (pc_flush_slot() > 0) {}
33303338

33313339
ulint n_flushed_lru = 0;
33323340
ulint n_flushed_list = 0;
3333-
success = pc_wait_finished(&n_flushed_lru, &n_flushed_list);
3334-
3335-
n_flushed = n_flushed_lru + n_flushed_list;
3341+
success = pc_wait_finished(&n_flushed_lru, &n_flushed_list)
3342+
&& success && !n_flushed_lru && !n_flushed_list;
33363343

33373344
buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
33383345
buf_flush_wait_LRU_batch_end();
33393346

3340-
} while (!success || n_flushed > 0);
3347+
} while (!success);
33413348

33423349
/* Some sanity checks */
33433350
ut_a(srv_get_active_thread_type() == SRV_NONE);

0 commit comments

Comments
 (0)