Skip to content

Commit fc2ec25

Browse files
committed
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.
1 parent a7d880f commit fc2ec25

File tree

8 files changed

+8
-17
lines changed

8 files changed

+8
-17
lines changed

storage/innobase/buf/buf0dblwr.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,8 +681,7 @@ void buf_dblwr_t::flush_buffered_writes_completed(const IORequest &request)
681681
static_cast<const byte*>(frame)));
682682
ut_ad(lsn);
683683
ut_ad(lsn >= bpage->oldest_modification());
684-
if (lsn > log_sys.get_flushed_lsn())
685-
log_write_up_to(lsn, true);
684+
log_write_up_to(lsn, true);
686685
e.request.node->space->io(e.request, bpage->physical_offset(), e_size,
687686
frame, bpage);
688687
}

storage/innobase/include/log0log.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -699,15 +699,6 @@ struct log_t{
699699

700700
/** Shut down the redo log subsystem. */
701701
void close();
702-
703-
/** Initiate a write of the log buffer to the file if needed.
704-
@param flush whether to initiate a durable write */
705-
inline void initiate_write(bool flush)
706-
{
707-
const lsn_t lsn= get_lsn();
708-
if (!flush || get_flushed_lsn() < lsn)
709-
log_write_up_to(lsn, flush);
710-
}
711702
};
712703

713704
/** Redo log system */

storage/innobase/log/log0log.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,7 @@ void log_write_up_to(lsn_t lsn, bool flush_to_disk, bool rotate_key)
792792
{
793793
ut_ad(!srv_read_only_mode);
794794
ut_ad(!rotate_key || flush_to_disk);
795+
ut_ad(lsn != LSN_MAX);
795796

796797
if (recv_no_ibuf_operations)
797798
{

storage/innobase/mtr/mtr0mtr.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ static lsn_t log_reserve_and_open(size_t len)
689689
DEBUG_SYNC_C("log_buf_size_exceeded");
690690

691691
/* Not enough free space, do a write of the log buffer */
692-
log_sys.initiate_write(false);
692+
log_write_up_to(log_sys.get_lsn(), false);
693693

694694
srv_stats.log_waits.inc();
695695

storage/innobase/row/row0mysql.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2989,13 +2989,13 @@ row_discard_tablespace_end(
29892989
}
29902990

29912991
DBUG_EXECUTE_IF("ib_discard_before_commit_crash",
2992-
log_write_up_to(LSN_MAX, true);
2992+
log_buffer_flush_to_disk();
29932993
DBUG_SUICIDE(););
29942994

29952995
trx_commit_for_mysql(trx);
29962996

29972997
DBUG_EXECUTE_IF("ib_discard_after_commit_crash",
2998-
log_write_up_to(LSN_MAX, true);
2998+
log_buffer_flush_to_disk();
29992999
DBUG_SUICIDE(););
30003000

30013001
row_mysql_unlock_data_dictionary(trx);

storage/innobase/srv/srv0srv.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1518,7 +1518,7 @@ srv_sync_log_buffer_in_background(void)
15181518
srv_main_thread_op_info = "flushing log";
15191519
if (difftime(current_time, srv_last_log_flush_time)
15201520
>= srv_flush_log_at_timeout) {
1521-
log_sys.initiate_write(true);
1521+
log_buffer_flush_to_disk();
15221522
srv_last_log_flush_time = current_time;
15231523
srv_log_writes_and_flush++;
15241524
}

storage/innobase/srv/srv0start.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ static dberr_t create_log_file(bool create_new_db, lsn_t lsn,
331331
mysql_mutex_unlock(&log_sys.mutex);
332332

333333
log_make_checkpoint();
334-
log_write_up_to(LSN_MAX, true);
334+
log_buffer_flush_to_disk();
335335

336336
return DB_SUCCESS;
337337
}

storage/innobase/trx/trx0purge.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ static void trx_purge_truncate_history()
792792

793793
DBUG_EXECUTE_IF("ib_undo_trunc",
794794
ib::info() << "ib_undo_trunc";
795-
log_write_up_to(LSN_MAX, true);
795+
log_buffer_flush_to_disk();
796796
DBUG_SUICIDE(););
797797

798798
for (ulint i = 0; i < TRX_SYS_N_RSEGS; ++i) {

0 commit comments

Comments
 (0)