Browse Source

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 7e31a8e7fa
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().
pull/2612/head
Marko Mäkelä 3 years ago
parent
commit
40eff3f868
  1. 6
      storage/innobase/buf/buf0lru.cc
  2. 3
      storage/innobase/srv/srv0start.cc

6
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);
}

3
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));

Loading…
Cancel
Save