Skip to content

Commit 2bb8d7c

Browse files
committed
MDEV-26811: Assertion "log_sys->n_pending_flushes == 1" fails
In commit 1cb218c (MDEV-26450) we introduced the function log_write_and_flush(), which may compete with log_checkpoint() invoking log_write_flush_to_disk_low() from another thread. The assertion n_pending_flushes==1 is too strict. There is no possibility of a race condition here, because fil_flush() is protected by fil_system->mutex and the rest will be protected by log_sys->mutex. log_write_flush_to_disk_low(), log_write_and_flush(): Relax the assertions to test for a nonzero count.
1 parent 6f32b28 commit 2bb8d7c

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

storage/innobase/log/log0log.cc

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -983,21 +983,16 @@ log_group_write_buf(
983983

984984
/** Flush the recently written changes to the log file.
985985
and invoke log_mutex_enter(). */
986-
static
987-
void
988-
log_write_flush_to_disk_low()
986+
static void log_write_flush_to_disk_low()
989987
{
990-
/* FIXME: This is not holding log_sys->mutex while
991-
calling os_event_set()! */
992-
ut_a(log_sys->n_pending_flushes == 1); /* No other threads here */
988+
ut_a(log_sys->n_pending_flushes);
993989

994990
bool do_flush = srv_file_flush_method != SRV_O_DSYNC;
995991

996992
if (do_flush) {
997993
fil_flush(SRV_LOG_SPACE_FIRST_ID);
998994
}
999995

1000-
1001996
log_mutex_enter();
1002997
if (do_flush) {
1003998
log_sys->flushed_to_disk_lsn = log_sys->current_flush_lsn;
@@ -1329,7 +1324,7 @@ ATTRIBUTE_COLD void log_write_and_flush()
13291324

13301325
/* Code adapted from log_write_flush_to_disk_low() */
13311326

1332-
ut_a(log_sys->n_pending_flushes == 1); /* No other threads here */
1327+
ut_a(log_sys->n_pending_flushes);
13331328

13341329
if (srv_file_flush_method != SRV_O_DSYNC)
13351330
fil_flush(SRV_LOG_SPACE_FIRST_ID);

0 commit comments

Comments
 (0)