diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-02-09 15:49:50 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-02-09 15:49:50 +0200 |
commit | cce994057bf7e2bdb62686075de03aeb5db4bbda (patch) | |
tree | 0b1413d979a0c573de8d7c0721d2586b099ad275 /storage | |
parent | 1bed56400e19f39697332205038d0cb1d51b25aa (diff) | |
parent | fd101daa84ec5f70f09c48e3fb7a4ce8f6d26edb (diff) | |
download | mariadb-git-cce994057bf7e2bdb62686075de03aeb5db4bbda.tar.gz |
Merge 10.5 into 10.6
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 2 | ||||
-rw-r--r-- | storage/innobase/include/mtr0mtr.h | 6 | ||||
-rw-r--r-- | storage/innobase/include/mtr0mtr.inl | 9 | ||||
-rw-r--r-- | storage/innobase/log/log0log.cc | 7 | ||||
-rw-r--r-- | storage/innobase/mtr/mtr0mtr.cc | 46 |
5 files changed, 33 insertions, 37 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index bfb3075edc6..d4b8670e00f 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -19473,7 +19473,7 @@ static MYSQL_SYSVAR_BOOL(numa_interleave, srv_numa_interleave, static MYSQL_SYSVAR_ENUM(change_buffering, innodb_change_buffering, PLUGIN_VAR_RQCMDARG, "Buffer changes to secondary indexes.", - NULL, NULL, IBUF_USE_ALL, &innodb_change_buffering_typelib); + NULL, NULL, IBUF_USE_NONE, &innodb_change_buffering_typelib); static MYSQL_SYSVAR_UINT(change_buffer_max_size, srv_change_buffer_max_size, diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index 326b21c6494..8f74343ba64 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -623,9 +623,9 @@ private: @param type extended record subtype; @see mrec_ext_t */ inline void log_write_extended(const buf_block_t &block, byte type); - /** Prepare to write the mini-transaction log to the redo log buffer. - @return number of bytes to write in finish_write() */ - inline ulint prepare_write(); + /** Append the redo log records to the redo log buffer. + @return {start_lsn,flush_ahead} */ + std::pair<lsn_t,page_flush_ahead> do_write(); /** Append the redo log records to the redo log buffer. @param len number of bytes to write diff --git a/storage/innobase/include/mtr0mtr.inl b/storage/innobase/include/mtr0mtr.inl index 02ad88194fb..21ff912e9c7 100644 --- a/storage/innobase/include/mtr0mtr.inl +++ b/storage/innobase/include/mtr0mtr.inl @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 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 @@ -33,7 +33,8 @@ inline bool mtr_t::is_block_dirtied(const buf_block_t *block) ut_ad(block->page.in_file()); ut_ad(block->page.frame); ut_ad(block->page.buf_fix_count()); - return block->page.oldest_modification() <= 1; + return block->page.oldest_modification() <= 1 && + block->page.id().space() < SRV_TMP_SPACE_ID; } /** @@ -52,8 +53,8 @@ mtr_t::memo_push(void* object, mtr_memo_type_t type) grab log_sys.flush_order_mutex at mtr_t::commit() so that we can insert the dirtied page into the flush list. */ - if ((type == MTR_MEMO_PAGE_X_FIX || type == MTR_MEMO_PAGE_SX_FIX) - && !m_made_dirty) { + if (!m_made_dirty + && (type == MTR_MEMO_PAGE_X_FIX || type == MTR_MEMO_PAGE_SX_FIX)) { m_made_dirty = is_block_dirtied( reinterpret_cast<const buf_block_t*>(object)); diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 387a2a761ec..bedb52436e2 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -642,8 +642,7 @@ loop: } } -/** Flush the recently written changes to the log file. -and invoke mysql_mutex_lock(&log_sys.mutex). */ +/** Flush the recently written changes to the log file.*/ static void log_write_flush_to_disk_low(lsn_t lsn) { if (!log_sys.log.writes_are_durable()) @@ -783,10 +782,6 @@ static void log_write(bool rotate_key) start_offset - area_start); srv_stats.log_padded.add(pad_size); log_sys.write_lsn = write_lsn; - if (log_sys.log.writes_are_durable()) { - log_sys.set_flushed_lsn(write_lsn); - log_flush_notify(write_lsn); - } return; } diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index fa72d95def3..c5bfb355392 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -404,18 +404,27 @@ void mtr_t::commit() std::pair<lsn_t,page_flush_ahead> lsns; - if (const ulint len= prepare_write()) - lsns= finish_write(len); - else - lsns= { m_commit_lsn, PAGE_FLUSH_NO }; + if (UNIV_LIKELY(m_log_mode == MTR_LOG_ALL)) + { + lsns= do_write(); - if (m_made_dirty) - mysql_mutex_lock(&log_sys.flush_order_mutex); + if (m_made_dirty) + mysql_mutex_lock(&log_sys.flush_order_mutex); - /* It is now safe to release the log mutex because the - flush_order mutex will ensure that we are the first one - to insert into the flush list. */ - mysql_mutex_unlock(&log_sys.mutex); + /* It is now safe to release log_sys.mutex because the + buf_pool.flush_order_mutex will ensure that we are the first one + to insert into buf_pool.flush_list. */ + mysql_mutex_unlock(&log_sys.mutex); + } + else + { + ut_ad(m_log_mode == MTR_LOG_NO_REDO); + ut_ad(m_log.size() == 0); + m_commit_lsn= log_sys.get_lsn(); + lsns= { m_commit_lsn, PAGE_FLUSH_NO }; + if (UNIV_UNLIKELY(m_made_dirty)) /* This should be IMPORT TABLESPACE */ + mysql_mutex_lock(&log_sys.flush_order_mutex); + } if (m_freed_pages) { @@ -521,7 +530,7 @@ void mtr_t::commit_shrink(fil_space_t &space) log_write_and_flush_prepare(); - const lsn_t start_lsn= finish_write(prepare_write()).first; + const lsn_t start_lsn= do_write().first; mysql_mutex_lock(&log_sys.flush_order_mutex); /* Durably write the reduced FSP_SIZE before truncating the data file. */ @@ -936,19 +945,10 @@ struct mtr_write_log } }; -/** Prepare to write the mini-transaction log to the redo log buffer. -@return number of bytes to write in finish_write() */ -inline ulint mtr_t::prepare_write() +std::pair<lsn_t,mtr_t::page_flush_ahead> mtr_t::do_write() { ut_ad(!recv_no_log_write); - - if (UNIV_UNLIKELY(m_log_mode != MTR_LOG_ALL)) { - ut_ad(m_log_mode == MTR_LOG_NO_REDO); - ut_ad(m_log.size() == 0); - mysql_mutex_lock(&log_sys.mutex); - m_commit_lsn = log_sys.get_lsn(); - return 0; - } + ut_ad(m_log_mode == MTR_LOG_ALL); ulint len = m_log.size(); ut_ad(len > 0); @@ -980,7 +980,7 @@ inline ulint mtr_t::prepare_write() /* check and attempt a checkpoint if exceeding capacity */ log_margin_checkpoint_age(len); - return(len); + return finish_write(len); } /** Append the redo log records to the redo log buffer. |