summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-06-01 13:16:41 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-06-01 22:16:05 +0300
commite2a818ce6c067d47b03e41dad8c6b4af8d25ce37 (patch)
tree7cb403ced6194917d98ff433be58088e9387e5df
parent661ebd469997e42e6d5c831791d2c2e68f240a83 (diff)
downloadmariadb-git-bb-10.5-MDEV-22027.tar.gz
MDEV-22027 Assertion oldest_lsn >= log_sys.last_checkpoint_lsn failed in log_checkpoint()bb-10.5-MDEV-22027
log_buf_pool_get_oldest_modification(): Acquire log_sys_t::flush_order_mutex in order to prevent a race condition that was introduced in commit a52c4820a30a69522c9876f06510662bf063bcc3 (MySQL 5.5.10). Before that change, log_sys->mutex would protect both mtr_commit() and log_buf_pool_get_oldest_modification().
-rw-r--r--storage/innobase/log/log0log.cc26
1 files changed, 8 insertions, 18 deletions
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index fdc47a8d442..1a8786c3c26 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -91,27 +91,17 @@ should be bigger than LOG_POOL_PREFLUSH_RATIO_SYNC */
the previous */
#define LOG_POOL_PREFLUSH_RATIO_ASYNC 8
-/****************************************************************//**
-Returns the oldest modified block lsn in the pool, or log_sys.lsn if none
-exists.
+/** Return the oldest modified LSN in buf_pool.flush_list,
+or the latest LSN if all pages are clean.
@return LSN of oldest modification */
-static
-lsn_t
-log_buf_pool_get_oldest_modification(void)
-/*======================================*/
+static lsn_t log_buf_pool_get_oldest_modification()
{
- lsn_t lsn;
-
- ut_ad(log_mutex_own());
-
- lsn = buf_pool_get_oldest_modification();
+ ut_ad(log_mutex_own());
+ log_flush_order_mutex_enter();
+ lsn_t lsn= buf_pool_get_oldest_modification();
+ log_flush_order_mutex_exit();
- if (!lsn) {
-
- lsn = log_sys.get_lsn();
- }
-
- return(lsn);
+ return lsn ? lsn : log_sys.get_lsn();
}
/** Extends the log buffer.