summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2021-07-16 11:27:41 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2021-07-16 18:44:58 +0200
commitfc2ec25733c6f1a305bf14df960ee7a02b48ef2c (patch)
tree16cd8220dfa7b2edde28bd638983667089f25c80
parenta7d880f0b095939118594ecbeba953959ae8e351 (diff)
downloadmariadb-git-fc2ec25733c6f1a305bf14df960ee7a02b48ef2c.tar.gz
MDEV-26166 replace log_write_up_to(LSN_MAX,...) with log_buffer_flush_to_disk()
Also, remove comparison lsn > flush/write lsn, prior to calling log_write_up_to. The checks and early returns are part of this function.
-rw-r--r--storage/innobase/buf/buf0dblwr.cc3
-rw-r--r--storage/innobase/include/log0log.h9
-rw-r--r--storage/innobase/log/log0log.cc1
-rw-r--r--storage/innobase/mtr/mtr0mtr.cc2
-rw-r--r--storage/innobase/row/row0mysql.cc4
-rw-r--r--storage/innobase/srv/srv0srv.cc2
-rw-r--r--storage/innobase/srv/srv0start.cc2
-rw-r--r--storage/innobase/trx/trx0purge.cc2
8 files changed, 8 insertions, 17 deletions
diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc
index 845aa749856..52e947b7c5e 100644
--- a/storage/innobase/buf/buf0dblwr.cc
+++ b/storage/innobase/buf/buf0dblwr.cc
@@ -681,8 +681,7 @@ void buf_dblwr_t::flush_buffered_writes_completed(const IORequest &request)
static_cast<const byte*>(frame)));
ut_ad(lsn);
ut_ad(lsn >= bpage->oldest_modification());
- if (lsn > log_sys.get_flushed_lsn())
- log_write_up_to(lsn, true);
+ log_write_up_to(lsn, true);
e.request.node->space->io(e.request, bpage->physical_offset(), e_size,
frame, bpage);
}
diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h
index 849485eae5a..fbcc30ee7ca 100644
--- a/storage/innobase/include/log0log.h
+++ b/storage/innobase/include/log0log.h
@@ -699,15 +699,6 @@ public:
/** Shut down the redo log subsystem. */
void close();
-
- /** Initiate a write of the log buffer to the file if needed.
- @param flush whether to initiate a durable write */
- inline void initiate_write(bool flush)
- {
- const lsn_t lsn= get_lsn();
- if (!flush || get_flushed_lsn() < lsn)
- log_write_up_to(lsn, flush);
- }
};
/** Redo log system */
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index 83036d81658..ece26ded72e 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -792,6 +792,7 @@ void log_write_up_to(lsn_t lsn, bool flush_to_disk, bool rotate_key)
{
ut_ad(!srv_read_only_mode);
ut_ad(!rotate_key || flush_to_disk);
+ ut_ad(lsn != LSN_MAX);
if (recv_no_ibuf_operations)
{
diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc
index f6747686eb5..691b393561f 100644
--- a/storage/innobase/mtr/mtr0mtr.cc
+++ b/storage/innobase/mtr/mtr0mtr.cc
@@ -689,7 +689,7 @@ static lsn_t log_reserve_and_open(size_t len)
DEBUG_SYNC_C("log_buf_size_exceeded");
/* Not enough free space, do a write of the log buffer */
- log_sys.initiate_write(false);
+ log_write_up_to(log_sys.get_lsn(), false);
srv_stats.log_waits.inc();
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index ce0746f20c6..6998a5730f9 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -2989,13 +2989,13 @@ row_discard_tablespace_end(
}
DBUG_EXECUTE_IF("ib_discard_before_commit_crash",
- log_write_up_to(LSN_MAX, true);
+ log_buffer_flush_to_disk();
DBUG_SUICIDE(););
trx_commit_for_mysql(trx);
DBUG_EXECUTE_IF("ib_discard_after_commit_crash",
- log_write_up_to(LSN_MAX, true);
+ log_buffer_flush_to_disk();
DBUG_SUICIDE(););
row_mysql_unlock_data_dictionary(trx);
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index 02711e99c07..ad221dc205c 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -1518,7 +1518,7 @@ srv_sync_log_buffer_in_background(void)
srv_main_thread_op_info = "flushing log";
if (difftime(current_time, srv_last_log_flush_time)
>= srv_flush_log_at_timeout) {
- log_sys.initiate_write(true);
+ log_buffer_flush_to_disk();
srv_last_log_flush_time = current_time;
srv_log_writes_and_flush++;
}
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index c4bf7ccb68b..aa6e7ce11f9 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -331,7 +331,7 @@ static dberr_t create_log_file(bool create_new_db, lsn_t lsn,
mysql_mutex_unlock(&log_sys.mutex);
log_make_checkpoint();
- log_write_up_to(LSN_MAX, true);
+ log_buffer_flush_to_disk();
return DB_SUCCESS;
}
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index 563ce9d0e23..28491853150 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -792,7 +792,7 @@ not_free:
DBUG_EXECUTE_IF("ib_undo_trunc",
ib::info() << "ib_undo_trunc";
- log_write_up_to(LSN_MAX, true);
+ log_buffer_flush_to_disk();
DBUG_SUICIDE(););
for (ulint i = 0; i < TRX_SYS_N_RSEGS; ++i) {