Commit 0a573e7e authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.5 into 10.6

parents 792972a6 7d7bdd4a
......@@ -1721,9 +1721,16 @@ static bool log_checkpoint_low(lsn_t oldest_lsn, lsn_t end_lsn)
ut_ad(!recv_no_log_write);
ut_ad(oldest_lsn >= log_sys.last_checkpoint_lsn);
const lsn_t age= oldest_lsn - log_sys.last_checkpoint_lsn;
if (oldest_lsn > log_sys.last_checkpoint_lsn + SIZE_OF_FILE_CHECKPOINT)
if (age > SIZE_OF_FILE_CHECKPOINT + log_sys.framing_size())
/* Some log has been written since the previous checkpoint. */;
else if (age > SIZE_OF_FILE_CHECKPOINT &&
!((log_sys.log.calc_lsn_offset(oldest_lsn) ^
log_sys.log.calc_lsn_offset(log_sys.last_checkpoint_lsn)) &
~lsn_t{OS_FILE_LOG_BLOCK_SIZE - 1}))
/* Some log has been written to the same log block. */;
else if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED)
/* MariaDB startup expects the redo log file to be logically empty
(not even containing a FILE_CHECKPOINT record) after a clean shutdown.
......@@ -1767,7 +1774,7 @@ static bool log_checkpoint_low(lsn_t oldest_lsn, lsn_t end_lsn)
ut_ad(log_sys.get_flushed_lsn() >= flush_lsn);
if (log_sys.n_pending_checkpoint_writes)
if (log_sys.checkpoint_pending)
{
/* A checkpoint write is running */
mysql_mutex_unlock(&log_sys.mutex);
......
......@@ -601,11 +601,10 @@ struct log_t{
/*!< next checkpoint number */
/** latest completed checkpoint (protected by log_sys.mutex) */
Atomic_relaxed<lsn_t> last_checkpoint_lsn;
lsn_t next_checkpoint_lsn;
/*!< next checkpoint lsn */
ulint n_pending_checkpoint_writes;
/*!< number of currently pending
checkpoint writes */
/** next checkpoint LSN (protected by log_sys.mutex) */
lsn_t next_checkpoint_lsn;
/** whether a checkpoint is pending */
Atomic_relaxed<bool> checkpoint_pending;
/** buffer for checkpoint header */
byte *checkpoint_buf;
......
......@@ -214,7 +214,7 @@ void log_t::create()
max_checkpoint_age= 0;
next_checkpoint_no= 0;
next_checkpoint_lsn= 0;
n_pending_checkpoint_writes= 0;
checkpoint_pending= false;
log_block_init(buf, LOG_START_LSN);
log_block_set_first_rec_group(buf, LOG_BLOCK_HDR_SIZE);
......@@ -962,7 +962,8 @@ ATTRIBUTE_COLD void log_write_checkpoint_info(lsn_t end_lsn)
ut_ad(LOG_CHECKPOINT_1 < srv_page_size);
ut_ad(LOG_CHECKPOINT_2 < srv_page_size);
++log_sys.n_pending_checkpoint_writes;
ut_ad(!log_sys.checkpoint_pending);
log_sys.checkpoint_pending = true;
mysql_mutex_unlock(&log_sys.mutex);
......@@ -977,8 +978,8 @@ ATTRIBUTE_COLD void log_write_checkpoint_info(lsn_t end_lsn)
mysql_mutex_lock(&log_sys.mutex);
--log_sys.n_pending_checkpoint_writes;
ut_ad(log_sys.n_pending_checkpoint_writes == 0);
ut_ad(log_sys.checkpoint_pending);
log_sys.checkpoint_pending = false;
log_sys.next_checkpoint_no++;
......@@ -1174,8 +1175,8 @@ ATTRIBUTE_COLD void logs_empty_and_mark_files_at_shutdown()
if (log_sys.is_initialised()) {
mysql_mutex_lock(&log_sys.mutex);
const ulint n_write = log_sys.n_pending_checkpoint_writes;
const ulint n_flush = log_sys.pending_flushes;
const size_t n_write{log_sys.checkpoint_pending};
const size_t n_flush{log_sys.get_pending_flushes()};
mysql_mutex_unlock(&log_sys.mutex);
if (n_write || n_flush) {
......@@ -1311,7 +1312,7 @@ log_print(
ULINTPF " pending chkp writes\n"
ULINTPF " log i/o's done, %.2f log i/o's/second\n",
log_sys.pending_flushes.load(),
log_sys.n_pending_checkpoint_writes,
ulint{log_sys.checkpoint_pending},
log_sys.n_log_ios,
static_cast<double>(
log_sys.n_log_ios - log_sys.n_log_ios_old)
......
......@@ -2,7 +2,7 @@
Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2021, MariaDB Corporation.
Copyright (c) 2013, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
......@@ -1765,10 +1765,7 @@ srv_mon_process_existing_counter(
break;
case MONITOR_PENDING_CHECKPOINT_WRITE:
mysql_mutex_lock(&log_sys.mutex);
value = static_cast<mon_type_t>(
log_sys.n_pending_checkpoint_writes);
mysql_mutex_unlock(&log_sys.mutex);
value = log_sys.checkpoint_pending;
break;
case MONITOR_LOG_IO:
......
......@@ -1225,14 +1225,13 @@ dberr_t srv_start(bool create_new_db)
recv_sys.create();
lock_sys.create(srv_lock_table_size);
srv_startup_is_before_trx_rollback_phase = true;
if (!srv_read_only_mode) {
buf_flush_page_cleaner_init();
ut_ad(buf_page_cleaner_is_active);
}
srv_startup_is_before_trx_rollback_phase = true;
/* Check if undo tablespaces and redo log files exist before creating
a new system tablespace */
if (create_new_db) {
......
......@@ -292,9 +292,9 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags,
#ifndef WITH_S3_STORAGE_ENGINE
DBUG_ASSERT(!s3);
#endif /* WITH_S3_STORAGE_ENGINE */
#else
if (!s3)
#endif /* WITH_S3_STORAGE_ENGINE */
{
realpath_err= my_realpath(name_buff, fn_format(org_name, name, "",
MARIA_NAME_IEXT,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment