diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-02-11 18:44:26 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-02-11 18:44:26 +0200 |
commit | fc2f2fa85306d80c317e76933264ba3d3675ed1c (patch) | |
tree | 5f2beb7d399fa620968cb91687697e64eee48aab /storage/innobase | |
parent | 8ccb3caafb7cba0fca12e89c5c9b67a740364fdd (diff) | |
download | mariadb-git-fc2f2fa85306d80c317e76933264ba3d3675ed1c.tar.gz |
MDEV-19747: Deprecate and ignore innodb_log_optimize_ddl
During native table rebuild or index creation, InnoDB used to skip
redo logging and write MLOG_INDEX_LOAD records to inform crash recovery
and Mariabackup of the gaps in redo log. This is fragile and prohibits
some optimizations, such as skipping the doublewrite buffer for
newly (re)initialized pages (MDEV-19738).
row_merge_write_redo(): Remove. We do not write MLOG_INDEX_LOAD
records any more. Instead, we write full redo log.
FlushObserver: Remove.
fseg_free_page_func(): Remove the parameter log. Redo logging
cannot be disabled.
fil_space_t::redo_skipped_count: Remove.
We cannot remove buf_block_t::skip_flush_check, because PageBulk
will temporarily generate invalid B-tree pages in the buffer pool.
Diffstat (limited to 'storage/innobase')
36 files changed, 117 insertions, 704 deletions
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index 753ed9b077c..88af5003d25 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -2,7 +2,7 @@ Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2014, 2019, MariaDB Corporation. +Copyright (c) 2014, 2020, 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 @@ -747,7 +747,7 @@ void btr_page_free(dict_index_t* index, buf_block_t* block, mtr_t* mtr, : PAGE_HEADER + PAGE_BTR_SEG_TOP]; fseg_free_page(seg_header, index->table->space, block->page.id.page_no(), - block->index != NULL, !block->page.flush_observer, mtr); + block->index != NULL, mtr); /* The page was marked free in the allocation bitmap, but it should remain exclusively latched until mtr_t::commit() or until it diff --git a/storage/innobase/btr/btr0bulk.cc b/storage/innobase/btr/btr0bulk.cc index 51a4657a1c1..d0bccd11688 100644 --- a/storage/innobase/btr/btr0bulk.cc +++ b/storage/innobase/btr/btr0bulk.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2014, 2019, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2019, MariaDB Corporation. +Copyright (c) 2017, 2020, 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,8 +33,6 @@ Created 03/11/2014 Shaohua Wang /** Innodb B-tree index fill factor for bulk load. */ uint innobase_fill_factor; -/** whether to reduce redo logging during ALTER TABLE */ -my_bool innodb_log_optimize_ddl; /** Initialize members, allocate page if needed and start mtr. Note: we commit all mtrs on failure. @@ -51,13 +49,7 @@ PageBulk::init() m_heap = mem_heap_create(1000); m_mtr.start(); - - if (m_flush_observer) { - m_mtr.set_log_mode(MTR_LOG_NO_REDO); - m_mtr.set_flush_observer(m_flush_observer); - } else { - m_index->set_modified(m_mtr); - } + m_index->set_modified(m_mtr); if (m_page_no == FIL_NULL) { mtr_t alloc_mtr; @@ -233,7 +225,7 @@ inline void PageBulk::insertPage(const rec_t *rec, offset_t *offsets) m_heap_top += rec_size; m_rec_no += 1; - if (!m_flush_observer && !m_page_zip) { + if (!m_page_zip) { /* For ROW_FORMAT=COMPRESSED, redo log may be written in PageBulk::compress(). */ page_cur_insert_rec_write_log(insert_rec, rec_size, @@ -322,7 +314,7 @@ inline void PageBulk::finishPage() ut_ad(!page_get_instant(m_page)); ut_ad(!mach_read_from_2(PAGE_HEADER + PAGE_N_DIRECTION + m_page)); - if (fmt != COMPRESSED && !m_flush_observer) { + if (fmt != COMPRESSED) { m_mtr.write<2,mtr_t::OPT>(*m_block, PAGE_HEADER + PAGE_N_DIR_SLOTS + m_page, 2 + slot_index); @@ -671,13 +663,7 @@ dberr_t PageBulk::latch() { m_mtr.start(); - - if (m_flush_observer) { - m_mtr.set_log_mode(MTR_LOG_NO_REDO); - m_mtr.set_flush_observer(m_flush_observer); - } else { - m_index->set_modified(m_mtr); - } + m_index->set_modified(m_mtr); /* In case the block is S-latched by page_cleaner. */ if (!buf_page_optimistic_get(RW_X_LATCH, m_block, m_modify_clock, @@ -720,7 +706,7 @@ BtrBulk::pageSplit( /* 2. create a new page. */ PageBulk new_page_bulk(m_index, m_trx->id, FIL_NULL, - page_bulk->getLevel(), m_flush_observer); + page_bulk->getLevel()); dberr_t err = new_page_bulk.init(); if (err != DB_SUCCESS) { return(err); @@ -855,7 +841,7 @@ BtrBulk::insert( if (level + 1 > m_page_bulks.size()) { PageBulk* new_page_bulk = UT_NEW_NOKEY(PageBulk(m_index, m_trx->id, FIL_NULL, - level, m_flush_observer)); + level)); err = new_page_bulk->init(); if (err != DB_SUCCESS) { UT_DELETE(new_page_bulk); @@ -909,8 +895,7 @@ BtrBulk::insert( /* Create a sibling page_bulk. */ PageBulk* sibling_page_bulk; sibling_page_bulk = UT_NEW_NOKEY(PageBulk(m_index, m_trx->id, - FIL_NULL, level, - m_flush_observer)); + FIL_NULL, level)); err = sibling_page_bulk->init(); if (err != DB_SUCCESS) { UT_DELETE(sibling_page_bulk); @@ -935,10 +920,6 @@ BtrBulk::insert( /* Important: log_free_check whether we need a checkpoint. */ if (page_is_leaf(sibling_page_bulk->getPage())) { if (trx_is_interrupted(m_trx)) { - if (m_flush_observer) { - m_flush_observer->interrupted(); - } - err = DB_INTERRUPTED; goto func_exit; } @@ -1032,8 +1013,7 @@ BtrBulk::finish(dberr_t err) mtr_t mtr; buf_block_t* last_block; PageBulk root_page_bulk(m_index, m_trx->id, - m_index->page, m_root_level, - m_flush_observer); + m_index->page, m_root_level); mtr.start(); m_index->set_modified(mtr); @@ -1057,9 +1037,6 @@ BtrBulk::finish(dberr_t err) /* Remove last page. */ btr_page_free(m_index, last_block, &mtr); - /* Do not flush the last page. */ - last_block->page.flush_observer = NULL; - mtr.commit(); err = pageCommit(&root_page_bulk, NULL, false); diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 3a52011cf03..2842600cdf6 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -7347,7 +7347,6 @@ struct btr_blob_log_check_t { dict_index_t* index = m_pcur->index(); ulint offs = 0; ulint page_no = ULINT_UNDEFINED; - FlushObserver* observer = m_mtr->get_flush_observer(); if (UNIV_UNLIKELY(m_op == BTR_STORE_INSERT_BULK)) { offs = page_offset(*m_rec); @@ -7368,7 +7367,6 @@ struct btr_blob_log_check_t { m_mtr->start(); m_mtr->set_log_mode(log_mode); index->set_modified(*m_mtr); - m_mtr->set_flush_observer(observer); if (UNIV_UNLIKELY(m_op == BTR_STORE_INSERT_BULK)) { m_pcur->btr_cur.page_cur.block = btr_block_get( @@ -7563,7 +7561,6 @@ btr_store_big_rec_extern_fields( mtr.start(); index->set_modified(mtr); mtr.set_log_mode(btr_mtr->get_log_mode()); - mtr.set_flush_observer(btr_mtr->get_flush_observer()); buf_page_get(rec_block->page.id, rec_block->zip_size(), RW_X_LATCH, &mtr); diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 949973ee381..e602d2017c3 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1496,7 +1496,6 @@ buf_block_init( block->page.state = BUF_BLOCK_NOT_USED; block->page.buf_fix_count = 0; block->page.io_fix = BUF_IO_NONE; - block->page.flush_observer = NULL; block->page.init_on_flush = false; block->page.real_size = 0; block->page.write_size = 0; @@ -5336,7 +5335,6 @@ buf_page_init_for_read( bpage->state = BUF_BLOCK_ZIP_PAGE; bpage->id = page_id; - bpage->flush_observer = NULL; bpage->init_on_flush = false; ut_d(bpage->in_page_hash = FALSE); diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index c51803ea5e6..86c52b33738 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -623,14 +623,6 @@ buf_flush_remove( ut_a(buf_flush_validate_skip(buf_pool)); #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ - /* If there is an observer that want to know if the asynchronous - flushing was done then notify it. */ - if (bpage->flush_observer != NULL) { - bpage->flush_observer->notify_remove(buf_pool, bpage); - - bpage->flush_observer = NULL; - } - buf_flush_list_mutex_exit(buf_pool); } @@ -1362,19 +1354,6 @@ buf_flush_page( rw_lock_sx_lock_gen(rw_lock, BUF_IO_WRITE); } - /* If there is an observer that want to know if the asynchronous - flushing was sent then notify it. - Note: we set flush observer to a page with x-latch, so we can - guarantee that notify_flush and notify_remove are called in pair - with s-latch on a uncompressed page. */ - if (bpage->flush_observer != NULL) { - buf_pool_mutex_enter(buf_pool); - - bpage->flush_observer->notify_flush(buf_pool, bpage); - - buf_pool_mutex_exit(buf_pool); - } - /* Even though bpage is not protected by any mutex at this point, it is safe to access bpage, because it is io_fixed and oldest_modification != 0. Thus, it cannot be relocated in the @@ -3674,9 +3653,7 @@ ulint buf_pool_get_dirty_pages_count( /*===========================*/ buf_pool_t* buf_pool, /*!< in: buffer pool */ - ulint id, /*!< in: space id to check */ - FlushObserver* observer) /*!< in: flush observer to check */ - + ulint id) /*!< in: space id to check */ { ulint count = 0; @@ -3693,10 +3670,7 @@ buf_pool_get_dirty_pages_count( ut_ad(bpage->in_flush_list); ut_ad(bpage->oldest_modification > 0); - if ((observer != NULL - && observer == bpage->flush_observer) - || (observer == NULL - && id == bpage->id.space())) { + if (id == bpage->id.space()) { ++count; } } @@ -3706,128 +3680,3 @@ buf_pool_get_dirty_pages_count( return(count); } - -/******************************************************************//** -Check if there are any dirty pages that belong to a space id in the flush list. -@return number of dirty pages present in all the buffer pools */ -static -ulint -buf_flush_get_dirty_pages_count( -/*============================*/ - ulint id, /*!< in: space id to check */ - FlushObserver* observer) /*!< in: flush observer to check */ -{ - ulint count = 0; - - for (ulint i = 0; i < srv_buf_pool_instances; ++i) { - buf_pool_t* buf_pool; - - buf_pool = buf_pool_from_array(i); - - count += buf_pool_get_dirty_pages_count(buf_pool, id, observer); - } - - return(count); -} - -/** FlushObserver constructor -@param[in] space tablespace -@param[in] trx trx instance -@param[in] stage performance schema accounting object, -used by ALTER TABLE. It is passed to log_preflush_pool_modified_pages() -for accounting. */ -FlushObserver::FlushObserver( - fil_space_t* space, - trx_t* trx, - ut_stage_alter_t* stage) - : - m_space(space), - m_trx(trx), - m_stage(stage), - m_interrupted(false) -{ - m_flushed = UT_NEW_NOKEY(std::vector<ulint>(srv_buf_pool_instances)); - m_removed = UT_NEW_NOKEY(std::vector<ulint>(srv_buf_pool_instances)); - - for (ulint i = 0; i < srv_buf_pool_instances; i++) { - m_flushed->at(i) = 0; - m_removed->at(i) = 0; - } - - DBUG_LOG("flush", "FlushObserver(): trx->id=" << m_trx->id); -} - -/** FlushObserver deconstructor */ -FlushObserver::~FlushObserver() -{ - ut_ad(buf_flush_get_dirty_pages_count(m_space->id, this) == 0); - - UT_DELETE(m_flushed); - UT_DELETE(m_removed); - - DBUG_LOG("flush", "~FlushObserver(): trx->id=" << m_trx->id); -} - -/** Check whether the operation has been interrupted */ -void FlushObserver::check_interrupted() -{ - if (trx_is_interrupted(m_trx)) { - interrupted(); - } -} - -/** Notify observer of a flush -@param[in] buf_pool buffer pool instance -@param[in] bpage buffer page to flush */ -void -FlushObserver::notify_flush( - buf_pool_t* buf_pool, - buf_page_t* bpage) -{ - ut_ad(buf_pool_mutex_own(buf_pool)); - - m_flushed->at(buf_pool->instance_no)++; - - if (m_stage != NULL) { - m_stage->inc(); - } - - DBUG_LOG("flush", "Flush " << bpage->id); -} - -/** Notify observer of a remove -@param[in] buf_pool buffer pool instance -@param[in] bpage buffer page flushed */ -void -FlushObserver::notify_remove( - buf_pool_t* buf_pool, - buf_page_t* bpage) -{ - ut_ad(buf_pool_mutex_own(buf_pool)); - - m_removed->at(buf_pool->instance_no)++; - - DBUG_LOG("flush", "Remove " << bpage->id); -} - -/** Flush dirty pages and wait. */ -void -FlushObserver::flush() -{ - ut_ad(m_trx); - - if (!m_interrupted && m_stage) { - m_stage->begin_phase_flush(buf_flush_get_dirty_pages_count( - m_space->id, this)); - } - - buf_LRU_flush_or_remove_pages(m_space->id, this); - - /* Wait for all dirty pages were flushed. */ - for (ulint i = 0; i < srv_buf_pool_instances; i++) { - while (!is_complete(i)) { - - os_thread_sleep(2000); - } - } -} diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index 0e3cd4d47a5..55118feb9ac 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2019, MariaDB Corporation. +Copyright (c) 2017, 2020, 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 @@ -466,19 +466,13 @@ buf_flush_try_yield( return(false); } -/******************************************************************//** -Removes a single page from a given tablespace inside a specific -buffer pool instance. +/** Remove a single page from flush_list. +@param[in,out] buf_pool buffer pool +@param[in,out] bpage buffer page to remove +@param[in] flush whether to flush the page before removing @return true if page was removed. */ -static MY_ATTRIBUTE((warn_unused_result)) -bool -buf_flush_or_remove_page( -/*=====================*/ - buf_pool_t* buf_pool, /*!< in/out: buffer pool instance */ - buf_page_t* bpage, /*!< in/out: bpage to remove */ - bool flush) /*!< in: flush to disk if true but - don't remove else remove without - flushing to disk */ +static bool buf_flush_or_remove_page(buf_pool_t* buf_pool, buf_page_t* bpage, + bool flush) { ut_ad(buf_pool_mutex_own(buf_pool)); ut_ad(buf_flush_list_mutex_own(buf_pool)); @@ -551,17 +545,11 @@ tablespace. The pages still remain a part of LRU and are evicted from the list as they age towards the tail of the LRU. @param[in,out] buf_pool buffer pool @param[in] id tablespace identifier -@param[in] observer flush observer (to check for interrupt), - or NULL if the files should not be written to +@param[in] flush whether to flush the pages before removing @param[in] first first page to be flushed or evicted @return whether all matching dirty pages were removed */ -static MY_ATTRIBUTE((warn_unused_result)) -bool -buf_flush_or_remove_pages( - buf_pool_t* buf_pool, - ulint id, - FlushObserver* observer, - ulint first) +static bool buf_flush_or_remove_pages(buf_pool_t* buf_pool, ulint id, + bool flush, ulint first) { buf_page_t* prev; buf_page_t* bpage; @@ -583,29 +571,12 @@ rescan: prev = UT_LIST_GET_PREV(list, bpage); - /* Flush the pages matching space id, - or pages matching the flush observer. */ - if (observer && observer->is_partial_flush()) { - if (observer != bpage->flush_observer) { - /* Skip this block. */ - } else if (!buf_flush_or_remove_page( - buf_pool, bpage, - !observer->is_interrupted())) { - all_freed = false; - } else if (!observer->is_interrupted()) { - /* The processing was successful. And during the - processing we have released the buf_pool mutex - when calling buf_page_flush(). We cannot trust - prev pointer. */ - goto rescan; - } - } else if (id != bpage->id.space()) { + if (id != bpage->id.space()) { /* Skip this block, because it is for a different tablespace. */ } else if (bpage->id.page_no() < first) { /* Skip this block, because it is below the limit. */ - } else if (!buf_flush_or_remove_page( - buf_pool, bpage, observer != NULL)) { + } else if (!buf_flush_or_remove_page(buf_pool, bpage, flush)) { /* Remove was unsuccessful, we have to try again by scanning the entire list from the end. @@ -628,7 +599,7 @@ rescan: iteration. */ all_freed = false; - } else if (observer) { + } else if (flush) { /* The processing was successful. And during the processing we have released the buf_pool mutex @@ -646,12 +617,6 @@ rescan: processed = 0; } - - /* The check for trx is interrupted is expensive, we want - to check every N iterations. */ - if (!processed && observer) { - observer->check_interrupted(); - } } buf_flush_list_mutex_exit(buf_pool); @@ -665,21 +630,15 @@ list and will be evicted from the LRU list as they age and move towards the tail of the LRU list. @param[in,out] buf_pool buffer pool @param[in] id tablespace identifier -@param[in] observer flush observer, - or NULL if the files should not be written to +@param[in] flush whether to flush the pages before removing @param[in] first first page to be flushed or evicted */ -static -void -buf_flush_dirty_pages( - buf_pool_t* buf_pool, - ulint id, - FlushObserver* observer, - ulint first) +static void buf_flush_dirty_pages(buf_pool_t* buf_pool, ulint id, bool flush, + ulint first) { for (;;) { buf_pool_mutex_enter(buf_pool); - bool freed = buf_flush_or_remove_pages(buf_pool, id, observer, + bool freed = buf_flush_or_remove_pages(buf_pool, id, flush, first); buf_pool_mutex_exit(buf_pool); @@ -694,28 +653,25 @@ buf_flush_dirty_pages( ut_ad(buf_flush_validate(buf_pool)); } - ut_ad((observer && observer->is_interrupted()) - || first - || buf_pool_get_dirty_pages_count(buf_pool, id, observer) == 0); + ut_ad(first + || buf_pool_get_dirty_pages_count(buf_pool, id) == 0); } /** Empty the flush list for all pages belonging to a tablespace. @param[in] id tablespace identifier -@param[in] observer flush observer, - or NULL if nothing is to be written +@param[in] flush whether to write the pages to files @param[in] first first page to be flushed or evicted */ -void buf_LRU_flush_or_remove_pages(ulint id, FlushObserver* observer, - ulint first) +void buf_LRU_flush_or_remove_pages(ulint id, bool flush, ulint first) { /* Pages in the system tablespace must never be discarded. */ - ut_ad(id || observer); + ut_ad(id || flush); for (ulint i = 0; i < srv_buf_pool_instances; i++) { - buf_flush_dirty_pages(buf_pool_from_array(i), id, observer, + buf_flush_dirty_pages(buf_pool_from_array(i), id, flush, first); } - if (observer && !observer->is_interrupted()) { + if (flush) { /* Ensure that all asynchronous IO is completed. */ os_aio_wait_until_no_pending_writes(); fil_flush(id); @@ -1105,7 +1061,6 @@ loop: memset(&block->page.zip, 0, sizeof block->page.zip); block->skip_flush_check = false; - block->page.flush_observer = NULL; return(block); } diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 2d6cae8ce87..d579fd802de 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -2253,11 +2253,7 @@ fil_close_tablespace( buffer pool. Thus we can clean the tablespace out of the buffer pool completely and permanently. The flag stop_new_ops also prevents fil_flush() from being applied to this tablespace. */ - - { - FlushObserver observer(space, trx, NULL); - buf_LRU_flush_or_remove_pages(id, &observer); - } + buf_LRU_flush_or_remove_pages(id, true); /* If the free is successful, the X lock will be released before the space memory data structure is freed. */ diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index 1d1dc0ab266..42db8a0a5bc 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2019, MariaDB Corporation. +Copyright (c) 2017, 2020, 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 @@ -515,8 +515,7 @@ void fil_space_t::modify_check(const mtr_t& mtr) const break; case MTR_LOG_NO_REDO: ut_ad(purpose == FIL_TYPE_TEMPORARY - || purpose == FIL_TYPE_IMPORT - || redo_skipped_count); + || purpose == FIL_TYPE_IMPORT); return; case MTR_LOG_ALL: /* We may only write redo log for a persistent @@ -1223,10 +1222,8 @@ fsp_alloc_free_page( The page is marked as free and clean. @param[in,out] space tablespace @param[in] offset page number -@param[in] log whether to write MLOG_INIT_FREE_PAGE record @param[in,out] mtr mini-transaction */ -static void fsp_free_page(fil_space_t* space, page_no_t offset, - bool log, mtr_t* mtr) +static void fsp_free_page(fil_space_t* space, page_no_t offset, mtr_t* mtr) { xdes_t* descr; ulint state; @@ -1278,12 +1275,7 @@ static void fsp_free_page(fil_space_t* space, page_no_t offset, return; } - if (UNIV_UNLIKELY(!log)) { - /* The last page freed in BtrBulk::finish() must be - written with redo logging disabled for the page - itself. The modifications of the allocation data - structures are covered by redo log. */ - } else if (byte* log_ptr = mlog_open(mtr, 11)) { + if (byte* log_ptr = mlog_open(mtr, 11)) { log_ptr = mlog_write_initial_log_record_low( MLOG_INIT_FREE_PAGE, space->id, offset, log_ptr, mtr); mlog_close(mtr, log_ptr); @@ -1532,7 +1524,7 @@ static void fsp_free_seg_inode( /* There are no other used headers left on the page: free it */ flst_remove(header, FSP_HEADER_OFFSET + FSP_SEG_INODES_FREE, iblock, FSEG_INODE_PAGE_NODE, mtr); - fsp_free_page(space, iblock->page.id.page_no(), true, mtr); + fsp_free_page(space, iblock->page.id.page_no(), mtr); } } @@ -2529,7 +2521,6 @@ try_to_extend: @param[in] offset page number @param[in] ahi whether we may need to drop the adaptive hash index -@param[in] log whether to write MLOG_INIT_FREE_PAGE record @param[in,out] mtr mini-transaction */ static void @@ -2541,7 +2532,6 @@ fseg_free_page_low( #ifdef BTR_CUR_HASH_ADAPT bool ahi, #endif /* BTR_CUR_HASH_ADAPT */ - bool log, mtr_t* mtr) { ib_id_t descr_id; @@ -2592,7 +2582,7 @@ fseg_free_page_low( break; } - fsp_free_page(space, offset, log, mtr); + fsp_free_page(space, offset, mtr); return; } @@ -2647,8 +2637,8 @@ fseg_free_page_low( } #ifndef BTR_CUR_HASH_ADAPT -# define fseg_free_page_low(inode, space, offset, ahi, log, mtr) \ - fseg_free_page_low(inode, space, offset, log, mtr) +# define fseg_free_page_low(inode, space, offset, ahi, mtr) \ + fseg_free_page_low(inode, space, offset, mtr) #endif /* !BTR_CUR_HASH_ADAPT */ /** Free a page in a file segment. @@ -2657,7 +2647,6 @@ fseg_free_page_low( @param[in] offset page number @param[in] ahi whether we may need to drop the adaptive hash index -@param[in] log whether to write MLOG_INIT_FREE_PAGE record @param[in,out] mtr mini-transaction */ void fseg_free_page_func( @@ -2667,7 +2656,6 @@ fseg_free_page_func( #ifdef BTR_CUR_HASH_ADAPT bool ahi, #endif /* BTR_CUR_HASH_ADAPT */ - bool log, mtr_t* mtr) { DBUG_ENTER("fseg_free_page"); @@ -2685,7 +2673,7 @@ fseg_free_page_func( fil_block_check_type(*iblock, FIL_PAGE_INODE, mtr); } - fseg_free_page_low(seg_inode, iblock, space, offset, ahi, log, mtr); + fseg_free_page_low(seg_inode, iblock, space, offset, ahi, mtr); ut_d(buf_page_set_file_page_was_freed(page_id_t(space->id, offset))); @@ -2878,7 +2866,7 @@ fseg_free_step_func( fseg_free_page_low( inode, iblock, space, fseg_get_nth_frag_page_no(inode, n, mtr), - ahi, true, mtr); + ahi, mtr); n = fseg_find_last_used_frag_page_slot(inode, mtr); @@ -2951,7 +2939,7 @@ fseg_free_step_not_header_func( return(true); } - fseg_free_page_low(inode, iblock, space, page_no, ahi, true, mtr); + fseg_free_page_low(inode, iblock, space, page_no, ahi, mtr); return(false); } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index e893c48d8d1..eee52923b11 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3471,6 +3471,11 @@ static my_bool innodb_log_checksums; static const char* innodb_log_checksums_deprecated = "The parameter innodb_log_checksums is deprecated and has no effect."; /** Deprecated parameter with no effect */ +static my_bool innodb_log_optimize_ddl; +static const char* innodb_log_optimize_ddl_deprecated += "The parameter innodb_log_optimize_ddl is deprecated and has no effect."; + +/** Deprecated parameter with no effect */ static ulong innodb_undo_logs; /** Deprecation message for innodb_undo_logs */ static const char* innodb_undo_logs_deprecated @@ -3779,6 +3784,11 @@ static int innodb_init_params() innodb_log_checksums = TRUE; } + if (UNIV_UNLIKELY(innodb_log_optimize_ddl)) { + sql_print_warning(innodb_log_optimize_ddl_deprecated); + innodb_log_optimize_ddl = FALSE; + } + if (UNIV_UNLIKELY(innodb_undo_logs != TRX_SYS_N_RSEGS)) { sql_print_warning(innodb_undo_logs_deprecated); innodb_undo_logs = TRX_SYS_N_RSEGS; @@ -18886,6 +18896,16 @@ innodb_log_checksums_warn(THD* thd, st_mysql_sys_var*, void*, const void*) innodb_log_checksums_deprecated); } +/** Issue a deprecation warning for SET GLOBAL innodb_log_optimize_ddl. +@param[in,out] thd client connection */ +static void +innodb_log_optimize_ddl_warn(THD* thd, st_mysql_sys_var*, void*, const void*) +{ + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + HA_ERR_UNSUPPORTED, + innodb_log_optimize_ddl_deprecated); +} + /** Issue a deprecation warning for SET GLOBAL innodb_undo_logs. @param[in,out] thd client connection */ static void @@ -19407,10 +19427,7 @@ static MYSQL_SYSVAR_BOOL(log_compressed_pages, page_zip_log_pages, static MYSQL_SYSVAR_BOOL(log_optimize_ddl, innodb_log_optimize_ddl, PLUGIN_VAR_OPCMDARG, - "Reduce redo logging when natively creating indexes or rebuilding tables." - " Setting this OFF avoids delay due to page flushing and" - " allows concurrent backup.", - NULL, NULL, TRUE); + innodb_deprecated_ignored, NULL, innodb_log_optimize_ddl_warn, FALSE); static MYSQL_SYSVAR_ULONG(autoextend_increment, sys_tablespace_auto_extend_increment, diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index b51fea1dee2..7ad543297c8 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2019, MariaDB Corporation. +Copyright (c) 2016, 2020, 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 @@ -1963,7 +1963,7 @@ ibuf_remove_free_page(void) compile_time_assert(IBUF_SPACE_ID == 0); fseg_free_page(header_page + IBUF_HEADER + IBUF_TREE_SEG_HEADER, - fil_system.sys_space, page_no, false, true, &mtr); + fil_system.sys_space, page_no, false, &mtr); const page_id_t page_id(IBUF_SPACE_ID, page_no); diff --git a/storage/innobase/include/btr0bulk.h b/storage/innobase/include/btr0bulk.h index 0bebc8c4c27..12ecddca44f 100644 --- a/storage/innobase/include/btr0bulk.h +++ b/storage/innobase/include/btr0bulk.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2014, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2019, MariaDB Corporation. +Copyright (c) 2019, 2020, 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 @@ -53,14 +53,12 @@ public: @param[in] index B-tree index @param[in] page_no page number @param[in] level page level - @param[in] trx_id transaction id - @param[in] observer flush observer */ + @param[in] trx_id transaction id */ PageBulk( dict_index_t* index, trx_id_t trx_id, ulint page_no, - ulint level, - FlushObserver* observer) + ulint level) : m_heap(NULL), m_index(index), @@ -81,7 +79,6 @@ public: m_total_data(0), #endif /* UNIV_DEBUG */ m_modify_clock(0), - m_flush_observer(observer), m_err(DB_SUCCESS) { ut_ad(!dict_index_is_spatial(m_index)); @@ -274,9 +271,6 @@ private: when the block is re-pinned */ ib_uint64_t m_modify_clock; - /** Flush observer, or NULL if redo logging is enabled */ - FlushObserver* m_flush_observer; - /** Operation result DB_SUCCESS or error code */ dberr_t m_err; }; @@ -289,31 +283,15 @@ class BtrBulk public: /** Constructor @param[in] index B-tree index - @param[in] trx transaction - @param[in] observer flush observer */ + @param[in] trx transaction */ BtrBulk( dict_index_t* index, - const trx_t* trx, - FlushObserver* observer) + const trx_t* trx) : m_index(index), - m_trx(trx), - m_flush_observer(observer) + m_trx(trx) { ut_ad(!dict_index_is_spatial(index)); -#ifdef UNIV_DEBUG - if (m_flush_observer) - m_index->table->space->redo_skipped_count++; -#endif /* UNIV_DEBUG */ - } - - /** Destructor */ - ~BtrBulk() - { -#ifdef UNIV_DEBUG - if (m_flush_observer) - m_index->table->space->redo_skipped_count--; -#endif /* UNIV_DEBUG */ } /** Insert a tuple @@ -385,9 +363,6 @@ private: /** Root page level */ ulint m_root_level; - /** Flush observer, or NULL if redo logging is enabled */ - FlushObserver*const m_flush_observer; - /** Page cursor vector for all level */ page_bulk_vector m_page_bulks; }; diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 8d0176e8f4e..e5ea24a166f 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -1526,8 +1526,6 @@ public: == (state == BUF_BLOCK_NOT_USED) */ #endif /* UNIV_DEBUG */ - FlushObserver* flush_observer; /*!< flush observer */ - lsn_t oldest_modification; /*!< log sequence number of the START of the log entry diff --git a/storage/innobase/include/buf0flu.h b/storage/innobase/include/buf0flu.h index fa653d41748..fa884725d02 100644 --- a/storage/innobase/include/buf0flu.h +++ b/storage/innobase/include/buf0flu.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2018, MariaDB Corporation. +Copyright (c) 2014, 2020, 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 @@ -186,9 +186,8 @@ buf_flush_note_modification( buf_block_t* block, /*!< in: block which is modified */ lsn_t start_lsn, /*!< in: start lsn of the first mtr in a set of mtr's */ - lsn_t end_lsn, /*!< in: end lsn of the last mtr in the + lsn_t end_lsn); /*!< in: end lsn of the last mtr in the set of mtr's */ - FlushObserver* observer); /*!< in: flush observer */ /********************************************************************//** Returns TRUE if the file page block is immediately suitable for replacement, i.e., transition FILE_PAGE => NOT_USED allowed. @@ -297,8 +296,7 @@ ulint buf_pool_get_dirty_pages_count( /*===========================*/ buf_pool_t* buf_pool, /*!< in: buffer pool */ - ulint id, /*!< in: space id to check */ - FlushObserver* observer); /*!< in: flush observer to check */ + ulint id); /*!< in: space id to check */ /*******************************************************************//** Synchronously flush dirty blocks from the end of the flush list of all buffer @@ -314,88 +312,6 @@ void buf_flush_request_force( lsn_t lsn_limit); -/** We use FlushObserver to track flushing of non-redo logged pages in bulk -create index(BtrBulk.cc).Since we disable redo logging during a index build, -we need to make sure that all dirty pages modifed by the index build are -flushed to disk before any redo logged operations go to the index. */ - -class FlushObserver { -public: - /** Constructor - @param[in,out] space tablespace - @param[in] trx trx instance - @param[in] stage performance schema accounting object, - used by ALTER TABLE. It is passed to log_preflush_pool_modified_pages() - for accounting. */ - FlushObserver(fil_space_t* space, trx_t* trx, ut_stage_alter_t* stage); - - /** Deconstructor */ - ~FlushObserver(); - - /** Check pages have been flushed and removed from the flush list - in a buffer pool instance. - @param[in] instance_no buffer pool instance no - @return true if the pages were removed from the flush list */ - bool is_complete(ulint instance_no) - { - return(m_flushed->at(instance_no) == m_removed->at(instance_no) - || m_interrupted); - } - - /** @return whether to flush only some pages of the tablespace */ - bool is_partial_flush() const { return m_stage != NULL; } - - /** @return whether the operation was interrupted */ - bool is_interrupted() const { return m_interrupted; } - - /** Interrupt observer not to wait. */ - void interrupted() - { - m_interrupted = true; - } - - /** Check whether the operation has been interrupted */ - void check_interrupted(); - - /** Flush dirty pages. */ - void flush(); - /** Notify observer of flushing a page - @param[in] buf_pool buffer pool instance - @param[in] bpage buffer page to flush */ - void notify_flush( - buf_pool_t* buf_pool, - buf_page_t* bpage); - - /** Notify observer of removing a page from flush list - @param[in] buf_pool buffer pool instance - @param[in] bpage buffer page flushed */ - void notify_remove( - buf_pool_t* buf_pool, - buf_page_t* bpage); -private: - /** Tablespace */ - fil_space_t* m_space; - - /** Trx instance */ - const trx_t* const m_trx; - - /** Performance schema accounting object, used by ALTER TABLE. - If not NULL, then stage->begin_phase_flush() will be called initially, - specifying the number of pages to be attempted to be flushed and - subsequently, stage->inc() will be called for each page we attempt to - flush. */ - ut_stage_alter_t* m_stage; - - /* Flush request sent */ - std::vector<ulint>* m_flushed; - - /* Flush request finished */ - std::vector<ulint>* m_removed; - - /* True if the operation was interrupted. */ - bool m_interrupted; -}; - #include "buf0flu.ic" #endif diff --git a/storage/innobase/include/buf0flu.ic b/storage/innobase/include/buf0flu.ic index 7f6578f3989..3e7c255171e 100644 --- a/storage/innobase/include/buf0flu.ic +++ b/storage/innobase/include/buf0flu.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2019, 2020, 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 @@ -48,9 +49,8 @@ buf_flush_note_modification( buf_block_t* block, /*!< in: block which is modified */ lsn_t start_lsn, /*!< in: start lsn of the mtr that modified this block */ - lsn_t end_lsn, /*!< in: end lsn of the mtr that + lsn_t end_lsn) /*!< in: end lsn of the mtr that modified this block */ - FlushObserver* observer) /*!< in: flush observer */ { mutex_enter(&block->mutex); ut_ad(!srv_read_only_mode @@ -67,12 +67,6 @@ buf_flush_note_modification( + block->frame); } - /* Don't allow to set flush observer from non-null to null, - or from one observer to another. */ - ut_ad(block->page.flush_observer == NULL - || block->page.flush_observer == observer); - block->page.flush_observer = observer; - if (block->page.oldest_modification == 0) { buf_pool_t* buf_pool = buf_pool_from_block(block); diff --git a/storage/innobase/include/buf0lru.h b/storage/innobase/include/buf0lru.h index 2468efb193f..2eb483381b4 100644 --- a/storage/innobase/include/buf0lru.h +++ b/storage/innobase/include/buf0lru.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2019, MariaDB Corporation. +Copyright (c) 2017, 2020, 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 @@ -63,11 +63,9 @@ bool buf_LRU_drop_page_hash_for_tablespace(dict_table_t* table) /** Empty the flush list for all pages belonging to a tablespace. @param[in] id tablespace identifier -@param[in,out] observer flush observer, - or NULL if nothing is to be written +@param[in] flush whether to write the pages to files @param[in] first first page to be flushed or evicted */ -void buf_LRU_flush_or_remove_pages(ulint id, FlushObserver* observer, - ulint first = 0); +void buf_LRU_flush_or_remove_pages(ulint id, bool flush, ulint first = 0); #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG /********************************************************************//** diff --git a/storage/innobase/include/buf0types.h b/storage/innobase/include/buf0types.h index 7a54b4d27c1..8570b87b67a 100644 --- a/storage/innobase/include/buf0types.h +++ b/storage/innobase/include/buf0types.h @@ -44,8 +44,6 @@ struct buf_pool_stat_t; struct buf_buddy_stat_t; /** Doublewrite memory struct */ struct buf_dblwr_t; -/** Flush observer for bulk create index */ -class FlushObserver; /** A buffer frame. @see page_t */ typedef byte buf_frame_t; diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 88a38bb7f28..44313e652c7 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -42,8 +42,6 @@ Created 10/25/1995 Heikki Tuuri struct unflushed_spaces_tag_t; struct rotation_list_tag_t; -/** whether to reduce redo logging during ALTER TABLE */ -extern my_bool innodb_log_optimize_ddl; // Forward declaration extern my_bool srv_use_doublewrite_buf; extern struct buf_dblwr_t* buf_dblwr; @@ -114,11 +112,6 @@ struct fil_space_t bool stop_new_ops; /** whether undo tablespace truncation is in progress */ bool is_being_truncated; -#ifdef UNIV_DEBUG - /** reference count for operations who want to skip redo log in the - file space in order to make modify_check() pass. */ - Atomic_counter<ulint> redo_skipped_count; -#endif fil_type_t purpose;/*!< purpose */ UT_LIST_BASE_NODE_T(fil_node_t) chain; /*!< base node for the file chain */ diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h index 00294cf5fb4..a9331a9e8fe 100644 --- a/storage/innobase/include/fsp0fsp.h +++ b/storage/innobase/include/fsp0fsp.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2019, MariaDB Corporation. +Copyright (c) 2013, 2020, 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 @@ -494,7 +494,6 @@ fsp_reserve_free_extents( @param[in] offset page number @param[in] ahi whether we may need to drop the adaptive hash index -@param[in] log whether to write MLOG_INIT_FREE_PAGE record @param[in,out] mtr mini-transaction */ void fseg_free_page_func( @@ -504,14 +503,13 @@ fseg_free_page_func( #ifdef BTR_CUR_HASH_ADAPT bool ahi, #endif /* BTR_CUR_HASH_ADAPT */ - bool log, mtr_t* mtr); #ifdef BTR_CUR_HASH_ADAPT -# define fseg_free_page(header, space, offset, ahi, log, mtr) \ - fseg_free_page_func(header, space, offset, ahi, log, mtr) +# define fseg_free_page(header, space, offset, ahi, mtr) \ + fseg_free_page_func(header, space, offset, ahi, mtr) #else /* BTR_CUR_HASH_ADAPT */ -# define fseg_free_page(header, space, offset, ahi, log, mtr) \ - fseg_free_page_func(header, space, offset, log, mtr) +# define fseg_free_page(header, space, offset, ahi, mtr) \ + fseg_free_page_func(header, space, offset, mtr) #endif /* BTR_CUR_HASH_ADAPT */ /** Determine whether a page is free. @param[in,out] space tablespace @@ -636,9 +634,7 @@ inline void fsp_init_file_page( block->page.id.space(), block->page.id.page_no(), log_ptr, mtr); mlog_close(mtr, log_ptr); - if (!innodb_log_optimize_ddl) { - block->page.init_on_flush = true; - } + block->page.init_on_flush = true; } } diff --git a/storage/innobase/include/mtr0log.ic b/storage/innobase/include/mtr0log.ic index 541be8f7090..75327afab5d 100644 --- a/storage/innobase/include/mtr0log.ic +++ b/storage/innobase/include/mtr0log.ic @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2019, MariaDB Corporation. +Copyright (c) 2017, 2020, 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 @@ -138,7 +138,6 @@ mlog_write_initial_log_record_low( || type == MLOG_FILE_DELETE || type == MLOG_FILE_CREATE2 || type == MLOG_FILE_RENAME2 - || type == MLOG_INDEX_LOAD || mtr->is_named_space(space_id)); mach_write_to_1(log_ptr, type); diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index a0935c0db90..5885eefbe80 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -325,18 +325,6 @@ struct mtr_t { /** @return true if we are inside the change buffer code */ bool is_inside_ibuf() const { return m_inside_ibuf; } - /** Get flush observer - @return flush observer */ - FlushObserver* get_flush_observer() const { return m_flush_observer; } - - /** Set flush observer - @param[in] observer flush observer */ - void set_flush_observer(FlushObserver* observer) - { - ut_ad(observer == NULL || m_log_mode == MTR_LOG_NO_REDO); - m_flush_observer = observer; - } - #ifdef UNIV_DEBUG /** Check if memo contains the given item. @param memo memo stack @@ -527,9 +515,6 @@ private: /** user tablespace that is being modified by the mini-transaction */ fil_space_t* m_user_space; - /** page flush observer for innodb_log_optimize_ddl=ON */ - FlushObserver *m_flush_observer; - /** LSN at commit time */ lsn_t m_commit_lsn; }; diff --git a/storage/innobase/include/row0merge.h b/storage/innobase/include/row0merge.h index fd9050d0a48..3ba7508911a 100644 --- a/storage/innobase/include/row0merge.h +++ b/storage/innobase/include/row0merge.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2019, MariaDB Corporation. +Copyright (c) 2015, 2020, 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 @@ -292,12 +292,6 @@ row_merge_drop_table( dict_table_t* table) /*!< in: table instance to drop */ MY_ATTRIBUTE((nonnull, warn_unused_result)); -/** Write an MLOG_INDEX_LOAD record to indicate in the redo-log -that redo-logging of individual index pages was disabled, and -the flushing of such pages to the data files was completed. -@param[in] index an index tree on which redo logging was disabled */ -void row_merge_write_redo(const dict_index_t* index); - /** Build indexes on a table by reading a clustered index, creating a temporary file containing index entries, merge sorting these index entries and inserting sorted index entries to indexes. diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 0fbbdd19725..daca5e3b3fa 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -3,7 +3,7 @@ Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2008, 2009, Google Inc. Copyright (c) 2009, Percona Inc. -Copyright (c) 2013, 2019, MariaDB Corporation. +Copyright (c) 2013, 2020, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -599,10 +599,6 @@ everything after flush log_make_checkpoint(). */ extern PSI_stage_info srv_stage_alter_table_end; /** Performance schema stage event for monitoring ALTER TABLE progress -log_make_checkpoint(). */ -extern PSI_stage_info srv_stage_alter_table_flush; - -/** Performance schema stage event for monitoring ALTER TABLE progress row_merge_insert_index_tuples(). */ extern PSI_stage_info srv_stage_alter_table_insert; diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index 8d2f580b591..ef47b5d395c 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -41,7 +41,6 @@ Created 3/26/1996 Heikki Tuuri // Forward declaration struct mtr_t; -class FlushObserver; struct rw_trx_hash_element_t; /******************************************************************//** @@ -1044,11 +1043,6 @@ public: /*------------------------------*/ char* detailed_error; /*!< detailed error message for last error, or empty. */ -private: - /** flush observer used to track flushing of non-redo logged pages - during bulk create index */ - FlushObserver* flush_observer; -public: /* Lock wait statistics */ ulint n_rec_lock_waits; /*!< Number of record lock waits, @@ -1101,20 +1095,6 @@ public: return(assign_temp_rseg()); } - /** Set the innodb_log_optimize_ddl page flush observer - @param[in,out] space tablespace - @param[in,out] stage performance_schema accounting */ - void set_flush_observer(fil_space_t* space, ut_stage_alter_t* stage); - - /** Remove the flush observer */ - void remove_flush_observer(); - - /** @return the flush observer */ - FlushObserver* get_flush_observer() const - { - return flush_observer; - } - /** Transition to committed state, to release implicit locks. */ inline void commit_state(); diff --git a/storage/innobase/include/ut0stage.h b/storage/innobase/include/ut0stage.h index 1eb7810a1bb..23ff32a60f9 100644 --- a/storage/innobase/include/ut0stage.h +++ b/storage/innobase/include/ut0stage.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2014, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2020, 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 @@ -62,9 +62,6 @@ if any new indexes are being added, for each one: being_phase_log_index() multiple times: inc() // once per log-block applied -begin_phase_flush() - multiple times: - inc() // once per page flushed begin_phase_log_table() multiple times: inc() // once per log-block applied @@ -86,7 +83,6 @@ public: m_n_pk_recs(0), m_n_pk_pages(0), m_n_recs_processed(0), - m_n_flush_pages(0), m_cur_phase(NOT_STARTED) { } @@ -134,13 +130,6 @@ public: void begin_phase_insert(); - /** Flag the beginning of the flush phase. - @param[in] n_flush_pages this many pages are going to be - flushed */ - void - begin_phase_flush( - ulint n_flush_pages); - /** Flag the beginning of the log index phase. */ void begin_phase_log_index(); @@ -195,16 +184,12 @@ private: recs-per-page records. */ ulint m_n_recs_processed; - /** Number of pages to flush. */ - ulint m_n_flush_pages; - /** Current phase. */ enum { NOT_STARTED = 0, READ_PK = 1, SORT = 2, INSERT = 3, - FLUSH = 4, /* JAN: TODO: MySQL 5.7 vrs. MariaDB sql/log.h LOG_INDEX = 5, LOG_TABLE = 6, */ @@ -317,8 +302,6 @@ ut_stage_alter_t::inc(ulint) break; } - case FLUSH: - break; /* JAN: TODO: MySQL 5.7 case LOG_INDEX: break; @@ -387,21 +370,6 @@ ut_stage_alter_t::begin_phase_insert() change_phase(&srv_stage_alter_table_insert); } -/** Flag the beginning of the flush phase. -@param[in] n_flush_pages this many pages are going to be -flushed */ -inline -void -ut_stage_alter_t::begin_phase_flush( - ulint n_flush_pages) -{ - m_n_flush_pages = n_flush_pages; - - reestimate(); - - change_phase(&srv_stage_alter_table_flush); -} - /** Flag the beginning of the log index phase. */ inline void @@ -458,20 +426,12 @@ ut_stage_alter_t::reestimate() ? m_n_pk_pages : m_pk->stat_n_leaf_pages; - /* If flush phase has not started yet and we do not know how - many pages are to be flushed, then use a wild guess - the - number of pages in the PK / 2. */ - if (m_n_flush_pages == 0) { - m_n_flush_pages = n_pk_pages / 2; - } - ulonglong estimate __attribute__((unused)) = n_pk_pages * (1 /* read PK */ + m_n_sort_indexes /* row_merge_buf_sort() inside the read PK per created index */ + m_n_sort_indexes * 2 /* sort & insert per created index */) - + m_n_flush_pages + row_log_estimate_work(m_pk); /* Prevent estimate < completed */ @@ -500,8 +460,6 @@ ut_stage_alter_t::change_phase( m_cur_phase = SORT; } else if (new_stage == &srv_stage_alter_table_insert) { m_cur_phase = INSERT; - } else if (new_stage == &srv_stage_alter_table_flush) { - m_cur_phase = FLUSH; /* JAN: TODO: MySQL 5.7 used LOG_INDEX and LOG_TABLE */ } else if (new_stage == &srv_stage_alter_table_log_index) { m_cur_phase = LOG_INNODB_INDEX; @@ -542,8 +500,6 @@ public: void begin_phase_insert() {} - void begin_phase_flush(ulint) {} - void begin_phase_log_index() {} void begin_phase_log_table() {} diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 04e61e0deac..44271e1da71 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -2076,7 +2076,7 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr, if (start_lsn) { log_flush_order_mutex_enter(); - buf_flush_note_modification(block, start_lsn, end_lsn, NULL); + buf_flush_note_modification(block, start_lsn, end_lsn); log_flush_order_mutex_exit(); } else if (free_page && init) { /* There have been no operations than MLOG_INIT_FREE_PAGE. diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index 88a49ca0190..c458731c6a2 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -297,11 +297,10 @@ struct DebugCheck { /** Release a resource acquired by the mini-transaction. */ struct ReleaseBlocks { /** Release specific object */ - ReleaseBlocks(lsn_t start_lsn, lsn_t end_lsn, FlushObserver* observer) + ReleaseBlocks(lsn_t start_lsn, lsn_t end_lsn) : m_end_lsn(end_lsn), - m_start_lsn(start_lsn), - m_flush_observer(observer) + m_start_lsn(start_lsn) { /* Do nothing */ } @@ -316,8 +315,7 @@ struct ReleaseBlocks { block = reinterpret_cast<buf_block_t*>(slot->object); - buf_flush_note_modification(block, m_start_lsn, - m_end_lsn, m_flush_observer); + buf_flush_note_modification(block, m_start_lsn, m_end_lsn); } /** @return true always. */ @@ -340,9 +338,6 @@ struct ReleaseBlocks { /** Mini-transaction REDO end LSN */ lsn_t m_start_lsn; - - /** Flush observer */ - FlushObserver* m_flush_observer; }; /** Write the block contents to the REDO log */ @@ -393,7 +388,6 @@ void mtr_t::start() m_log_mode= MTR_LOG_ALL; ut_d(m_user_space_id= TRX_SYS_SPACE); m_user_space= nullptr; - m_flush_observer= nullptr; m_commit_lsn= 0; } @@ -437,8 +431,7 @@ void mtr_t::commit() log_mutex_exit(); m_memo.for_each_block_in_reverse(CIterate<const ReleaseBlocks> - (ReleaseBlocks(start_lsn, m_commit_lsn, - m_flush_observer))); + (ReleaseBlocks(start_lsn, m_commit_lsn))); if (m_made_dirty) log_flush_order_mutex_exit(); @@ -559,8 +552,7 @@ mtr_t::x_lock_space(ulint space_id, const char* file, unsigned line) space = fil_space_get(space_id); ut_ad(get_log_mode() != MTR_LOG_NO_REDO || space->purpose == FIL_TYPE_TEMPORARY - || space->purpose == FIL_TYPE_IMPORT - || space->redo_skipped_count > 0); + || space->purpose == FIL_TYPE_IMPORT); } ut_ad(space); diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index 6afa9de879d..6730d1a9a77 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -424,9 +424,7 @@ static void page_zip_compress_write_log(buf_block_t* block, /* Write the uncompressed trailer of the compressed page. */ mlog_catenate_string(mtr, page_zip->data + page_zip_get_size(page_zip) - trailer_size, trailer_size); - if (!innodb_log_optimize_ddl) { - block->page.init_on_flush = true; - } + block->page.init_on_flush = true; } /******************************************************//** diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc index ef4db392866..d8600764dc9 100644 --- a/storage/innobase/row/row0ftsort.cc +++ b/storage/innobase/row/row0ftsort.cc @@ -1640,9 +1640,7 @@ row_fts_merge_insert( == UT_BITS_IN_BYTES(aux_index->n_nullable)); /* Create bulk load instance */ - ins_ctx.btr_bulk = UT_NEW_NOKEY( - BtrBulk(aux_index, trx, psort_info[0].psort_common->trx - ->get_flush_observer())); + ins_ctx.btr_bulk = UT_NEW_NOKEY(BtrBulk(aux_index, trx)); /* Create tuple for insert */ ins_ctx.tuple = dtuple_create(heap, dict_index_get_n_fields(aux_index)); @@ -1775,9 +1773,5 @@ exit: ib::info() << "InnoDB_FTS: inserted " << count << " records"; } - if (psort_info[0].psort_common->trx->get_flush_observer()) { - row_merge_write_redo(aux_index); - } - return(error); } diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index a7ab1d12901..1c9efb37a97 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -4192,18 +4192,7 @@ row_import_for_mysql( /* Ensure that all pages dirtied during the IMPORT make it to disk. The only dirty pages generated should be from the pessimistic purge of delete marked records that couldn't be purged in Phase I. */ - - { - FlushObserver observer(prebuilt->table->space, trx, NULL); - buf_LRU_flush_or_remove_pages(prebuilt->table->space_id, - &observer); - - if (observer.is_interrupted()) { - ib::info() << "Phase III - Flush interrupted"; - return(row_import_error(prebuilt, trx, - DB_INTERRUPTED)); - } - } + buf_LRU_flush_or_remove_pages(prebuilt->table->space_id, true); ib::info() << "Phase IV - Flush complete"; prebuilt->table->space->set_imported(); diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index 9d54b1bc426..044a974f253 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -2355,15 +2355,6 @@ write_buffers: conv_heap, &err, &v_heap, eval_table, trx)))) { - /* Set the page flush observer for the - transaction when buffering the very first - record for a non-redo-logged operation. */ - if (file->n_rec == 0 && i == 0 - && innodb_log_optimize_ddl) { - trx->set_flush_observer( - new_table->space, stage); - } - /* If we are creating FTS index, a single row can generate more records for tokenized word */ @@ -2504,8 +2495,7 @@ write_buffers: if (clust_btr_bulk == NULL) { clust_btr_bulk = UT_NEW_NOKEY( BtrBulk(index[i], - trx, - trx->get_flush_observer())); + trx)); } else { clust_btr_bulk->latch(); } @@ -2620,9 +2610,7 @@ write_buffers: trx->error_key_num = i; goto all_done;); - BtrBulk btr_bulk( - index[i], trx, - trx->get_flush_observer()); + BtrBulk btr_bulk(index[i], trx); err = row_merge_insert_index_tuples( index[i], old_table, @@ -4475,26 +4463,6 @@ row_merge_drop_table( trx, SQLCOM_DROP_TABLE, false, false)); } -/** Write an MLOG_INDEX_LOAD record to indicate in the redo-log -that redo-logging of individual index pages was disabled, and -the flushing of such pages to the data files was completed. -@param[in] index an index tree on which redo logging was disabled */ -void row_merge_write_redo(const dict_index_t* index) -{ - ut_ad(!index->table->is_temporary()); - ut_ad(!(index->type & (DICT_SPATIAL | DICT_FTS))); - - mtr_t mtr; - mtr.start(); - byte* log_ptr = mlog_open(&mtr, 11 + 8); - log_ptr = mlog_write_initial_log_record_low( - MLOG_INDEX_LOAD, - index->table->space_id, index->page, log_ptr, &mtr); - mach_write_to_8(log_ptr, index->id); - mlog_close(&mtr, log_ptr + 8); - mtr.commit(); -} - /** Build indexes on a table by reading a clustered index, creating a temporary file containing index entries, merge sorting these index entries and inserting sorted index entries to indexes. @@ -4795,8 +4763,7 @@ row_merge_build_indexes( os_thread_sleep(20000000);); /* 20 sec */ if (error == DB_SUCCESS) { - BtrBulk btr_bulk(sort_idx, trx, - trx->get_flush_observer()); + BtrBulk btr_bulk(sort_idx, trx); pct_cost = (COST_BUILD_INDEX_STATIC + (total_dynamic_cost * merge_files[k].offset / @@ -4842,21 +4809,10 @@ row_merge_build_indexes( if (indexes[i]->type & DICT_FTS) { row_fts_psort_info_destroy(psort_info, merge_info); fts_psort_initiated = false; - } else if (dict_index_is_spatial(indexes[i])) { - /* We never disable redo logging for - creating SPATIAL INDEX. Avoid writing any - unnecessary MLOG_INDEX_LOAD record. */ } else if (old_table != new_table) { ut_ad(!sort_idx->online_log); ut_ad(sort_idx->online_status == ONLINE_INDEX_COMPLETE); - } else if (FlushObserver* flush_observer = - trx->get_flush_observer()) { - if (error != DB_SUCCESS) { - flush_observer->interrupted(); - } - flush_observer->flush(); - row_merge_write_redo(indexes[i]); } if (old_table != new_table @@ -4958,37 +4914,5 @@ func_exit: } DBUG_EXECUTE_IF("ib_index_crash_after_bulk_load", DBUG_SUICIDE();); - - if (FlushObserver* flush_observer = trx->get_flush_observer()) { - - DBUG_EXECUTE_IF("ib_index_build_fail_before_flush", - error = DB_INTERRUPTED; - ); - - if (error != DB_SUCCESS) { - flush_observer->interrupted(); - } - - flush_observer->flush(); - - if (old_table != new_table) { - for (const dict_index_t* index - = dict_table_get_first_index(new_table); - index != NULL; - index = dict_table_get_next_index(index)) { - if (!(index->type - & (DICT_FTS | DICT_SPATIAL))) { - row_merge_write_redo(index); - } - } - } - - trx->remove_flush_observer(); - - if (trx_is_interrupted(trx)) { - error = DB_INTERRUPTED; - } - } - DBUG_RETURN(error); } diff --git a/storage/innobase/row/row0quiesce.cc b/storage/innobase/row/row0quiesce.cc index 02c8c495e88..05c1f7a32c1 100644 --- a/storage/innobase/row/row0quiesce.cc +++ b/storage/innobase/row/row0quiesce.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2019, MariaDB Corporation. +Copyright (c) 2017, 2020, 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 @@ -535,19 +535,10 @@ row_quiesce_table_start( } if (!trx_is_interrupted(trx)) { - { - FlushObserver observer(table->space, trx, NULL); - buf_LRU_flush_or_remove_pages(table->space_id, - &observer); - } - - if (trx_is_interrupted(trx)) { - - ib::warn() << "Quiesce aborted!"; - - } else if (row_quiesce_write_cfg(table, trx->mysql_thd) - != DB_SUCCESS) { + buf_LRU_flush_or_remove_pages(table->space_id, true); + if (row_quiesce_write_cfg(table, trx->mysql_thd) + != DB_SUCCESS) { ib::warn() << "There was an error writing to the" " meta data file"; } else { diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 60ff945fc12..5757ea52891 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -620,11 +620,6 @@ PSI_stage_info srv_stage_alter_table_end = {0, "alter table (end)", PSI_FLAG_STAGE_PROGRESS}; /** Performance schema stage event for monitoring ALTER TABLE progress -log_make_checkpoint(). */ -PSI_stage_info srv_stage_alter_table_flush - = {0, "alter table (flush)", PSI_FLAG_STAGE_PROGRESS}; - -/** Performance schema stage event for monitoring ALTER TABLE progress row_merge_insert_index_tuples(). */ PSI_stage_info srv_stage_alter_table_insert = {0, "alter table (insert)", PSI_FLAG_STAGE_PROGRESS}; diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 906825326bd..91f8e83e50a 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -3,7 +3,7 @@ Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2008, Google Inc. Copyright (c) 2009, Percona Inc. -Copyright (c) 2013, 2019, MariaDB Corporation. +Copyright (c) 2013, 2020, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -186,7 +186,6 @@ performance schema. */ static PSI_stage_info* srv_stages[] = { &srv_stage_alter_table_end, - &srv_stage_alter_table_flush, &srv_stage_alter_table_insert, &srv_stage_alter_table_log_index, &srv_stage_alter_table_log_table, diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 57234b14e69..bda0b13845a 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -671,14 +671,7 @@ not_free: mini-transaction commit and the server was killed, then discarding the to-be-trimmed pages without flushing would break crash recovery. So, we cannot avoid the write. */ - { - FlushObserver observer( - purge_sys.truncate.current, - UT_LIST_GET_FIRST(purge_sys.query->thrs) - ->graph->trx, - NULL); - buf_LRU_flush_or_remove_pages(space.id, &observer); - } + buf_LRU_flush_or_remove_pages(space.id, true); log_free_check(); diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 0f4df89e068..c5e48ff65ab 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2019, MariaDB Corporation. +Copyright (c) 2015, 2020, 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 @@ -161,8 +161,6 @@ trx_init( trx->lock.rec_cached = 0; trx->lock.table_cached = 0; - - ut_ad(trx->get_flush_observer() == NULL); } /** For managing the life-cycle of the trx_t instance that we get @@ -902,21 +900,6 @@ static trx_rseg_t* trx_assign_rseg_low() return(rseg); } -/** Set the innodb_log_optimize_ddl page flush observer -@param[in,out] space tablespace -@param[in,out] stage performance_schema accounting */ -void trx_t::set_flush_observer(fil_space_t* space, ut_stage_alter_t* stage) -{ - flush_observer = UT_NEW_NOKEY(FlushObserver(space, this, stage)); -} - -/** Remove the flush observer */ -void trx_t::remove_flush_observer() -{ - UT_DELETE(flush_observer); - flush_observer = NULL; -} - /** Assign a rollback segment for modifying temporary tables. @return the assigned rollback segment */ trx_rseg_t* diff --git a/storage/innobase/trx/trx0undo.cc b/storage/innobase/trx/trx0undo.cc index bcd21d7f250..8f8fc183769 100644 --- a/storage/innobase/trx/trx0undo.cc +++ b/storage/innobase/trx/trx0undo.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2019, MariaDB Corporation. +Copyright (c) 2014, 2020, 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 @@ -752,7 +752,7 @@ trx_undo_free_page( fseg_free_page(TRX_UNDO_SEG_HDR + TRX_UNDO_FSEG_HEADER + header_block->frame, - rseg->space, page_no, false, true, mtr); + rseg->space, page_no, false, mtr); const fil_addr_t last_addr = flst_get_last( TRX_UNDO_SEG_HDR + TRX_UNDO_PAGE_LIST + header_block->frame); |