krunalbauskar, in case you wonder why there are two wait loops in the function buf_flush_wait(): The first one waits for the minimum oldest_modification in the buffer pool to be large enough. That is the prerequisite for a log checkpoint. The oldest_modification of each modified page would be cleared in buf_page_write_complete() in I/O callback threads.
The final loop is waiting for the checkpoint to actually be advanced by the buf_flush_page_cleaner(). That condition is currently waiting for the page cleaner to completely exit the ‘furious flushing’ mode before exiting.
I now realize that my initially suggested change cannot possibly help, because whenever buf_flush_sync_lsn is nonzero, it would be guaranteed to be at least lsn, by design. What we really might need is to wait for the log checkpoint to have advanced enough. Something like this:
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
|
index dec0292a088..7480e0cf673 100644
|
--- a/storage/innobase/buf/buf0flu.cc
|
+++ b/storage/innobase/buf/buf0flu.cc
|
@@ -1799,7 +1799,7 @@ static void buf_flush_wait(lsn_t lsn)
|
}
|
|
/* Wait for the checkpoint. */
|
- while (buf_flush_sync_lsn)
|
+ while (buf_flush_sync_lsn && log_sys.last_checkpoint_lsn < lsn)
|
my_cond_wait(&buf_pool.done_flush_list,
|
&buf_pool.flush_list_mutex.m_mutex);
|
}
|
I will have to review whether that second loop is needed at all. It should be unnecessary for the correctness of log_checkpoint_margin(), but I have to consider other callers as well.
Marko,
1. the said patch doesn't help.
2. Condition is constant till buf_flush_sync_lsn is reset to 0. lsn is not changing.
3. I am still confused why we need that condition there?