diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2022-02-04 14:11:46 +0100 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2022-02-04 14:11:46 +0100 |
commit | 9ed8deb656d9378fc9c1c7fb12c15674b6323ab0 (patch) | |
tree | 5bc8e7e4182b9e5da99d2a2ba40736f3ac450efe /storage/innobase | |
parent | 3351dfaab0599268eaf25f9d6995ef128910a8b9 (diff) | |
parent | d87979b48c614dbba4afd1b235307ee354c27719 (diff) | |
download | mariadb-git-9ed8deb656d9378fc9c1c7fb12c15674b6323ab0.tar.gz |
Merge branch '10.6' into 10.7
Diffstat (limited to 'storage/innobase')
124 files changed, 500 insertions, 483 deletions
diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index 5c138d41f58..702bb843729 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -78,19 +78,19 @@ SET(INNOBASE_SOURCES handler/i_s.cc ibuf/ibuf0ibuf.cc include/btr0btr.h - include/btr0btr.ic + include/btr0btr.inl include/btr0bulk.h include/btr0cur.h - include/btr0cur.ic + include/btr0cur.inl include/btr0defragment.h include/btr0pcur.h - include/btr0pcur.ic + include/btr0pcur.inl include/btr0sea.h - include/btr0sea.ic + include/btr0sea.inl include/btr0types.h include/buf0buddy.h include/buf0buf.h - include/buf0buf.ic + include/buf0buf.inl include/buf0checksum.h include/buf0dblwr.h include/buf0dump.h @@ -99,36 +99,36 @@ SET(INNOBASE_SOURCES include/buf0rea.h include/buf0types.h include/data0data.h - include/data0data.ic + include/data0data.inl include/data0type.h - include/data0type.ic + include/data0type.inl include/data0types.h include/db0err.h include/dict0boot.h include/dict0crea.h - include/dict0crea.ic + include/dict0crea.inl include/dict0defrag_bg.h include/dict0dict.h - include/dict0dict.ic + include/dict0dict.inl include/dict0load.h include/dict0mem.h - include/dict0mem.ic + include/dict0mem.inl include/dict0pagecompress.h - include/dict0pagecompress.ic + include/dict0pagecompress.inl include/dict0stats.h - include/dict0stats.ic + include/dict0stats.inl include/dict0stats_bg.h include/dict0types.h include/dyn0buf.h include/dyn0types.h include/eval0eval.h - include/eval0eval.ic + include/eval0eval.inl include/eval0proc.h - include/eval0proc.ic + include/eval0proc.inl include/fil0crypt.h - include/fil0crypt.ic + include/fil0crypt.inl include/fil0fil.h - include/fil0fil.ic + include/fil0fil.inl include/fil0pagecompress.h include/fsp0file.h include/fsp0fsp.h @@ -142,97 +142,97 @@ SET(INNOBASE_SOURCES include/fts0pars.h include/fts0plugin.h include/fts0priv.h - include/fts0priv.ic + include/fts0priv.inl include/fts0tlex.h include/fts0tokenize.h include/fts0types.h - include/fts0types.ic + include/fts0types.inl include/fts0vlc.h include/fut0fut.h include/fut0lst.h include/gis0geo.h include/gis0rtree.h - include/gis0rtree.ic + include/gis0rtree.inl include/gis0type.h include/ha_prototypes.h include/ha0ha.h - include/ha0ha.ic + include/ha0ha.inl include/ha0storage.h - include/ha0storage.ic + include/ha0storage.inl include/handler0alter.h include/hash0hash.h include/ibuf0ibuf.h - include/ibuf0ibuf.ic + include/ibuf0ibuf.inl/ include/ibuf0types.h include/lock0iter.h include/lock0lock.h - include/lock0lock.ic + include/lock0lock.inl include/lock0prdt.h include/lock0priv.h - include/lock0priv.ic + include/lock0priv.inl include/lock0types.h include/log0crypt.h include/log0log.h - include/log0log.ic + include/log0log.inl include/log0recv.h include/log0types.h include/mach0data.h - include/mach0data.ic + include/mach0data.inl include/mem0mem.h - include/mem0mem.ic + include/mem0mem.inl include/mtr0log.h include/mtr0mtr.h - include/mtr0mtr.ic + include/mtr0mtr.inl include/mtr0types.h include/os0file.h - include/os0file.ic + include/os0file.inl include/os0thread.h include/page0cur.h - include/page0cur.ic + include/page0cur.inl include/page0page.h - include/page0page.ic + include/page0page.inl include/page0types.h include/page0zip.h - include/page0zip.ic + include/page0zip.inl include/pars0grm.h include/pars0opt.h include/pars0pars.h include/pars0sym.h include/pars0types.h include/que0que.h - include/que0que.ic + include/que0que.inl include/que0types.h include/read0types.h include/rem0cmp.h - include/rem0cmp.ic + include/rem0cmp.inl include/rem0rec.h - include/rem0rec.ic + include/rem0rec.inl include/rem0types.h include/row0ext.h - include/row0ext.ic + include/row0ext.inl include/row0ftsort.h include/row0import.h include/row0ins.h include/row0log.h - include/row0log.ic + include/row0log.inl include/row0merge.h include/row0mysql.h include/row0purge.h include/row0quiesce.h include/row0row.h - include/row0row.ic + include/row0row.inl include/row0sel.h - include/row0sel.ic + include/row0sel.inl include/row0types.h include/row0uins.h include/row0umod.h include/row0undo.h include/row0upd.h - include/row0upd.ic + include/row0upd.inl include/row0vers.h include/rw_lock.h include/srv0mon.h - include/srv0mon.ic + include/srv0mon.inl include/srv0srv.h include/srv0start.h include/srw_lock.h @@ -240,38 +240,38 @@ SET(INNOBASE_SOURCES include/trx0i_s.h include/trx0purge.h include/trx0rec.h - include/trx0rec.ic + include/trx0rec.inl include/trx0roll.h include/trx0rseg.h - include/trx0rseg.ic + include/trx0rseg.inl include/trx0sys.h include/trx0trx.h - include/trx0trx.ic + include/trx0trx.inl include/trx0types.h include/trx0undo.h - include/trx0undo.ic + include/trx0undo.inl include/trx0xa.h include/univ.i include/ut0byte.h - include/ut0byte.ic + include/ut0byte.inl include/ut0counter.h include/ut0dbg.h include/ut0list.h - include/ut0list.ic + include/ut0list.inl include/ut0lst.h include/ut0mem.h - include/ut0mem.ic + include/ut0mem.inl include/ut0new.h include/ut0pool.h include/ut0rbt.h include/ut0rnd.h - include/ut0rnd.ic + include/ut0rnd.inl include/ut0sort.h include/ut0stage.h include/ut0ut.h - include/ut0ut.ic + include/ut0ut.inl include/ut0vec.h - include/ut0vec.ic + include/ut0vec.inl include/ut0wqueue.h lock/lock0iter.cc lock/lock0prdt.cc diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 88493e2b54d..e15d7b7140a 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -2647,7 +2647,6 @@ loop: } } else { buf_read_ahead_random(page_id, zip_size, ibuf_inside(mtr)); - retries = 0; } ut_d(if (!(++buf_dbg_counter % 5771)) buf_pool.validate()); @@ -2666,15 +2665,45 @@ ignore_block: return nullptr; } - if (UNIV_LIKELY(block->page.frame != nullptr)) { - /* A read-fix is released after block->page.lock - in buf_page_t::read_complete() or - buf_pool_t::corrupted_evict(), or - after buf_zip_decompress() in this function. */ - block->page.lock.s_lock(); - state = block->page.state(); - block->page.lock.s_unlock(); - ut_ad(state < buf_page_t::READ_FIX); + /* A read-fix is released after block->page.lock + in buf_page_t::read_complete() or + buf_pool_t::corrupted_evict(), or + after buf_zip_decompress() in this function. */ + block->page.lock.s_lock(); + state = block->page.state(); + ut_ad(state < buf_page_t::READ_FIX); + const page_id_t id{block->page.id()}; + block->page.lock.s_unlock(); + + if (UNIV_UNLIKELY(id != page_id)) { + ut_ad(id == page_id_t{~0ULL}); + block->page.unfix(); + if (++retries < BUF_PAGE_READ_MAX_RETRIES) { + goto loop; + } + + if (err) { + *err = DB_PAGE_CORRUPTED; + } + + if (page_id.space() == TRX_SYS_SPACE) { + } else if (page_id.space() == SRV_TMP_SPACE_ID) { + } else if (fil_space_t* space = + fil_space_t::get(page_id.space())) { + bool set = dict_set_corrupted_by_space(space); + space->release(); + if (set) { + return nullptr; + } + } + + ib::fatal() << "Unable to read page " << page_id + << " into the buffer pool after " + << BUF_PAGE_READ_MAX_RETRIES + << ". The most probable cause" + " of this error may be that the" + " table has been corrupted." + " See https://mariadb.com/kb/en/library/innodb-recovery-modes/"; } } else if (mode == BUF_PEEK_IF_IN_POOL) { if (UNIV_UNLIKELY(!block->page.frame)) { diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 28f03eedac9..fdc73128bb7 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -83,12 +83,6 @@ static struct ulint flush_pass; } page_cleaner; -/** If LRU list of a buf_pool is less than this size then LRU eviction -should not happen. This is because when we do LRU flushing we also put -the blocks on free list. If LRU list is very small then we can end up -in thrashing. */ -#define BUF_LRU_MIN_LEN 256 - /* @} */ #ifdef UNIV_DEBUG @@ -1234,9 +1228,11 @@ static void buf_flush_LRU_list_batch(ulint max, flush_counters_t *n) static_assert(FIL_NULL > SRV_SPACE_ID_UPPER_BOUND, "consistency"); for (buf_page_t *bpage= UT_LIST_GET_LAST(buf_pool.LRU); - bpage && n->flushed + n->evicted < max && - UT_LIST_GET_LEN(buf_pool.LRU) > BUF_LRU_MIN_LEN && - UT_LIST_GET_LEN(buf_pool.free) < free_limit; ++scanned) + bpage && + ((UT_LIST_GET_LEN(buf_pool.LRU) > BUF_LRU_MIN_LEN && + UT_LIST_GET_LEN(buf_pool.free) < free_limit && + n->flushed + n->evicted < max) || + recv_recovery_is_on()); ++scanned) { buf_page_t *prev= UT_LIST_GET_PREV(LRU, bpage); const lsn_t oldest_modification= bpage->oldest_modification(); diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index a990a518d5b..bb820374266 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -2,7 +2,7 @@ Copyright (c) 1996, 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 @@ -4269,8 +4269,6 @@ dict_index_set_merge_threshold( mtr.start(); - dict_sys.lock(SRW_LOCK_CALL); - sys_index = UT_LIST_GET_FIRST(dict_sys.sys_indexes->indexes); /* Find the index row in SYS_INDEXES */ @@ -4306,8 +4304,6 @@ dict_index_set_merge_threshold( mtr_commit(&mtr); mem_heap_free(heap); - - dict_sys.unlock(); } #ifdef UNIV_DEBUG diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc index 1a8d5764d0f..f4a42555f1d 100644 --- a/storage/innobase/dict/dict0mem.cc +++ b/storage/innobase/dict/dict0mem.cc @@ -1197,8 +1197,9 @@ bool dict_foreign_t::affects_fulltext() const return false; } -/** Reconstruct the clustered index fields. */ -inline void dict_index_t::reconstruct_fields() +/** Reconstruct the clustered index fields. +@return whether metadata is incorrect */ +inline bool dict_index_t::reconstruct_fields() { DBUG_ASSERT(is_primary()); @@ -1232,10 +1233,14 @@ inline void dict_index_t::reconstruct_fields() fields + n_first, fields + n_fields, [c](const dict_field_t& o) { return o.col->ind == c.ind(); }); + + if (old >= fields + n_fields + || old->prefix_len + || old->col != &table->cols[c.ind()]) { + return true; + } + ut_ad(old >= &fields[n_first]); - ut_ad(old < &fields[n_fields]); - DBUG_ASSERT(!old->prefix_len); - DBUG_ASSERT(old->col == &table->cols[c.ind()]); f = *old; } @@ -1248,6 +1253,8 @@ inline void dict_index_t::reconstruct_fields() fields = tfields; n_core_null_bytes = static_cast<byte>(UT_BITS_IN_BYTES(n_core_null)); + + return false; } /** Reconstruct dropped or reordered columns. @@ -1312,8 +1319,7 @@ bool dict_table_t::deserialise_columns(const byte* metadata, ulint len) } DBUG_ASSERT(col == &dropped_cols[n_dropped_cols]); - UT_LIST_GET_FIRST(indexes)->reconstruct_fields(); - return false; + return UT_LIST_GET_FIRST(indexes)->reconstruct_fields(); } /** Check if record in clustered index is historical row. diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 0007fde5f43..37ac293c259 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -2059,6 +2059,9 @@ err_exit: } } + DBUG_EXECUTE_IF("checkpoint_after_file_create", + log_make_checkpoint();); + if (fil_space_t* space = fil_space_t::create(space_id, flags, FIL_TYPE_TABLESPACE, crypt_data, mode)) { @@ -2403,6 +2406,7 @@ fil_ibd_discover( switch (srv_operation) { case SRV_OPERATION_BACKUP: case SRV_OPERATION_RESTORE_DELTA: + case SRV_OPERATION_BACKUP_NO_DEFER: ut_ad(0); break; case SRV_OPERATION_RESTORE_EXPORT: diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index b7af3dab2c4..6f9cdfbedb7 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -32,7 +32,7 @@ Full Text Search interface #include "fts0fts.h" #include "fts0priv.h" #include "fts0types.h" -#include "fts0types.ic" +#include "fts0types.inl" #include "fts0vlc.h" #include "fts0plugin.h" #include "dict0stats.h" @@ -223,9 +223,7 @@ ulint fts_add_doc_by_id( /*==============*/ fts_trx_table_t*ftt, /*!< in: FTS trx table */ - doc_id_t doc_id, /*!< in: doc id */ - ib_vector_t* fts_indexes MY_ATTRIBUTE((unused))); - /*!< in: affected fts indexes */ + doc_id_t doc_id); /*!< in: doc id */ /******************************************************************//** Update the last document id. This function could create a new transaction to update the last document id. @@ -2775,7 +2773,7 @@ fts_add( ut_a(row->state == FTS_INSERT || row->state == FTS_MODIFY); - fts_add_doc_by_id(ftt, doc_id, row->fts_indexes); + fts_add_doc_by_id(ftt, doc_id); mysql_mutex_lock(&table->fts->cache->deleted_lock); ++table->fts->cache->added; @@ -3331,9 +3329,7 @@ ulint fts_add_doc_by_id( /*==============*/ fts_trx_table_t*ftt, /*!< in: FTS trx table */ - doc_id_t doc_id, /*!< in: doc id */ - ib_vector_t* fts_indexes MY_ATTRIBUTE((unused))) - /*!< in: affected fts indexes */ + doc_id_t doc_id) /*!< in: doc id */ { mtr_t mtr; mem_heap_t* heap; @@ -4570,7 +4566,7 @@ fts_tokenize_add_word_for_parser( ut_ad(boolean_info->position >= 0); position = boolean_info->position + fts_param->add_pos; */ - position = fts_param->add_pos; + position = fts_param->add_pos++; fts_add_token(result_doc, str, position); diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc index 8097fbe2011..f389851a4ea 100644 --- a/storage/innobase/gis/gis0rtree.cc +++ b/storage/innobase/gis/gis0rtree.cc @@ -1169,15 +1169,6 @@ after_insert: page_zip = buf_block_get_page_zip(root_block); page_set_ssn_id(root_block, page_zip, next_ssn, mtr); - /* Insert fit on the page: update the free bits for the - left and right pages in the same mtr */ - - if (page_is_leaf(page)) { - ibuf_update_free_bits_for_two_pages_low( - block, new_block, mtr); - } - - /* If the new res insert fail, we need to do another split again. */ if (!rec) { diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 6c4487f20f0..56bea723dc8 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3671,6 +3671,59 @@ static int innodb_init_abort() DBUG_RETURN(1); } +/** Return the minimum buffer pool size based on page size */ +static inline ulint min_buffer_pool_size() +{ + ulint s= (BUF_LRU_MIN_LEN + BUF_LRU_MIN_LEN / 4) * srv_page_size; + /* buf_pool_chunk_size minimum is 1M, so round up to a multiple */ + ulint alignment= 1U << 20; + return UT_CALC_ALIGN(s, alignment); +} + +/** Validate the requested buffer pool size. Also, reserve the necessary +memory needed for buffer pool resize. +@param[in] thd thread handle +@param[in] var pointer to system variable +@param[out] save immediate result for update function +@param[in] value incoming string +@return 0 on success, 1 on failure. +*/ +static +int +innodb_buffer_pool_size_validate( + THD* thd, + struct st_mysql_sys_var* var, + void* save, + struct st_mysql_value* value); + +/** Update the system variable innodb_buffer_pool_size using the "saved" +value. This function is registered as a callback with MySQL. +@param[in] thd thread handle +@param[in] var pointer to system variable +@param[out] var_ptr where the formal string goes +@param[in] save immediate result from check function */ +static +void +innodb_buffer_pool_size_update( + THD* thd, + struct st_mysql_sys_var* var, + void* var_ptr, + const void* save); + +/* If the default value of innodb_buffer_pool_size is increased to be more than +BUF_POOL_SIZE_THRESHOLD (srv/srv0start.cc), then srv_buf_pool_instances_default +can be removed and 8 used instead. The problem with the current setup is that +with 128MiB default buffer pool size and 8 instances by default we would emit +a warning when no options are specified. */ +static MYSQL_SYSVAR_ULONGLONG(buffer_pool_size, innobase_buffer_pool_size, + PLUGIN_VAR_RQCMDARG, + "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.", + innodb_buffer_pool_size_validate, + innodb_buffer_pool_size_update, + 128ULL << 20, + 2ULL << 20, + LLONG_MAX, 1024*1024L); + /****************************************************************//** Gives the file extension of an InnoDB single-table tablespace. */ static const char* ha_innobase_exts[] = { @@ -3773,12 +3826,15 @@ static int innodb_init_params() /* The buffer pool needs to be able to accommodate enough many pages, even for larger pages */ - if (srv_page_size > UNIV_PAGE_SIZE_DEF - && innobase_buffer_pool_size < (24 * 1024 * 1024)) { + MYSQL_SYSVAR_NAME(buffer_pool_size).min_val= min_buffer_pool_size(); + + if (innobase_buffer_pool_size < MYSQL_SYSVAR_NAME(buffer_pool_size).min_val) { ib::error() << "innodb_page_size=" << srv_page_size << " requires " - << "innodb_buffer_pool_size > 24M current " - << innobase_buffer_pool_size; + << "innodb_buffer_pool_size >= " + << (MYSQL_SYSVAR_NAME(buffer_pool_size).min_val >> 20) + << "MiB current " << (innobase_buffer_pool_size >> 20) + << "MiB"; DBUG_RETURN(HA_ERR_INITIALIZATION); } @@ -11180,9 +11236,12 @@ create_table_info_t::create_options_are_invalid() break; } - if (m_create_info->data_file_name - && m_create_info->data_file_name[0] != '\0' - && !create_option_data_directory_is_valid()) { + if (!m_create_info->data_file_name + || !m_create_info->data_file_name[0]) { + } else if (!my_use_symdir) { + my_error(WARN_OPTION_IGNORED, MYF(ME_WARNING), + "DATA DIRECTORY"); + } else if (!create_option_data_directory_is_valid()) { ret = "DATA DIRECTORY"; } @@ -11454,7 +11513,8 @@ create_table_info_t::parse_table_name( CREATE TABLE ... DATA DIRECTORY={path} TABLESPACE={name}... ; we ignore the DATA DIRECTORY. */ if (m_create_info->data_file_name - && m_create_info->data_file_name[0] != '\0') { + && m_create_info->data_file_name[0] + && my_use_symdir) { if (!create_option_data_directory_is_valid()) { push_warning_printf( m_thd, Sql_condition::WARN_LEVEL_WARN, @@ -11914,8 +11974,9 @@ create_table_info_t::set_tablespace_type( used with TEMPORARY tables. */ m_use_data_dir = m_use_file_per_table - && (m_create_info->data_file_name != NULL) - && (m_create_info->data_file_name[0] != '\0'); + && m_create_info->data_file_name + && m_create_info->data_file_name[0] + && my_use_symdir; } /** Initialize the create_table_info_t object. @@ -19031,31 +19092,6 @@ static MYSQL_SYSVAR_UINT(autoextend_increment, "Data file autoextend increment in megabytes", NULL, NULL, 64, 1, 1000, 0); -/** Validate the requested buffer pool size. Also, reserve the necessary -memory needed for buffer pool resize. -@param[in] thd thread handle -@param[in] var pointer to system variable -@param[out] save immediate result for update function -@param[in] value incoming string -@return 0 on success, 1 on failure. -*/ -static -int -innodb_buffer_pool_size_validate( - THD* thd, - struct st_mysql_sys_var* var, - void* save, - struct st_mysql_value* value); - -static MYSQL_SYSVAR_ULONGLONG(buffer_pool_size, innobase_buffer_pool_size, - PLUGIN_VAR_RQCMDARG, - "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.", - innodb_buffer_pool_size_validate, - innodb_buffer_pool_size_update, - srv_buf_pool_def_size, - srv_buf_pool_min_size, - LLONG_MAX, 1024*1024L); - static MYSQL_SYSVAR_ULONG(buffer_pool_chunk_size, srv_buf_pool_chunk_unit, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "Size of a single memory chunk" @@ -19580,8 +19616,8 @@ static MYSQL_SYSVAR_BOOL(read_only, srv_read_only_mode, static MYSQL_SYSVAR_BOOL(read_only_compressed, innodb_read_only_compressed, PLUGIN_VAR_OPCMDARG, - "Make ROW_FORMAT=COMPRESSED tables read-only (ON by default)", - NULL, NULL, TRUE); + "Make ROW_FORMAT=COMPRESSED tables read-only", + NULL, NULL, FALSE); static MYSQL_SYSVAR_BOOL(cmp_per_index_enabled, srv_cmp_per_index_enabled, PLUGIN_VAR_OPCMDARG, @@ -20842,8 +20878,19 @@ innodb_buffer_pool_size_validate( struct st_mysql_value* value) { longlong intbuf; + value->val_int(value, &intbuf); + if (static_cast<ulonglong>(intbuf) < MYSQL_SYSVAR_NAME(buffer_pool_size).min_val) { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_WRONG_ARGUMENTS, + "innodb_buffer_pool_size must be at least" + " %lld for innodb_page_size=%lu", + MYSQL_SYSVAR_NAME(buffer_pool_size).min_val, + srv_page_size); + return(1); + } + if (!srv_was_started) { push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_WRONG_ARGUMENTS, @@ -21212,3 +21259,21 @@ void ins_node_t::vers_update_end(row_prebuilt_t *prebuilt, bool history_row) if (UNIV_LIKELY_NULL(local_heap)) mem_heap_free(local_heap); } + +/** Calculate aligned buffer pool size based on srv_buf_pool_chunk_unit, +if needed. +@param[in] size size in bytes +@return aligned size */ +ulint +buf_pool_size_align( + ulint size) +{ + const ulong m = srv_buf_pool_chunk_unit; + size = ut_max((size_t) size, (size_t) MYSQL_SYSVAR_NAME(buffer_pool_size).min_val); + + if (size % m == 0) { + return(size); + } else { + return (ulint)((size / m + 1) * m); + } +} diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 075239306b0..1965994ac37 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -8815,6 +8815,14 @@ free_and_exit: dict_sys.lock(SRW_LOCK_CALL); + if (ctx->add_vcol) + { + for (ulint i = 0; i < ctx->num_to_add_vcol; i++) + ctx->add_vcol[i].~dict_v_col_t(); + ctx->num_to_add_vcol= 0; + ctx->add_vcol= nullptr; + } + for (ulint i= 0; i < ctx->num_to_add_fk; i++) dict_foreign_free(ctx->add_fk[i]); /* Clear the to_be_dropped flags in the data dictionary cache. diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 717427c9f38..3aeb54fb8d5 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -318,7 +318,7 @@ static ST_FIELD_INFO innodb_trx_fields_info[]= #define IDX_TRX_ISOLATION_LEVEL 16 Column("trx_isolation_level", - Enum(&isolation_level_values_typelib), NOT_NULL, DEFAULT_NONE), + Enum(&isolation_level_values_typelib), NOT_NULL), #define IDX_TRX_UNIQUE_CHECKS 17 Column("trx_unique_checks", SLong(1), NOT_NULL), @@ -596,10 +596,10 @@ static ST_FIELD_INFO innodb_locks_fields_info[]= Column("lock_trx_id", ULonglong(), NOT_NULL), #define IDX_LOCK_MODE 2 - Column("lock_mode", Enum(&lock_mode_values_typelib), NOT_NULL, DEFAULT_NONE), + Column("lock_mode", Enum(&lock_mode_values_typelib), NOT_NULL), #define IDX_LOCK_TYPE 3 - Column("lock_type", Enum(&lock_type_values_typelib), NOT_NULL, DEFAULT_NONE), + Column("lock_type", Enum(&lock_type_values_typelib), NOT_NULL), #define IDX_LOCK_TABLE 4 Column("lock_table", Varchar(1024), NOT_NULL), @@ -1882,7 +1882,7 @@ static ST_FIELD_INFO innodb_metrics_fields_info[]= Column("ENABLED", SLong(1), NOT_NULL), #define METRIC_TYPE 15 - Column("TYPE", Enum(&metric_type_values_typelib), NOT_NULL, DEFAULT_NONE), + Column("TYPE", Enum(&metric_type_values_typelib), NOT_NULL), #define METRIC_DESC 16 Column("COMMENT", Varchar(NAME_LEN + 1), NOT_NULL), @@ -3874,10 +3874,10 @@ static ST_FIELD_INFO i_s_innodb_buffer_page_fields_info[]= Column("COMPRESSED_SIZE", ULonglong(), NOT_NULL), #define IDX_BUFFER_PAGE_STATE 15 + I_S_AHI - Column("PAGE_STATE", Enum(&page_state_values_typelib), NOT_NULL, DEFAULT_NONE), + Column("PAGE_STATE", Enum(&page_state_values_typelib), NOT_NULL), #define IDX_BUFFER_PAGE_IO_FIX 16 + I_S_AHI - Column("IO_FIX", Enum(&io_values_typelib), NOT_NULL, DEFAULT_NONE), + Column("IO_FIX", Enum(&io_values_typelib), NOT_NULL), #define IDX_BUFFER_PAGE_IS_OLD 17 + I_S_AHI Column("IS_OLD", SLong(1), NOT_NULL), @@ -4391,7 +4391,7 @@ static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] = Column("COMPRESSED", SLong(1), NOT_NULL), #define IDX_BUF_LRU_PAGE_IO_FIX 16 + I_S_AHI - Column("IO_FIX", Enum(&io_values_typelib), NOT_NULL, DEFAULT_NONE), + Column("IO_FIX", Enum(&io_values_typelib), NOT_NULL), #define IDX_BUF_LRU_PAGE_IS_OLD 17 + I_S_AHI Column("IS_OLD", SLong(1), NULLABLE), diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h index 95e148bee54..8644acb0831 100644 --- a/storage/innobase/include/btr0btr.h +++ b/storage/innobase/include/btr0btr.h @@ -676,7 +676,7 @@ btr_lift_page_up( #define BTR_N_LEAF_PAGES 1 #define BTR_TOTAL_SIZE 2 -#include "btr0btr.ic" +#include "btr0btr.inl" /**************************************************************** Global variable controlling if scrubbing should be performed */ diff --git a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0btr.inl index f92622cc400..f92622cc400 100644 --- a/storage/innobase/include/btr0btr.ic +++ b/storage/innobase/include/btr0btr.inl diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index 778b8cd04e8..f5f1c972957 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -933,6 +933,6 @@ extern ulint btr_cur_n_sea_old; extern uint btr_cur_limit_optimistic_insert_debug; #endif /* UNIV_DEBUG */ -#include "btr0cur.ic" +#include "btr0cur.inl" #endif diff --git a/storage/innobase/include/btr0cur.ic b/storage/innobase/include/btr0cur.inl index 76a2d3be49c..76a2d3be49c 100644 --- a/storage/innobase/include/btr0cur.ic +++ b/storage/innobase/include/btr0cur.inl diff --git a/storage/innobase/include/btr0pcur.h b/storage/innobase/include/btr0pcur.h index 45406bd4b6f..56e482d55cc 100644 --- a/storage/innobase/include/btr0pcur.h +++ b/storage/innobase/include/btr0pcur.h @@ -497,6 +497,6 @@ inline rec_t *btr_pcur_get_rec(const btr_pcur_t *cursor) return cursor->btr_cur.page_cur.rec; } -#include "btr0pcur.ic" +#include "btr0pcur.inl" #endif diff --git a/storage/innobase/include/btr0pcur.ic b/storage/innobase/include/btr0pcur.inl index f5e59c7268e..f5e59c7268e 100644 --- a/storage/innobase/include/btr0pcur.ic +++ b/storage/innobase/include/btr0pcur.inl diff --git a/storage/innobase/include/btr0sea.h b/storage/innobase/include/btr0sea.h index b45183a6428..106582286a9 100644 --- a/storage/innobase/include/btr0sea.h +++ b/storage/innobase/include/btr0sea.h @@ -394,6 +394,6 @@ again set this much timeout. This is to reduce contention. */ #define BTR_SEA_TIMEOUT 10000 #endif /* BTR_CUR_HASH_ADAPT */ -#include "btr0sea.ic" +#include "btr0sea.inl" #endif diff --git a/storage/innobase/include/btr0sea.ic b/storage/innobase/include/btr0sea.inl index 5a8d648029a..5a8d648029a 100644 --- a/storage/innobase/include/btr0sea.ic +++ b/storage/innobase/include/btr0sea.inl diff --git a/storage/innobase/include/buf0buddy.h b/storage/innobase/include/buf0buddy.h index cba31074413..bb9994203d6 100644 --- a/storage/innobase/include/buf0buddy.h +++ b/storage/innobase/include/buf0buddy.h @@ -88,5 +88,4 @@ bool buf_buddy_realloc(void* buf, ulint size); /** Combine all pairs of free buddies. */ void buf_buddy_condense_free(); - #endif /* buf0buddy_h */ diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 3fb61639e84..703087d1b7f 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -68,6 +68,12 @@ struct fil_addr_t; #define BUF_EVICT_IF_IN_POOL 20 /*!< evict a clean block if found */ /* @} */ +/** If LRU list of a buf_pool is less than this size then LRU eviction +should not happen. This is because when we do LRU flushing we also put +the blocks on free list. If LRU list is very small then we can end up +in thrashing. */ +#define BUF_LRU_MIN_LEN 256 + /** This structure defines information we will fetch from each buffer pool. It will be used to print table IO stats */ struct buf_pool_info_t @@ -484,7 +490,6 @@ ATTRIBUTE_COLD void buf_page_monitor(const buf_page_t &bpage, bool read); if needed. @param[in] size size in bytes @return aligned size */ -UNIV_INLINE ulint buf_pool_size_align( ulint size); @@ -2194,7 +2199,7 @@ struct CheckUnzipLRUAndLRUList { }; #endif /* UNIV_DEBUG */ -#include "buf0buf.ic" +#include "buf0buf.inl" #endif /* !UNIV_INNOCHECKSUM */ diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.inl index 5baee629dde..3c4da98f83b 100644 --- a/storage/innobase/include/buf0buf.ic +++ b/storage/innobase/include/buf0buf.inl @@ -142,21 +142,3 @@ buf_block_get_modify_clock( return(block->modify_clock); } -/** Calculate aligned buffer pool size based on srv_buf_pool_chunk_unit, -if needed. -@param[in] size size in bytes -@return aligned size */ -UNIV_INLINE -ulint -buf_pool_size_align( - ulint size) -{ - const ulong m = srv_buf_pool_chunk_unit; - size = ut_max(size, srv_buf_pool_min_size); - - if (size % m == 0) { - return(size); - } else { - return (ulint)((size / m + 1) * m); - } -} diff --git a/storage/innobase/include/data0data.h b/storage/innobase/include/data0data.h index fc774b6ee60..c2b8c3e00b6 100644 --- a/storage/innobase/include/data0data.h +++ b/storage/innobase/include/data0data.h @@ -705,6 +705,6 @@ struct big_rec_t { ulint n_fld); }; -#include "data0data.ic" +#include "data0data.inl" #endif diff --git a/storage/innobase/include/data0data.ic b/storage/innobase/include/data0data.inl index 2d1bf5a2d50..2d1bf5a2d50 100644 --- a/storage/innobase/include/data0data.ic +++ b/storage/innobase/include/data0data.inl diff --git a/storage/innobase/include/data0type.h b/storage/innobase/include/data0type.h index 333210b4779..5c79458e5a9 100644 --- a/storage/innobase/include/data0type.h +++ b/storage/innobase/include/data0type.h @@ -588,6 +588,6 @@ static const byte REC_INFO_METADATA_ADD static const byte REC_INFO_METADATA_ALTER = REC_INFO_METADATA_ADD | REC_INFO_DELETED_FLAG; -#include "data0type.ic" +#include "data0type.inl" #endif diff --git a/storage/innobase/include/data0type.ic b/storage/innobase/include/data0type.inl index 06d90959855..06d90959855 100644 --- a/storage/innobase/include/data0type.ic +++ b/storage/innobase/include/data0type.inl diff --git a/storage/innobase/include/dict0crea.h b/storage/innobase/include/dict0crea.h index 0267f1bae69..cc7ccbfb9d8 100644 --- a/storage/innobase/include/dict0crea.h +++ b/storage/innobase/include/dict0crea.h @@ -272,6 +272,6 @@ dict_get_v_col_pos( #define INDEX_CREATE_INDEX_TREE 3 #define INDEX_ADD_TO_CACHE 4 -#include "dict0crea.ic" +#include "dict0crea.inl" #endif diff --git a/storage/innobase/include/dict0crea.ic b/storage/innobase/include/dict0crea.inl index 5641206d313..5641206d313 100644 --- a/storage/innobase/include/dict0crea.ic +++ b/storage/innobase/include/dict0crea.inl diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 505fe76b008..7493359e16a 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -1814,6 +1814,6 @@ bool dict_table_have_virtual_index( dict_table_t* table); -#include "dict0dict.ic" +#include "dict0dict.inl" #endif diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.inl index 8af2d93f831..8af2d93f831 100644 --- a/storage/innobase/include/dict0dict.ic +++ b/storage/innobase/include/dict0dict.inl diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 744ef5316ef..0b690bb865e 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -1307,8 +1307,9 @@ public: ulint get_new_n_vcol() const { return new_vcol_info ? new_vcol_info->n_v_col : 0; } - /** Reconstruct the clustered index fields. */ - inline void reconstruct_fields(); + /** Reconstruct the clustered index fields. + @return whether metadata is incorrect */ + inline bool reconstruct_fields(); /** Check if the index contains a column or a prefix of that column. @param[in] n column number @@ -2556,6 +2557,6 @@ inline void dict_stats_empty_defrag_stats(dict_index_t* index) index->stat_defrag_n_page_split = 0; } -#include "dict0mem.ic" +#include "dict0mem.inl" #endif /* dict0mem_h */ diff --git a/storage/innobase/include/dict0mem.ic b/storage/innobase/include/dict0mem.inl index d60ee5d9bf4..d60ee5d9bf4 100644 --- a/storage/innobase/include/dict0mem.ic +++ b/storage/innobase/include/dict0mem.inl diff --git a/storage/innobase/include/dict0pagecompress.h b/storage/innobase/include/dict0pagecompress.h index dfa6f2a244d..f1272dc447d 100644 --- a/storage/innobase/include/dict0pagecompress.h +++ b/storage/innobase/include/dict0pagecompress.h @@ -56,6 +56,6 @@ dict_table_page_compression_level( const dict_table_t* table) /*!< in: table */ __attribute__((const)); -#include "dict0pagecompress.ic" +#include "dict0pagecompress.inl" #endif diff --git a/storage/innobase/include/dict0pagecompress.ic b/storage/innobase/include/dict0pagecompress.inl index c959f9cada2..c959f9cada2 100644 --- a/storage/innobase/include/dict0pagecompress.ic +++ b/storage/innobase/include/dict0pagecompress.inl diff --git a/storage/innobase/include/dict0stats.h b/storage/innobase/include/dict0stats.h index cdc5ec1bffb..0dc1b984577 100644 --- a/storage/innobase/include/dict0stats.h +++ b/storage/innobase/include/dict0stats.h @@ -229,7 +229,7 @@ dberr_t dict_stats_report_error(dict_table_t* table, bool defragment = false) MY_ATTRIBUTE((nonnull, warn_unused_result)); -#include "dict0stats.ic" +#include "dict0stats.inl" #ifdef UNIV_ENABLE_UNIT_TEST_DICT_STATS void test_dict_stats_all(); diff --git a/storage/innobase/include/dict0stats.ic b/storage/innobase/include/dict0stats.inl index dd516275156..dd516275156 100644 --- a/storage/innobase/include/dict0stats.ic +++ b/storage/innobase/include/dict0stats.inl diff --git a/storage/innobase/include/eval0eval.h b/storage/innobase/include/eval0eval.h index ebd40924a49..a3ea046250b 100644 --- a/storage/innobase/include/eval0eval.h +++ b/storage/innobase/include/eval0eval.h @@ -104,6 +104,6 @@ eval_cmp( func_node_t* cmp_node); /*!< in: comparison node */ -#include "eval0eval.ic" +#include "eval0eval.inl" #endif diff --git a/storage/innobase/include/eval0eval.ic b/storage/innobase/include/eval0eval.inl index 0ea4057fdad..0ea4057fdad 100644 --- a/storage/innobase/include/eval0eval.ic +++ b/storage/innobase/include/eval0eval.inl diff --git a/storage/innobase/include/eval0proc.h b/storage/innobase/include/eval0proc.h index 71700bb5933..a93140bf053 100644 --- a/storage/innobase/include/eval0proc.h +++ b/storage/innobase/include/eval0proc.h @@ -89,6 +89,6 @@ return_step( /*========*/ que_thr_t* thr); /*!< in: query thread */ -#include "eval0proc.ic" +#include "eval0proc.inl" #endif diff --git a/storage/innobase/include/eval0proc.ic b/storage/innobase/include/eval0proc.inl index b0c5f75b94e..b0c5f75b94e 100644 --- a/storage/innobase/include/eval0proc.ic +++ b/storage/innobase/include/eval0proc.inl diff --git a/storage/innobase/include/fil0crypt.h b/storage/innobase/include/fil0crypt.h index cffb26b93ed..d5df0ca126a 100644 --- a/storage/innobase/include/fil0crypt.h +++ b/storage/innobase/include/fil0crypt.h @@ -368,7 +368,7 @@ Return crypt statistics @param[out] stat Crypt statistics */ void fil_crypt_total_stat(fil_crypt_stat_t *stat); -#include "fil0crypt.ic" +#include "fil0crypt.inl" #endif /* !UNIV_INNOCHECKSUM */ /** diff --git a/storage/innobase/include/fil0crypt.ic b/storage/innobase/include/fil0crypt.inl index cc59b394368..cc59b394368 100644 --- a/storage/innobase/include/fil0crypt.ic +++ b/storage/innobase/include/fil0crypt.inl diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 6cdb954ec29..63f83ff0f96 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -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 @@ -572,7 +572,7 @@ public: #if defined __GNUC__ && (defined __i386__ || defined __x86_64__) static_assert(NEEDS_FSYNC == 1U << 29, "compatibility"); __asm__ __volatile__("lock btrl $29, %0" : "+m" (n_pending)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_IX64) +#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) static_assert(NEEDS_FSYNC == 1U << 29, "compatibility"); _interlockedbittestandreset(reinterpret_cast<volatile long*> (&n_pending), 29); @@ -588,7 +588,7 @@ private: #if defined __GNUC__ && (defined __i386__ || defined __x86_64__) static_assert(CLOSING == 1U << 30, "compatibility"); __asm__ __volatile__("lock btrl $30, %0" : "+m" (n_pending)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_IX64) +#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) static_assert(CLOSING == 1U << 30, "compatibility"); _interlockedbittestandreset(reinterpret_cast<volatile long*> (&n_pending), 30); @@ -1489,7 +1489,7 @@ inline void fil_space_t::reacquire() inline bool fil_space_t::set_stopping_check() { mysql_mutex_assert_owner(&fil_system.mutex); -#if defined __clang_major__ && __clang_major__ < 10 +#if (defined __clang_major__ && __clang_major__ < 10) || defined __APPLE_CC__ /* Only clang-10 introduced support for asm goto */ return n_pending.fetch_or(STOPPING, std::memory_order_relaxed) & STOPPING; #elif defined __GNUC__ && (defined __i386__ || defined __x86_64__) @@ -1499,7 +1499,7 @@ inline bool fil_space_t::set_stopping_check() return true; not_stopped: return false; -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_IX64) +#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) static_assert(STOPPING == 1U << 31, "compatibility"); return _interlockedbittestandset(reinterpret_cast<volatile long*> (&n_pending), 31); @@ -1516,7 +1516,7 @@ inline void fil_space_t::set_stopping() #if defined __GNUC__ && (defined __i386__ || defined __x86_64__) static_assert(STOPPING == 1U << 31, "compatibility"); __asm__ __volatile__("lock btsl $31, %0" : "+m" (n_pending)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_IX64) +#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) static_assert(STOPPING == 1U << 31, "compatibility"); _interlockedbittestandset(reinterpret_cast<volatile long*>(&n_pending), 31); #else @@ -1828,7 +1828,7 @@ void test_make_filepath(); @return block size */ ulint fil_space_get_block_size(const fil_space_t* space, unsigned offset); -#include "fil0fil.ic" +#include "fil0fil.inl" #endif /* UNIV_INNOCHECKSUM */ #endif /* fil0fil_h */ diff --git a/storage/innobase/include/fil0fil.ic b/storage/innobase/include/fil0fil.inl index 3194e54c5b5..3194e54c5b5 100644 --- a/storage/innobase/include/fil0fil.ic +++ b/storage/innobase/include/fil0fil.inl diff --git a/storage/innobase/include/fts0priv.h b/storage/innobase/include/fts0priv.h index a8647b4dd1d..ae0bb036e37 100644 --- a/storage/innobase/include/fts0priv.h +++ b/storage/innobase/include/fts0priv.h @@ -480,6 +480,6 @@ fts_config_create_index_param_name( const dict_index_t* index) /*!< in: index for config */ MY_ATTRIBUTE((nonnull, malloc, warn_unused_result)); -#include "fts0priv.ic" +#include "fts0priv.inl" #endif /* INNOBASE_FTS0PRIV_H */ diff --git a/storage/innobase/include/fts0priv.ic b/storage/innobase/include/fts0priv.inl index da14cfcb013..da14cfcb013 100644 --- a/storage/innobase/include/fts0priv.ic +++ b/storage/innobase/include/fts0priv.inl diff --git a/storage/innobase/include/fts0types.h b/storage/innobase/include/fts0types.h index 0938514995b..41eacc21b81 100644 --- a/storage/innobase/include/fts0types.h +++ b/storage/innobase/include/fts0types.h @@ -350,6 +350,6 @@ fts_select_index( const byte* str, ulint len); -#include "fts0types.ic" +#include "fts0types.inl" #endif /* INNOBASE_FTS0TYPES_H */ diff --git a/storage/innobase/include/fts0types.ic b/storage/innobase/include/fts0types.inl index facc1e5c40b..facc1e5c40b 100644 --- a/storage/innobase/include/fts0types.ic +++ b/storage/innobase/include/fts0types.inl diff --git a/storage/innobase/include/gis0rtree.h b/storage/innobase/include/gis0rtree.h index 9f42e39bae8..de5a9075059 100644 --- a/storage/innobase/include/gis0rtree.h +++ b/storage/innobase/include/gis0rtree.h @@ -483,5 +483,5 @@ rtr_estimate_n_rows_in_range( const dtuple_t* tuple, page_cur_mode_t mode); -#include "gis0rtree.ic" +#include "gis0rtree.inl" #endif /*!< gis0rtree.h */ diff --git a/storage/innobase/include/gis0rtree.ic b/storage/innobase/include/gis0rtree.inl index 2564df7e0d6..2564df7e0d6 100644 --- a/storage/innobase/include/gis0rtree.ic +++ b/storage/innobase/include/gis0rtree.inl diff --git a/storage/innobase/include/ha0ha.h b/storage/innobase/include/ha0ha.h index 561c322521e..5aaa559b885 100644 --- a/storage/innobase/include/ha0ha.h +++ b/storage/innobase/include/ha0ha.h @@ -54,7 +54,7 @@ struct ha_node_t { const rec_t* data; /*!< pointer to the data */ }; -#include "ha0ha.ic" +#include "ha0ha.inl" #endif /* BTR_CUR_HASH_ADAPT */ #endif diff --git a/storage/innobase/include/ha0ha.ic b/storage/innobase/include/ha0ha.inl index 0b256257214..0b256257214 100644 --- a/storage/innobase/include/ha0ha.ic +++ b/storage/innobase/include/ha0ha.inl diff --git a/storage/innobase/include/ha0storage.h b/storage/innobase/include/ha0storage.h index db23ddc66ed..fdf50a2ee4a 100644 --- a/storage/innobase/include/ha0storage.h +++ b/storage/innobase/include/ha0storage.h @@ -132,6 +132,6 @@ ha_storage_get_size( /*================*/ const ha_storage_t* storage); /*!< in: hash storage */ -#include "ha0storage.ic" +#include "ha0storage.inl" #endif /* ha0storage_h */ diff --git a/storage/innobase/include/ha0storage.ic b/storage/innobase/include/ha0storage.inl index df9679cf997..df9679cf997 100644 --- a/storage/innobase/include/ha0storage.ic +++ b/storage/innobase/include/ha0storage.inl diff --git a/storage/innobase/include/ibuf0ibuf.h b/storage/innobase/include/ibuf0ibuf.h index 3ffa9facdbf..0bc36029d2f 100644 --- a/storage/innobase/include/ibuf0ibuf.h +++ b/storage/innobase/include/ibuf0ibuf.h @@ -402,6 +402,6 @@ for the file segment from which the pages for the ibuf tree are allocated */ /* The insert buffer tree itself is always located in space 0. */ #define IBUF_SPACE_ID static_cast<ulint>(0) -#include "ibuf0ibuf.ic" +#include "ibuf0ibuf.inl" #endif diff --git a/storage/innobase/include/ibuf0ibuf.ic b/storage/innobase/include/ibuf0ibuf.inl index 2c2620511c7..2c2620511c7 100644 --- a/storage/innobase/include/ibuf0ibuf.ic +++ b/storage/innobase/include/ibuf0ibuf.inl diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h index f2b1dc488d6..b7ff8b61752 100644 --- a/storage/innobase/include/lock0lock.h +++ b/storage/innobase/include/lock0lock.h @@ -1233,6 +1233,6 @@ lock_rtr_move_rec_list( moved */ ulint num_move); /*!< in: num of rec to move */ -#include "lock0lock.ic" +#include "lock0lock.inl" #endif diff --git a/storage/innobase/include/lock0lock.ic b/storage/innobase/include/lock0lock.inl index 7d08cbb930c..7d08cbb930c 100644 --- a/storage/innobase/include/lock0lock.ic +++ b/storage/innobase/include/lock0lock.inl diff --git a/storage/innobase/include/lock0priv.h b/storage/innobase/include/lock0priv.h index b5ec7a0d29e..4e469c6598c 100644 --- a/storage/innobase/include/lock0priv.h +++ b/storage/innobase/include/lock0priv.h @@ -577,6 +577,6 @@ lock_table_has( const dict_table_t* table, /*!< in: table */ enum lock_mode mode); /*!< in: lock mode */ -#include "lock0priv.ic" +#include "lock0priv.inl" #endif /* lock0priv_h */ diff --git a/storage/innobase/include/lock0priv.ic b/storage/innobase/include/lock0priv.inl index 21e7c7c95dc..21e7c7c95dc 100644 --- a/storage/innobase/include/lock0priv.ic +++ b/storage/innobase/include/lock0priv.inl diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index 76deace8fde..01635671e71 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -736,6 +736,6 @@ inline void log_t::file::set_lsn_offset(lsn_t a_lsn) lsn_offset= a_lsn; } -#include "log0log.ic" +#include "log0log.inl" #endif diff --git a/storage/innobase/include/log0log.ic b/storage/innobase/include/log0log.inl index 73434737925..73434737925 100644 --- a/storage/innobase/include/log0log.ic +++ b/storage/innobase/include/log0log.inl diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index 04b59f33f4e..9b4c2488f55 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -82,15 +82,19 @@ void recv_sys_justify_left_parsing_buf(); /** Report an operation to create, delete, or rename a file during backup. @param[in] space_id tablespace identifier -@param[in] create whether the file is being created +@param[in] type file operation redo log type @param[in] name file name (not NUL-terminated) @param[in] len length of name, in bytes @param[in] new_name new file name (NULL if not rename) @param[in] new_len length of new_name, in bytes (0 if NULL) */ -extern void (*log_file_op)(uint32_t space_id, bool create, +extern void (*log_file_op)(uint32_t space_id, int type, const byte* name, ulint len, const byte* new_name, ulint new_len); +/** Report an operation which does INIT_PAGE for page0 during backup. +@param space_id tablespace identifier */ +extern void (*first_page_init)(uint32_t space_id); + /** Stored redo log record */ struct log_rec_t { diff --git a/storage/innobase/include/mach0data.h b/storage/innobase/include/mach0data.h index 4f4c9a4b596..79cbd7d18a1 100644 --- a/storage/innobase/include/mach0data.h +++ b/storage/innobase/include/mach0data.h @@ -370,6 +370,6 @@ mach_write_ulonglong( #endif /* !UNIV_INNOCHECKSUM */ -#include "mach0data.ic" +#include "mach0data.inl" #endif diff --git a/storage/innobase/include/mach0data.ic b/storage/innobase/include/mach0data.inl index 2f970fd27f0..2f970fd27f0 100644 --- a/storage/innobase/include/mach0data.ic +++ b/storage/innobase/include/mach0data.inl diff --git a/storage/innobase/include/mem0mem.h b/storage/innobase/include/mem0mem.h index b7fd9c098a6..959147a61fc 100644 --- a/storage/innobase/include/mem0mem.h +++ b/storage/innobase/include/mem0mem.h @@ -341,5 +341,5 @@ struct mem_block_info_t { #define MEM_BLOCK_HEADER_SIZE UT_CALC_ALIGN(sizeof(mem_block_info_t),\ UNIV_MEM_ALIGNMENT) -#include "mem0mem.ic" +#include "mem0mem.inl" #endif diff --git a/storage/innobase/include/mem0mem.ic b/storage/innobase/include/mem0mem.inl index 9906daf3eb9..9906daf3eb9 100644 --- a/storage/innobase/include/mem0mem.ic +++ b/storage/innobase/include/mem0mem.inl diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index 0b04c0729eb..ec67b9fabe4 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -700,6 +700,6 @@ private: range_set *m_freed_pages= nullptr; }; -#include "mtr0mtr.ic" +#include "mtr0mtr.inl" #endif /* mtr0mtr_h */ diff --git a/storage/innobase/include/mtr0mtr.ic b/storage/innobase/include/mtr0mtr.inl index 02ad88194fb..02ad88194fb 100644 --- a/storage/innobase/include/mtr0mtr.ic +++ b/storage/innobase/include/mtr0mtr.inl diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index ce26a0187a9..66d646cab7c 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -1234,6 +1234,6 @@ inline bool is_absolute_path(const char *path) return false; } -#include "os0file.ic" +#include "os0file.inl" #endif /* os0file_h */ diff --git a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0file.inl index e88f94b8ff3..e88f94b8ff3 100644 --- a/storage/innobase/include/os0file.ic +++ b/storage/innobase/include/os0file.inl diff --git a/storage/innobase/include/page0cur.h b/storage/innobase/include/page0cur.h index c0f3bf6866e..6ce31dea0c1 100644 --- a/storage/innobase/include/page0cur.h +++ b/storage/innobase/include/page0cur.h @@ -345,6 +345,6 @@ struct page_cur_t{ buf_block_t* block; /*!< pointer to the block containing rec */ }; -#include "page0cur.ic" +#include "page0cur.inl" #endif diff --git a/storage/innobase/include/page0cur.ic b/storage/innobase/include/page0cur.inl index 5ee96dd716d..5ee96dd716d 100644 --- a/storage/innobase/include/page0cur.ic +++ b/storage/innobase/include/page0cur.inl diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h index 41e46c2d051..ff96202c1c2 100644 --- a/storage/innobase/include/page0page.h +++ b/storage/innobase/include/page0page.h @@ -1166,6 +1166,6 @@ page_find_rec_max_not_deleted( #endif /* !UNIV_INNOCHECKSUM */ -#include "page0page.ic" +#include "page0page.inl" #endif diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.inl index 861bf4a53df..861bf4a53df 100644 --- a/storage/innobase/include/page0page.ic +++ b/storage/innobase/include/page0page.inl diff --git a/storage/innobase/include/page0zip.h b/storage/innobase/include/page0zip.h index 45b5482fdb2..3a28384138b 100644 --- a/storage/innobase/include/page0zip.h +++ b/storage/innobase/include/page0zip.h @@ -377,7 +377,7 @@ void page_zip_reset_stat_per_index(); /*===========================*/ -#include "page0zip.ic" +#include "page0zip.inl" #endif /* !UNIV_INNOCHECKSUM */ #endif /* page0zip_h */ diff --git a/storage/innobase/include/page0zip.ic b/storage/innobase/include/page0zip.inl index afc877c3720..afc877c3720 100644 --- a/storage/innobase/include/page0zip.ic +++ b/storage/innobase/include/page0zip.inl diff --git a/storage/innobase/include/que0que.h b/storage/innobase/include/que0que.h index f0aed6d22f4..c60f390a092 100644 --- a/storage/innobase/include/que0que.h +++ b/storage/innobase/include/que0que.h @@ -309,6 +309,6 @@ struct que_fork_t{ /* Flag which is ORed to control structure statement node types */ #define QUE_NODE_CONTROL_STAT 1024 -#include "que0que.ic" +#include "que0que.inl" #endif diff --git a/storage/innobase/include/que0que.ic b/storage/innobase/include/que0que.inl index e21cbad3815..e21cbad3815 100644 --- a/storage/innobase/include/que0que.ic +++ b/storage/innobase/include/que0que.inl diff --git a/storage/innobase/include/rem0cmp.h b/storage/innobase/include/rem0cmp.h index 8d770405fcc..6f2201971d1 100644 --- a/storage/innobase/include/rem0cmp.h +++ b/storage/innobase/include/rem0cmp.h @@ -258,6 +258,6 @@ cmp_dfield_dfield_like_prefix( const dfield_t* dfield1, const dfield_t* dfield2); -#include "rem0cmp.ic" +#include "rem0cmp.inl" #endif diff --git a/storage/innobase/include/rem0cmp.ic b/storage/innobase/include/rem0cmp.inl index 6e21382d187..6e21382d187 100644 --- a/storage/innobase/include/rem0cmp.ic +++ b/storage/innobase/include/rem0cmp.inl diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h index dbcff3e6fd6..c2ebad91ecd 100644 --- a/storage/innobase/include/rem0rec.h +++ b/storage/innobase/include/rem0rec.h @@ -1293,7 +1293,7 @@ int wsrep_rec_get_foreign_key( ibool new_protocol); /* in: protocol > 1 */ #endif /* WITH_WSREP */ -#include "rem0rec.ic" +#include "rem0rec.inl" #endif /* !UNIV_INNOCHECKSUM */ #endif /* rem0rec_h */ diff --git a/storage/innobase/include/rem0rec.ic b/storage/innobase/include/rem0rec.inl index 30c72a7415a..30c72a7415a 100644 --- a/storage/innobase/include/rem0rec.ic +++ b/storage/innobase/include/rem0rec.inl diff --git a/storage/innobase/include/row0ext.h b/storage/innobase/include/row0ext.h index 251f3125667..78886332aa6 100644 --- a/storage/innobase/include/row0ext.h +++ b/storage/innobase/include/row0ext.h @@ -96,6 +96,6 @@ struct row_ext_t{ ulint len[1]; /*!< prefix lengths; 0 if not cached */ }; -#include "row0ext.ic" +#include "row0ext.inl" #endif diff --git a/storage/innobase/include/row0ext.ic b/storage/innobase/include/row0ext.inl index 913b51b34d2..913b51b34d2 100644 --- a/storage/innobase/include/row0ext.ic +++ b/storage/innobase/include/row0ext.inl diff --git a/storage/innobase/include/row0log.h b/storage/innobase/include/row0log.h index 9fcece5b990..732ef494326 100644 --- a/storage/innobase/include/row0log.h +++ b/storage/innobase/include/row0log.h @@ -263,6 +263,6 @@ row_log_estimate_work( const dict_index_t* index); #endif /* HAVE_PSI_STAGE_INTERFACE */ -#include "row0log.ic" +#include "row0log.inl" #endif /* row0log.h */ diff --git a/storage/innobase/include/row0log.ic b/storage/innobase/include/row0log.inl index f9f3dd006bf..f9f3dd006bf 100644 --- a/storage/innobase/include/row0log.ic +++ b/storage/innobase/include/row0log.inl diff --git a/storage/innobase/include/row0row.h b/storage/innobase/include/row0row.h index b4dab3c2f1b..1e0fdc65238 100644 --- a/storage/innobase/include/row0row.h +++ b/storage/innobase/include/row0row.h @@ -427,6 +427,6 @@ row_mtr_start(mtr_t* mtr, dict_index_t* index, bool pessimistic) log_free_check(); } -#include "row0row.ic" +#include "row0row.inl" #endif diff --git a/storage/innobase/include/row0row.ic b/storage/innobase/include/row0row.inl index e89adb581f4..e89adb581f4 100644 --- a/storage/innobase/include/row0row.ic +++ b/storage/innobase/include/row0row.inl diff --git a/storage/innobase/include/row0sel.h b/storage/innobase/include/row0sel.h index 6010771291f..eb83a4bcad6 100644 --- a/storage/innobase/include/row0sel.h +++ b/storage/innobase/include/row0sel.h @@ -477,6 +477,6 @@ row_sel_field_store_in_mysql_format_func( const byte* data, /*!< in: data to store */ ulint len); /*!< in: length of the data */ -#include "row0sel.ic" +#include "row0sel.inl" #endif diff --git a/storage/innobase/include/row0sel.ic b/storage/innobase/include/row0sel.inl index 7880605ca8f..7880605ca8f 100644 --- a/storage/innobase/include/row0sel.ic +++ b/storage/innobase/include/row0sel.inl diff --git a/storage/innobase/include/row0upd.h b/storage/innobase/include/row0upd.h index 58c60a0a4da..9ee5d77f5e5 100644 --- a/storage/innobase/include/row0upd.h +++ b/storage/innobase/include/row0upd.h @@ -563,6 +563,6 @@ public: changed in the update */ -#include "row0upd.ic" +#include "row0upd.inl" #endif diff --git a/storage/innobase/include/row0upd.ic b/storage/innobase/include/row0upd.inl index 13aacf3f003..13aacf3f003 100644 --- a/storage/innobase/include/row0upd.ic +++ b/storage/innobase/include/row0upd.inl diff --git a/storage/innobase/include/rw_lock.h b/storage/innobase/include/rw_lock.h index 0ae052fabe2..a9099d10670 100644 --- a/storage/innobase/include/rw_lock.h +++ b/storage/innobase/include/rw_lock.h @@ -56,7 +56,7 @@ protected: #if defined __GNUC__ && (defined __i386__ || defined __x86_64__) static_assert(WRITER_WAITING == 1U << 30, "compatibility"); __asm__ __volatile__("lock btsl $30, %0" : "+m" (lock)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_IX64) +#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) static_assert(WRITER_WAITING == 1U << 30, "compatibility"); _interlockedbittestandset(reinterpret_cast<volatile long*>(&lock), 30); #else diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h index 32da0e4e2b4..fe6c83c458c 100644 --- a/storage/innobase/include/srv0mon.h +++ b/storage/innobase/include/srv0mon.h @@ -863,6 +863,6 @@ void srv_mon_default_on(void); /*====================*/ -#include "srv0mon.ic" +#include "srv0mon.inl" #endif diff --git a/storage/innobase/include/srv0mon.ic b/storage/innobase/include/srv0mon.inl index 158345b2f8c..158345b2f8c 100644 --- a/storage/innobase/include/srv0mon.ic +++ b/storage/innobase/include/srv0mon.inl diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index c936947db1c..a3ef106b847 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -309,11 +309,8 @@ void innodb_wait_allow_writes(); /** Requested size in bytes */ extern ulint srv_buf_pool_size; -/** Minimum pool size in bytes */ -extern const ulint srv_buf_pool_min_size; -/** Default pool size in bytes */ -extern const ulint srv_buf_pool_def_size; -/** Requested buffer pool chunk size */ +/** Requested buffer pool chunk size. Each buffer pool instance consists +of one or more chunks. */ extern ulong srv_buf_pool_chunk_unit; /** Scan depth for LRU flush batch i.e.: number of blocks scanned*/ extern ulong srv_LRU_scan_depth; @@ -419,7 +416,10 @@ enum srv_operation_mode { /** Mariabackup restoring the incremental part of a backup */ SRV_OPERATION_RESTORE_DELTA, /** Mariabackup restoring a backup for subsequent --export */ - SRV_OPERATION_RESTORE_EXPORT + SRV_OPERATION_RESTORE_EXPORT, + /** Mariabackup taking a backup and avoid deferring + any tablespace */ + SRV_OPERATION_BACKUP_NO_DEFER }; /** Current mode of operation */ diff --git a/storage/innobase/include/srw_lock.h b/storage/innobase/include/srw_lock.h index e8ed346d3ac..1705c63b8ad 100644 --- a/storage/innobase/include/srw_lock.h +++ b/storage/innobase/include/srw_lock.h @@ -224,7 +224,7 @@ public: void wr_lock() { writer.wr_lock(); -#if defined __i386__||defined __x86_64__||defined _M_IX86||defined _M_IX64 +#if defined __i386__||defined __x86_64__||defined _M_IX86||defined _M_X64 /* On IA-32 and AMD64, this type of fetch_or() can only be implemented as a loop around LOCK CMPXCHG. In this particular case, setting the most significant bit using fetch_add() is equivalent, and is diff --git a/storage/innobase/include/trx0rec.h b/storage/innobase/include/trx0rec.h index 5c7e468b936..86f305fe04b 100644 --- a/storage/innobase/include/trx0rec.h +++ b/storage/innobase/include/trx0rec.h @@ -336,6 +336,6 @@ inline table_id_t trx_undo_rec_get_table_id(const trx_undo_rec_t *rec) return mach_read_next_much_compressed(&rec); } -#include "trx0rec.ic" +#include "trx0rec.inl" #endif /* trx0rec_h */ diff --git a/storage/innobase/include/trx0rec.ic b/storage/innobase/include/trx0rec.inl index 02244d68b6f..02244d68b6f 100644 --- a/storage/innobase/include/trx0rec.ic +++ b/storage/innobase/include/trx0rec.inl diff --git a/storage/innobase/include/trx0rseg.h b/storage/innobase/include/trx0rseg.h index a9bcb0c3d51..a52d9779a51 100644 --- a/storage/innobase/include/trx0rseg.h +++ b/storage/innobase/include/trx0rseg.h @@ -104,7 +104,7 @@ private: __asm__ __volatile__("lock btsl $1, %0" : "+m" (ref)); else __asm__ __volatile__("lock btsl $0, %0" : "+m" (ref)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_IX64) +#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) _interlockedbittestandset(reinterpret_cast<volatile long*>(&ref), needs_purge); #else @@ -121,7 +121,7 @@ private: __asm__ __volatile__("lock btrl $1, %0" : "+m" (ref)); else __asm__ __volatile__("lock btrl $0, %0" : "+m" (ref)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_IX64) +#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) _interlockedbittestandreset(reinterpret_cast<volatile long*>(&ref), needs_purge); #else @@ -334,4 +334,4 @@ up to which replication has proceeded. void trx_rseg_update_binlog_offset(buf_block_t *rseg_header, const trx_t *trx, mtr_t *mtr); -#include "trx0rseg.ic" +#include "trx0rseg.inl" diff --git a/storage/innobase/include/trx0rseg.ic b/storage/innobase/include/trx0rseg.inl index af63d6acbf2..af63d6acbf2 100644 --- a/storage/innobase/include/trx0rseg.ic +++ b/storage/innobase/include/trx0rseg.inl diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index 33ed9aeb25c..24bafa61337 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -1207,6 +1207,6 @@ struct commit_node_t{ }; -#include "trx0trx.ic" +#include "trx0trx.inl" #endif diff --git a/storage/innobase/include/trx0trx.ic b/storage/innobase/include/trx0trx.inl index b063c920e2f..b063c920e2f 100644 --- a/storage/innobase/include/trx0trx.ic +++ b/storage/innobase/include/trx0trx.inl diff --git a/storage/innobase/include/trx0undo.h b/storage/innobase/include/trx0undo.h index 4d6caa89811..62662ffe221 100644 --- a/storage/innobase/include/trx0undo.h +++ b/storage/innobase/include/trx0undo.h @@ -457,7 +457,7 @@ which purge would not result in removing delete-marked records. */ with the XA XID */ /* @} */ -#include "trx0undo.ic" +#include "trx0undo.inl" #endif /* !UNIV_INNOCHECKSUM */ #endif diff --git a/storage/innobase/include/trx0undo.ic b/storage/innobase/include/trx0undo.inl index 1a9c7774580..1a9c7774580 100644 --- a/storage/innobase/include/trx0undo.ic +++ b/storage/innobase/include/trx0undo.inl diff --git a/storage/innobase/include/ut0byte.h b/storage/innobase/include/ut0byte.h index 1a428d73d23..7ed64c61c4b 100644 --- a/storage/innobase/include/ut0byte.h +++ b/storage/innobase/include/ut0byte.h @@ -112,6 +112,6 @@ ut_bit_set_nth( ulint n, /*!< in: nth bit requested */ ibool val); /*!< in: value for the bit to set */ -#include "ut0byte.ic" +#include "ut0byte.inl" #endif diff --git a/storage/innobase/include/ut0byte.ic b/storage/innobase/include/ut0byte.inl index a4b5d4a7d8f..a4b5d4a7d8f 100644 --- a/storage/innobase/include/ut0byte.ic +++ b/storage/innobase/include/ut0byte.inl diff --git a/storage/innobase/include/ut0list.h b/storage/innobase/include/ut0list.h index 7e27e10884b..765f6a2a339 100644 --- a/storage/innobase/include/ut0list.h +++ b/storage/innobase/include/ut0list.h @@ -141,6 +141,6 @@ struct ib_list_helper_t { void* data; /*!< user data */ }; -#include "ut0list.ic" +#include "ut0list.inl" #endif diff --git a/storage/innobase/include/ut0list.ic b/storage/innobase/include/ut0list.inl index 3bdba52bfaa..3bdba52bfaa 100644 --- a/storage/innobase/include/ut0list.ic +++ b/storage/innobase/include/ut0list.inl diff --git a/storage/innobase/include/ut0mem.h b/storage/innobase/include/ut0mem.h index 2fc864d49a2..a5ed72f9f02 100644 --- a/storage/innobase/include/ut0mem.h +++ b/storage/innobase/include/ut0mem.h @@ -71,6 +71,6 @@ ut_str_sql_format( ulint buf_size); /*!< in: output buffer size in bytes */ -#include "ut0mem.ic" +#include "ut0mem.inl" #endif diff --git a/storage/innobase/include/ut0mem.ic b/storage/innobase/include/ut0mem.inl index cc95a03642e..cc95a03642e 100644 --- a/storage/innobase/include/ut0mem.ic +++ b/storage/innobase/include/ut0mem.inl diff --git a/storage/innobase/include/ut0rnd.h b/storage/innobase/include/ut0rnd.h index bcf47fa9c41..511eb21fd11 100644 --- a/storage/innobase/include/ut0rnd.h +++ b/storage/innobase/include/ut0rnd.h @@ -123,6 +123,6 @@ ut_fold_binary( ulint len) /*!< in: length */ MY_ATTRIBUTE((pure)); -#include "ut0rnd.ic" +#include "ut0rnd.inl" #endif diff --git a/storage/innobase/include/ut0rnd.ic b/storage/innobase/include/ut0rnd.inl index 37da323f8f3..37da323f8f3 100644 --- a/storage/innobase/include/ut0rnd.ic +++ b/storage/innobase/include/ut0rnd.inl diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h index 69abd932375..89ff0ca709f 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -428,7 +428,7 @@ private: } // namespace ib -#include "ut0ut.ic" +#include "ut0ut.inl" #endif diff --git a/storage/innobase/include/ut0ut.ic b/storage/innobase/include/ut0ut.inl index 73feaf82c6a..73feaf82c6a 100644 --- a/storage/innobase/include/ut0ut.ic +++ b/storage/innobase/include/ut0ut.inl diff --git a/storage/innobase/include/ut0vec.h b/storage/innobase/include/ut0vec.h index cfdaee607be..f4660f9646c 100644 --- a/storage/innobase/include/ut0vec.h +++ b/storage/innobase/include/ut0vec.h @@ -280,6 +280,6 @@ struct ib_vector_t { ulint sizeof_value; }; -#include "ut0vec.ic" +#include "ut0vec.inl" #endif /* IB_VECTOR_H */ diff --git a/storage/innobase/include/ut0vec.ic b/storage/innobase/include/ut0vec.inl index 531f0f22ae0..531f0f22ae0 100644 --- a/storage/innobase/include/ut0vec.ic +++ b/storage/innobase/include/ut0vec.inl diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 5a7a6076322..8af6ab6521d 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -941,15 +941,17 @@ fail: /** Report an operation to create, delete, or rename a file during backup. @param[in] space_id tablespace identifier -@param[in] create whether the file is being created +@param[in] type redo log type @param[in] name file name (not NUL-terminated) @param[in] len length of name, in bytes @param[in] new_name new file name (NULL if not rename) @param[in] new_len length of new_name, in bytes (0 if NULL) */ -void (*log_file_op)(uint32_t space_id, bool create, +void (*log_file_op)(uint32_t space_id, int type, const byte* name, ulint len, const byte* new_name, ulint new_len); +void (*first_page_init)(uint32_t space_id); + /** Information about initializing page contents during redo log processing. FIXME: Rely on recv_sys.pages! */ class mlog_init_t @@ -1153,7 +1155,8 @@ void fil_name_process(char* name, ulint len, uint32_t space_id, bool deleted, lsn_t lsn, store_t *store) { - if (srv_operation == SRV_OPERATION_BACKUP) { + if (srv_operation == SRV_OPERATION_BACKUP + || srv_operation == SRV_OPERATION_BACKUP_NO_DEFER) { return; } @@ -2115,6 +2118,8 @@ static void store_freed_or_init_rec(page_id_t page_id, bool freed) { uint32_t space_id= page_id.space(); uint32_t page_no= page_id.page_no(); + if (!freed && page_no == 0 && first_page_init) + first_page_init(space_id); if (is_predefined_tablespace(space_id)) { if (!srv_immediate_scrub_data_uncompressed) @@ -2595,8 +2600,8 @@ same_page: if (fn2) fil_name_process(const_cast<char*>(fn2), fn2end - fn2, space_id, false, start_lsn, store); - if ((b & 0xf0) < FILE_MODIFY && log_file_op) - log_file_op(space_id, (b & 0xf0) == FILE_CREATE, + if ((b & 0xf0) < FILE_CHECKPOINT && log_file_op) + log_file_op(space_id, b & 0xf0, l, static_cast<ulint>(fnend - fn), reinterpret_cast<const byte*>(fn2), fn2 ? static_cast<ulint>(fn2end - fn2) : 0); @@ -2936,35 +2941,33 @@ func_exit: ut_ad(mtr.has_committed()); } -/** Reads in pages which have hashed log records, from an area around a given -page number. -@param[in] page_id page id */ +/** Read pages for which log needs to be applied. +@param page_id first page identifier to read +@param i iterator to recv_sys.pages */ TRANSACTIONAL_TARGET -static void recv_read_in_area(page_id_t page_id) +static void recv_read_in_area(page_id_t page_id, recv_sys_t::map::iterator i) { - uint32_t page_nos[32]; - page_id.set_page_no(ut_2pow_round(page_id.page_no(), 32U)); - const uint32_t up_limit = page_id.page_no() + 32; - uint32_t* p = page_nos; - - for (recv_sys_t::map::iterator i= recv_sys.pages.lower_bound(page_id); - i != recv_sys.pages.end() - && i->first.space() == page_id.space() - && i->first.page_no() < up_limit; i++) { - if (i->second.state == page_recv_t::RECV_NOT_PROCESSED - && !buf_pool.page_hash_contains( - i->first, - buf_pool.page_hash.cell_get(i->first.fold()))) { - i->second.state = page_recv_t::RECV_BEING_READ; - *p++ = i->first.page_no(); - } - } + uint32_t page_nos[32]; + ut_ad(page_id == i->first); + page_id.set_page_no(ut_2pow_round(page_id.page_no(), 32U)); + const page_id_t up_limit{page_id + 31}; + uint32_t* p= page_nos; - if (p != page_nos) { - mysql_mutex_unlock(&recv_sys.mutex); - buf_read_recv_pages(page_id.space(), {page_nos, p}); - mysql_mutex_lock(&recv_sys.mutex); - } + for (; i != recv_sys.pages.end() && i->first <= up_limit; i++) + { + if (i->second.state == page_recv_t::RECV_NOT_PROCESSED) + { + i->second.state= page_recv_t::RECV_BEING_READ; + *p++= i->first.page_no(); + } + } + + if (p != page_nos) + { + mysql_mutex_unlock(&recv_sys.mutex); + buf_read_recv_pages(page_id.space(), {page_nos, p}); + mysql_mutex_lock(&recv_sys.mutex); + } } /** Attempt to initialize a page based on redo log records. @@ -3169,8 +3172,7 @@ void recv_sys_t::apply(bool last_batch) for (map::iterator p= pages.begin(); p != pages.end(); ) { const page_id_t page_id= p->first; - page_recv_t &recs= p->second; - ut_ad(!recs.log.empty()); + ut_ad(!p->second.log.empty()); const uint32_t space_id= page_id.space(); auto d= deferred_spaces.defers.find(space_id); @@ -3202,7 +3204,7 @@ erase_for_space: continue; } - switch (recs.state) { + switch (p->second.state) { case page_recv_t::RECV_BEING_READ: case page_recv_t::RECV_BEING_PROCESSED: p++; @@ -3214,33 +3216,17 @@ next_free_block: mysql_mutex_unlock(&mutex); free_block= buf_LRU_get_free_block(false); mysql_mutex_lock(&mutex); -next_page: - p= pages.lower_bound(page_id); - } - continue; - case page_recv_t::RECV_NOT_PROCESSED: - mtr.start(); - mtr.set_log_mode(MTR_LOG_NO_REDO); - if (buf_block_t *block= buf_page_get_low(page_id, 0, RW_X_LATCH, - nullptr, BUF_GET_IF_IN_POOL, - &mtr, nullptr, false)) - { - recv_recover_page(block, mtr, p); - ut_ad(mtr.has_committed()); - } - else - { - mtr.commit(); - recv_read_in_area(page_id); break; } - map::iterator r= p++; - r->second.log.clear(); - pages.erase(r); + ut_ad(p == pages.end() || p->first > page_id); continue; + case page_recv_t::RECV_NOT_PROCESSED: + recv_read_in_area(page_id, p); } - - goto next_page; + p= pages.lower_bound(page_id); + /* Ensure that progress will be made. */ + ut_ad(p == pages.end() || p->first > page_id || + p->second.state >= page_recv_t::RECV_BEING_READ); } buf_pool.free_block(free_block); diff --git a/storage/innobase/rem/rem0cmp.cc b/storage/innobase/rem/rem0cmp.cc index 70c0255d46a..6c42aaa0f38 100644 --- a/storage/innobase/rem/rem0cmp.cc +++ b/storage/innobase/rem/rem0cmp.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2020, MariaDB Corporation. +Copyright (c) 2020, 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 @@ -49,48 +49,25 @@ At the present, the comparison functions return 0 in the case, where two records disagree only in the way that one has more fields than the other. */ -/** Compare two data fields. -@param[in] prtype precise type -@param[in] a data field -@param[in] a_length length of a, in bytes (not UNIV_SQL_NULL) -@param[in] b data field -@param[in] b_length length of b, in bytes (not UNIV_SQL_NULL) -@return positive, 0, negative, if a is greater, equal, less than b, -respectively */ -UNIV_INLINE -int -innobase_mysql_cmp( - ulint prtype, - const byte* a, - ulint a_length, - const byte* b, - ulint b_length) +#ifndef DBUG_OFF +/** @return whether a data type is compatible with strnncoll() functions */ +static bool is_strnncoll_compatible(ulint type) { -#ifdef UNIV_DEBUG - switch (prtype & DATA_MYSQL_TYPE_MASK) { - case MYSQL_TYPE_BIT: - case MYSQL_TYPE_STRING: - case MYSQL_TYPE_VAR_STRING: - case MYSQL_TYPE_TINY_BLOB: - case MYSQL_TYPE_MEDIUM_BLOB: - case MYSQL_TYPE_BLOB: - case MYSQL_TYPE_LONG_BLOB: - case MYSQL_TYPE_VARCHAR: - break; - default: - ut_error; - } -#endif /* UNIV_DEBUG */ - - uint cs_num = (uint) dtype_get_charset_coll(prtype); - - if (CHARSET_INFO* cs = get_charset(cs_num, MYF(MY_WME))) { - return(cs->strnncollsp(a, a_length, b, b_length)); - } - - ib::fatal() << "Unable to find charset-collation " << cs_num; - return(0); + switch (type) { + case MYSQL_TYPE_BIT: + case MYSQL_TYPE_STRING: + case MYSQL_TYPE_VAR_STRING: + case MYSQL_TYPE_TINY_BLOB: + case MYSQL_TYPE_MEDIUM_BLOB: + case MYSQL_TYPE_BLOB: + case MYSQL_TYPE_LONG_BLOB: + case MYSQL_TYPE_VARCHAR: + return true; + default: + return false; + } } +#endif /* DBUG_OFF */ /*************************************************************//** Returns TRUE if two columns are equal for comparison purposes. @@ -213,146 +190,123 @@ cmp_decimal(const byte* a, ulint a_length, const byte* b, ulint b_length) } /** Compare two data fields. -@param[in] mtype main type -@param[in] prtype precise type -@param[in] data1 data field -@param[in] len1 length of data1 in bytes, or UNIV_SQL_NULL -@param[in] data2 data field -@param[in] len2 length of data2 in bytes, or UNIV_SQL_NULL +@param mtype main type +@param prtype precise type +@param data1 data field +@param len1 length of data1 in bytes, or UNIV_SQL_NULL +@param data2 data field +@param len2 length of data2 in bytes, or UNIV_SQL_NULL @return the comparison result of data1 and data2 @retval 0 if data1 is equal to data2 @retval negative if data1 is less than data2 @retval positive if data1 is greater than data2 */ -inline -int -cmp_data( - ulint mtype, - ulint prtype, - const byte* data1, - ulint len1, - const byte* data2, - ulint len2) +static int cmp_data(ulint mtype, ulint prtype, const byte *data1, ulint len1, + const byte *data2, ulint len2) { - ut_ad(len1 != UNIV_SQL_DEFAULT); - ut_ad(len2 != UNIV_SQL_DEFAULT); - - if (len1 == UNIV_SQL_NULL || len2 == UNIV_SQL_NULL) { - if (len1 == len2) { - return(0); - } - - /* We define the SQL null to be the smallest possible - value of a field. */ - return(len1 == UNIV_SQL_NULL ? -1 : 1); - } - - ulint pad; - - switch (mtype) { - default: - ib::fatal() << "Unknown data type number " << mtype; - case DATA_FIXBINARY: - case DATA_BINARY: - if (dtype_get_charset_coll(prtype) - != DATA_MYSQL_BINARY_CHARSET_COLL) { - pad = 0x20; - break; - } - /* fall through */ - case DATA_INT: - case DATA_SYS_CHILD: - case DATA_SYS: - pad = ULINT_UNDEFINED; - break; - case DATA_GEOMETRY: - ut_ad(prtype & DATA_BINARY_TYPE); - if (prtype & DATA_GIS_MBR) { - ut_ad(len1 == DATA_MBR_LEN); - ut_ad(len2 == DATA_MBR_LEN); - return cmp_geometry_field(data1, data2); - } - pad = ULINT_UNDEFINED; - break; - case DATA_BLOB: - if (prtype & DATA_BINARY_TYPE) { - pad = ULINT_UNDEFINED; - break; - } - if (prtype & DATA_BINARY_TYPE) { - ib::error() << "Comparing a binary BLOB" - " using a character set collation!"; - ut_ad(0); - } - /* fall through */ - case DATA_VARMYSQL: - case DATA_MYSQL: - return innobase_mysql_cmp(prtype, data1, len1, data2, len2); - case DATA_VARCHAR: - case DATA_CHAR: - return my_charset_latin1.strnncollsp(data1, len1, data2, len2); - case DATA_DECIMAL: - return cmp_decimal(data1, len1, data2, len2); - case DATA_DOUBLE: - { - double d_1 = mach_double_read(data1); - double d_2 = mach_double_read(data2); - - if (d_1 > d_2) { - return 1; - } else if (d_2 > d_1) { - return -1; - } - } - return 0; - - case DATA_FLOAT: - float f_1 = mach_float_read(data1); - float f_2 = mach_float_read(data2); - - if (f_1 > f_2) { - return 1; - } else if (f_2 > f_1) { - return -1; - } - - return 0; - } - - ulint len = std::min(len1, len2); - int cmp = len ? memcmp(data1, data2, len) : 0; - - if (cmp) { - return (cmp); - } - - data1 += len; - data2 += len; - len1 -= len; - len2 -= len; - - cmp = (int) (len1 - len2); - - if (!cmp || pad == ULINT_UNDEFINED) { - return(cmp); - } - - len = 0; - - if (len1) { - do { - cmp = static_cast<int>( - mach_read_from_1(&data1[len++]) - pad); - } while (cmp == 0 && len < len1); - } else { - ut_ad(len2 > 0); - - do { - cmp = static_cast<int>( - pad - mach_read_from_1(&data2[len++])); - } while (cmp == 0 && len < len2); - } - - return(cmp); + ut_ad(len1 != UNIV_SQL_DEFAULT); + ut_ad(len2 != UNIV_SQL_DEFAULT); + + if (len1 == UNIV_SQL_NULL || len2 == UNIV_SQL_NULL) + { + if (len1 == len2) + return 0; + + /* We define the SQL null to be the smallest possible value of a field. */ + return len1 == UNIV_SQL_NULL ? -1 : 1; + } + + switch (mtype) { + default: + ib::fatal() << "Unknown data type number " << mtype; + case DATA_DECIMAL: + return cmp_decimal(data1, len1, data2, len2); + case DATA_DOUBLE: + { + const double af= mach_double_read(data1), bf= mach_double_read(data2); + return af > bf ? 1 : bf > af ? -1 : 0; + } + case DATA_FLOAT: + { + const float af= mach_float_read(data1), bf= mach_float_read(data2); + return af > bf ? 1 : bf > af ? -1 : 0; + } + case DATA_FIXBINARY: + case DATA_BINARY: + if (dtype_get_charset_coll(prtype) != DATA_MYSQL_BINARY_CHARSET_COLL) + { + if (ulint len= std::min(len1, len2)) + { + if (int cmp= memcmp(data1, data2, len)) + return cmp; + data1+= len; + data2+= len; + len1-= len; + len2-= len; + } + + int cmp= 0; + if (len1) + { + const byte *end= &data1[len1]; + do + cmp= static_cast<int>(*data1++ - byte{0x20}); + while (cmp == 0 && data1 < end); + } + else if (len2) + { + const byte *end= &data2[len2]; + do + cmp= static_cast<int>(byte{0x20} - *data2++); + while (cmp == 0 && data2 < end); + } + return cmp; + } + /* fall through */ + case DATA_INT: + case DATA_SYS_CHILD: + case DATA_SYS: + break; + case DATA_GEOMETRY: + ut_ad(prtype & DATA_BINARY_TYPE); + if (prtype & DATA_GIS_MBR) + { + ut_ad(len1 == DATA_MBR_LEN); + ut_ad(len2 == DATA_MBR_LEN); + return cmp_geometry_field(data1, data2); + } + break; + case DATA_BLOB: + if (prtype & DATA_BINARY_TYPE) + break; + /* fall through */ + case DATA_VARMYSQL: + DBUG_ASSERT(is_strnncoll_compatible(prtype & DATA_MYSQL_TYPE_MASK)); + if (CHARSET_INFO *cs= get_charset(dtype_get_charset_coll(prtype), + MYF(MY_WME))) + return cs->coll->strnncollsp(cs, data1, len1, data2, len2); + no_collation: + ib::fatal() << "Unable to find charset-collation for " << prtype; + case DATA_MYSQL: + DBUG_ASSERT(is_strnncoll_compatible(prtype & DATA_MYSQL_TYPE_MASK)); + if (CHARSET_INFO *cs= get_charset(dtype_get_charset_coll(prtype), + MYF(MY_WME))) + return cs->coll->strnncollsp_nchars(cs, data1, len1, data2, len2, + std::max(len1, len2)); + goto no_collation; + case DATA_VARCHAR: + case DATA_CHAR: + /* latin1_swedish_ci is treated as a special case in InnoDB. + Because it is a fixed-length encoding (mbminlen=mbmaxlen=1), + non-NULL CHAR(n) values will always occupy n bytes and we + can invoke strnncollsp() instead of strnncollsp_nchars(). */ + return my_charset_latin1.strnncollsp(data1, len1, data2, len2); + } + + if (ulint len= std::min(len1, len2)) + if (int cmp= memcmp(data1, data2, len)) + return cmp; + + return len1 > len2 ? 1 : len2 > len1 ? -1 : 0; } /** Compare two data fields. diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 0382b4abf4a..303f6265842 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -1351,15 +1351,7 @@ row_import::match_schema( { /* Do some simple checks. */ - if (m_table->n_cols != m_n_cols) { - ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH, - "Number of columns don't match, table has %u " - "columns but the tablespace meta-data file has " - ULINTPF " columns", - m_table->n_cols, m_n_cols); - - return(DB_ERROR); - } else if (UT_LIST_GET_LEN(m_table->indexes) != m_n_indexes) { + if (UT_LIST_GET_LEN(m_table->indexes) != m_n_indexes) { /* If the number of indexes don't match then it is better to abort the IMPORT. It is easy for the user to create a @@ -3239,7 +3231,10 @@ static dberr_t handle_instant_metadata(dict_table_t *table, } mem_heap_t *heap= NULL; - SCOPE_EXIT([&heap]() { mem_heap_free(heap); }); + SCOPE_EXIT([&heap]() { + if (heap) + mem_heap_free(heap); + }); while (btr_page_get_level(page.get()) != 0) { diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 595bc4237f0..fd30c70c313 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -188,10 +188,8 @@ with mysql_mutex_lock(), which will wait until it gets the mutex. */ /** copy of innodb_buffer_pool_size */ ulint srv_buf_pool_size; -const ulint srv_buf_pool_min_size = 5 * 1024 * 1024; -/** Default pool size in bytes */ -const ulint srv_buf_pool_def_size = 128 * 1024 * 1024; -/** Requested buffer pool chunk size */ +/** Requested buffer pool chunk size. Each buffer pool instance consists +of one or more chunks. */ ulong srv_buf_pool_chunk_unit; /** innodb_lru_scan_depth; number of blocks scanned in LRU flush batch */ ulong srv_LRU_scan_depth; diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index c3059b2a54e..ff7fc3e28db 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -1473,6 +1473,7 @@ file_checked: break; case SRV_OPERATION_RESTORE_DELTA: case SRV_OPERATION_BACKUP: + case SRV_OPERATION_BACKUP_NO_DEFER: ut_ad("wrong mariabackup mode" == 0); } @@ -1946,6 +1947,7 @@ void innodb_shutdown() switch (srv_operation) { case SRV_OPERATION_BACKUP: case SRV_OPERATION_RESTORE_DELTA: + case SRV_OPERATION_BACKUP_NO_DEFER: break; case SRV_OPERATION_RESTORE: case SRV_OPERATION_RESTORE_EXPORT: diff --git a/storage/innobase/sync/srw_lock.cc b/storage/innobase/sync/srw_lock.cc index b54191d91b0..71414e8ddb2 100644 --- a/storage/innobase/sync/srw_lock.cc +++ b/storage/innobase/sync/srw_lock.cc @@ -385,7 +385,7 @@ assembler code or a Microsoft intrinsic function. # define IF_NOT_FETCH_OR_GOTO(mem, bit, label) \ __asm__ goto("lock btsl $" #bit ", %0\n\t" \ "jnc %l1" : : "m" (mem) : "cc", "memory" : label); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_IX64) +#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) # define IF_FETCH_OR_GOTO(mem, bit, label) \ if (_interlockedbittestandset(reinterpret_cast<volatile long*>(&mem), bit)) \ goto label; |