diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2023-04-21 17:52:47 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2023-04-21 17:52:47 +0300 |
commit | 40eff3f868108a202d88e4da339fc539cbf29e85 (patch) | |
tree | b08e75eb8e3c54cba8f0635cc2441baa5ca29e32 /storage/innobase | |
parent | e55e761eae707e47e86af1899335c777e194fdd2 (diff) | |
download | mariadb-git-40eff3f868108a202d88e4da339fc539cbf29e85.tar.gz |
MDEV-26827 fixup: hangs and !os_aio_pending_writes() assertion failures
buf_LRU_get_free_block(): Always wake up the page cleaner if needed
before exiting the inner loop.
srv_prepare_to_delete_redo_log_file():
Replace a debug assertion with a wait in debug builds.
Starting with commit 7e31a8e7fa97a87fc164381588d172bf0e76abb6
the debug assertion ut_ad(!os_aio_pending_writes())
could occasionally fail, while it would hold in core dumps of crashes.
The failure can be reproduced more easily by adding a sleep to the
write completion callback function, right before releasing to
write_slots.
srv_start(): Remove a bogus debug assertion
ut_ad(!os_aio_pending_writes()) that could fail in
mariadb-backup --prepare. In an rr replay trace, we had
buf_pool.flush_list.count==0 but write_slots->m_cache.m_pos==1
and buf_page_t::write_complete() was executing u_unlock().
Diffstat (limited to 'storage/innobase')
-rw-r--r-- | storage/innobase/buf/buf0lru.cc | 6 | ||||
-rw-r--r-- | storage/innobase/srv/srv0start.cc | 3 |
2 files changed, 4 insertions, 5 deletions
diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index 844e288843b..feb15fc226c 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -448,15 +448,15 @@ got_block: mysql_mutex_unlock(&buf_pool.mutex); mysql_mutex_lock(&buf_pool.flush_list_mutex); const auto n_flush = buf_pool.n_flush(); + if (!buf_pool.try_LRU_scan) { + buf_pool.page_cleaner_wakeup(true); + } mysql_mutex_unlock(&buf_pool.flush_list_mutex); mysql_mutex_lock(&buf_pool.mutex); if (!n_flush) { goto not_found; } if (!buf_pool.try_LRU_scan) { - mysql_mutex_lock(&buf_pool.flush_list_mutex); - buf_pool.page_cleaner_wakeup(true); - mysql_mutex_unlock(&buf_pool.flush_list_mutex); my_cond_wait(&buf_pool.done_free, &buf_pool.mutex.m_mutex); } diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 707804f2206..5f6b4b02e16 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -970,10 +970,10 @@ same_size: ut_ad(flushed_lsn == log_sys.get_lsn()); ut_ad(!os_aio_pending_reads()); - ut_ad(!os_aio_pending_writes()); ut_d(mysql_mutex_lock(&buf_pool.flush_list_mutex)); ut_ad(!buf_pool.get_oldest_modification(0)); ut_d(mysql_mutex_unlock(&buf_pool.flush_list_mutex)); + ut_d(os_aio_wait_until_no_pending_writes()); DBUG_RETURN(flushed_lsn); } @@ -1608,7 +1608,6 @@ file_checked: ut_ad(recv_no_log_write); err = fil_write_flushed_lsn(log_sys.get_lsn()); ut_ad(!os_aio_pending_reads()); - ut_ad(!os_aio_pending_writes()); ut_d(mysql_mutex_lock(&buf_pool.flush_list_mutex)); ut_ad(!buf_pool.get_oldest_modification(0)); ut_d(mysql_mutex_unlock(&buf_pool.flush_list_mutex)); |