diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-03-27 16:11:26 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-03-27 16:11:26 +0200 |
commit | 3157fa182accab86a4dea45edbcbca4eb5157723 (patch) | |
tree | 9ba82e0c489eb91efbf1e5863c5a98a29b5ea8c3 /storage | |
parent | 480a06718d137c9ee7784012ccb609b9e79ff08c (diff) | |
parent | 48141f3c1787de941d969ad1e6675611b2b650c2 (diff) | |
download | mariadb-git-3157fa182accab86a4dea45edbcbca4eb5157723.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 28 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.h | 4 | ||||
-rw-r--r-- | storage/innobase/include/srv0srv.h | 3 | ||||
-rw-r--r-- | storage/innobase/page/page0zip.cc | 27 | ||||
-rw-r--r-- | storage/innobase/row/row0merge.cc | 4 | ||||
-rw-r--r-- | storage/innobase/row/row0upd.cc | 131 | ||||
-rw-r--r-- | storage/innobase/srv/srv0srv.cc | 3 |
7 files changed, 57 insertions, 143 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 10244c58aab..9bb1235cbbc 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -212,7 +212,6 @@ static char* innodb_large_prefix; stopword table to be used */ static char* innobase_server_stopword_table; -static my_bool innobase_use_atomic_writes; static my_bool innobase_use_checksums; static my_bool innobase_locks_unsafe_for_binlog; static my_bool innobase_rollback_on_timeout; @@ -4110,21 +4109,16 @@ static int innodb_init_params() innobase_commit_concurrency_init_default(); - srv_use_atomic_writes - = innobase_use_atomic_writes && my_may_have_atomic_write; - if (srv_use_atomic_writes && !srv_file_per_table) - { - fprintf(stderr, "InnoDB: Disabling atomic_writes as file_per_table is not used.\n"); - srv_use_atomic_writes= 0; - } + if (innodb_idle_flush_pct != 100) { + ib::warn() << deprecated_idle_flush_pct; + } - if (srv_use_atomic_writes) { - fprintf(stderr, "InnoDB: using atomic writes.\n"); +#ifndef _WIN32 + if (srv_use_atomic_writes && my_may_have_atomic_write) { /* Force O_DIRECT on Unixes (on Windows writes are always unbuffered) */ -#ifndef _WIN32 switch (innodb_flush_method) { case SRV_O_DIRECT: case SRV_O_DIRECT_NO_FSYNC: @@ -4133,8 +4127,8 @@ static int innodb_init_params() innodb_flush_method = SRV_O_DIRECT; fprintf(stderr, "InnoDB: using O_DIRECT due to atomic writes.\n"); } -#endif } +#endif if (srv_read_only_mode) { ib::info() << "Started in read only mode"; @@ -19244,12 +19238,10 @@ static MYSQL_SYSVAR_BOOL(doublewrite, srv_use_doublewrite_buf, " Disable with --skip-innodb-doublewrite.", NULL, NULL, TRUE); -static MYSQL_SYSVAR_BOOL(use_atomic_writes, innobase_use_atomic_writes, +static MYSQL_SYSVAR_BOOL(use_atomic_writes, srv_use_atomic_writes, PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, "Enable atomic writes, instead of using the doublewrite buffer, for files " "on devices that supports atomic writes. " - "To use this option one must use " - "innodb_file_per_table=1, innodb_flush_method=O_DIRECT. " "This option only works on Linux with either FusionIO cards using " "the directFS filesystem or with Shannon cards using any file system.", NULL, NULL, TRUE); @@ -20259,11 +20251,6 @@ static MYSQL_SYSVAR_BOOL(master_thread_disabled_debug, PLUGIN_VAR_OPCMDARG, "Disable master thread", NULL, srv_master_thread_disabled_debug_update, FALSE); - -static MYSQL_SYSVAR_UINT(simulate_comp_failures, srv_simulate_comp_failures, - PLUGIN_VAR_NOCMDARG, - "Simulate compression failures.", - NULL, NULL, 0, 0, 99, 0); #endif /* UNIV_DEBUG */ static MYSQL_SYSVAR_BOOL(force_primary_key, @@ -20580,7 +20567,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(compression_pad_pct_max), MYSQL_SYSVAR(default_row_format), #ifdef UNIV_DEBUG - MYSQL_SYSVAR(simulate_comp_failures), MYSQL_SYSVAR(trx_rseg_n_slots_debug), MYSQL_SYSVAR(limit_optimistic_insert_debug), MYSQL_SYSVAR(trx_purge_view_update_only_debug), diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 58f825cebda..038528cc2e4 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2020, MariaDB Corporation. +Copyright (c) 2013, 2021, 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 @@ -46,7 +46,7 @@ struct ha_table_option_struct uint atomic_writes; /*!< Use atomic writes for this table if this options is ON or in DEFAULT if - srv_use_atomic_writes=1. + innodb_use_atomic_writes. Atomic writes are not used if value OFF.*/ uint encryption; /*!< DEFAULT, ON, OFF */ diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index c587ed6f53d..6aa079676a0 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -596,9 +596,6 @@ extern struct export_var_t export_vars; /** Global counters */ extern srv_stats_t srv_stats; -/** Simulate compression failures. */ -extern uint srv_simulate_comp_failures; - /** Fatal semaphore wait threshold = maximum number of seconds that semaphore times out in InnoDB */ #define DEFAULT_SRV_FATAL_SEMAPHORE_TIMEOUT 600 diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index 50b2a56a941..382d4d5eeb3 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -1370,33 +1370,6 @@ page_zip_compress( MONITOR_INC(MONITOR_PAGE_COMPRESS); - /* Simulate a compression failure with a probability determined by - innodb_simulate_comp_failures, only if the page has 2 or more - records. */ - - if (srv_simulate_comp_failures - && !dict_index_is_ibuf(index) - && page_get_n_recs(page) >= 2 - && ((ulint)(rand() % 100) < srv_simulate_comp_failures) - && strcmp(index->table->name.m_name, "IBUF_DUMMY")) { - -#ifdef UNIV_DEBUG - ib::error() - << "Simulating a compression failure" - << " for table " << index->table->name - << " index " - << index->name() - << " page " - << page_get_page_no(page) - << "(" - << (page_is_leaf(page) ? "leaf" : "non-leaf") - << ")"; - -#endif - - goto err_exit; - } - heap = mem_heap_create(page_zip_get_size(page_zip) + n_fields * (2 + sizeof(ulint)) + REC_OFFS_HEADER_SIZE diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index 484676aa08d..7a9c2cd9240 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -4862,10 +4862,6 @@ wait_again: buf, i + 1, n_indexes); } - DBUG_EXECUTE_IF( - "ib_merge_wait_after_sort", - os_thread_sleep(20000000);); /* 20 sec */ - if (error == DB_SUCCESS) { BtrBulk btr_bulk(sort_idx, trx, trx->get_flush_observer()); diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index 284009becf5..97640debc03 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -126,25 +126,23 @@ NOTE that since we do not hold dict_operation_lock when leaving the function, it may be that the referencing table has been dropped when we leave this function: this function is only for heuristic use! -@return TRUE if referenced */ +@return true if referenced */ static -ibool +bool row_upd_index_is_referenced( /*========================*/ dict_index_t* index, /*!< in: index */ trx_t* trx) /*!< in: transaction */ { dict_table_t* table = index->table; - ibool froze_data_dict = FALSE; - ibool is_referenced = FALSE; if (table->referenced_set.empty()) { - return(FALSE); + return false; } - if (trx->dict_operation_lock_mode == 0) { + const bool froze_data_dict = !trx->dict_operation_lock_mode; + if (froze_data_dict) { row_mysql_freeze_data_dictionary(trx); - froze_data_dict = TRUE; } dict_foreign_set::iterator it @@ -152,13 +150,13 @@ row_upd_index_is_referenced( table->referenced_set.end(), dict_foreign_with_index(index)); - is_referenced = (it != table->referenced_set.end()); + const bool is_referenced = (it != table->referenced_set.end()); if (froze_data_dict) { row_mysql_unfreeze_data_dictionary(trx); } - return(is_referenced); + return is_referenced; } #ifdef WITH_WSREP @@ -2281,7 +2279,6 @@ row_upd_sec_index_entry( dtuple_t* entry; dict_index_t* index; btr_cur_t* btr_cur; - ibool referenced; dberr_t err = DB_SUCCESS; trx_t* trx = thr_get_trx(thr); ulint mode; @@ -2292,7 +2289,7 @@ row_upd_sec_index_entry( index = node->index; - referenced = row_upd_index_is_referenced(index, trx); + const bool referenced = row_upd_index_is_referenced(index, trx); #ifdef WITH_WSREP bool foreign = wsrep_row_upd_index_is_foreign(index, trx); #endif /* WITH_WSREP */ @@ -2693,12 +2690,13 @@ row_upd_clust_rec_by_insert( upd_node_t* node, /*!< in/out: row update node */ dict_index_t* index, /*!< in: clustered index of the record */ que_thr_t* thr, /*!< in: query thread */ - ibool referenced,/*!< in: TRUE if index may be referenced in + bool referenced,/*!< in: whether index may be referenced in a foreign key constraint */ #ifdef WITH_WSREP bool foreign,/*!< in: whether this is a foreign key */ #endif - mtr_t* mtr) /*!< in/out: mtr; gets committed here */ + mtr_t* mtr) /*!< in/out: mini-transaction, + may be committed and restarted */ { mem_heap_t* heap; btr_pcur_t* pcur; @@ -2764,10 +2762,7 @@ row_upd_clust_rec_by_insert( btr_cur_get_block(btr_cur), rec, index, offsets, thr, node->row, mtr); if (err != DB_SUCCESS) { -err_exit: - mtr_commit(mtr); - mem_heap_free(heap); - return(err); + goto err_exit; } /* If the the new row inherits externally stored @@ -2826,14 +2821,14 @@ check_fk: } } - mtr_commit(mtr); + mtr->commit(); + mtr->start(); + node->state = UPD_NODE_INSERT_CLUSTERED; err = row_ins_clust_index_entry(index, entry, thr, dtuple_get_n_ext(entry)); - node->state = UPD_NODE_INSERT_CLUSTERED; - +err_exit: mem_heap_free(heap); - return(err); } @@ -2853,7 +2848,8 @@ row_upd_clust_rec( mem_heap_t** offsets_heap, /*!< in/out: memory heap, can be emptied */ que_thr_t* thr, /*!< in: query thread */ - mtr_t* mtr) /*!< in: mtr; gets committed here */ + mtr_t* mtr) /*!< in,out: mini-transaction; may be + committed and restarted here */ { mem_heap_t* heap = NULL; big_rec_t* big_rec = NULL; @@ -2899,16 +2895,15 @@ row_upd_clust_rec( goto success; } - mtr_commit(mtr); - if (buf_LRU_buf_pool_running_out()) { - err = DB_LOCK_TABLE_FULL; goto func_exit; } + /* We may have to modify the tree structure: do a pessimistic descent down the index tree */ + mtr->commit(); mtr->start(); if (index->table->is_temporary()) { @@ -2958,7 +2953,6 @@ success: } } - mtr_commit(mtr); func_exit: if (heap) { mem_heap_free(heap); @@ -2983,17 +2977,17 @@ row_upd_del_mark_clust_rec( rec_offs* offsets,/*!< in/out: rec_get_offsets() for the record under the cursor */ que_thr_t* thr, /*!< in: query thread */ - ibool referenced, - /*!< in: TRUE if index may be referenced in + bool referenced, + /*!< in: whether index may be referenced in a foreign key constraint */ #ifdef WITH_WSREP bool foreign,/*!< in: whether this is a foreign key */ #endif - mtr_t* mtr) /*!< in: mtr; gets committed here */ + mtr_t* mtr) /*!< in,out: mini-transaction; + will be committed and restarted */ { btr_pcur_t* pcur; btr_cur_t* btr_cur; - dberr_t err; rec_t* rec; trx_t* trx = thr_get_trx(thr); @@ -3009,8 +3003,7 @@ row_upd_del_mark_clust_rec( if (!row_upd_store_row(node, trx->mysql_thd, thr->prebuilt && thr->prebuilt->table == node->table ? thr->prebuilt->m_mysql_table : NULL)) { - err = DB_COMPUTE_VALUE_FAILED; - return err; + return DB_COMPUTE_VALUE_FAILED; } /* Mark the clustered index record deleted; we do not have to check @@ -3018,7 +3011,7 @@ row_upd_del_mark_clust_rec( rec = btr_cur_get_rec(btr_cur); - err = btr_cur_del_mark_set_clust_rec( + dberr_t err = btr_cur_del_mark_set_clust_rec( btr_cur_get_block(btr_cur), rec, index, offsets, thr, node->row, mtr); @@ -3055,8 +3048,6 @@ row_upd_del_mark_clust_rec( #endif /* WITH_WSREP */ } - mtr_commit(mtr); - return(err); } @@ -3073,14 +3064,12 @@ row_upd_clust_step( { dict_index_t* index; btr_pcur_t* pcur; - ibool success; dberr_t err; mtr_t mtr; rec_t* rec; mem_heap_t* heap = NULL; rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; rec_offs* offsets; - ibool referenced; ulint flags; trx_t* trx = thr_get_trx(thr); @@ -3088,8 +3077,7 @@ row_upd_clust_step( index = dict_table_get_first_index(node->table); - referenced = row_upd_index_is_referenced(index, trx); - + const bool referenced = row_upd_index_is_referenced(index, trx); #ifdef WITH_WSREP const bool foreign = wsrep_row_upd_index_is_foreign(index, trx); #endif @@ -3135,14 +3123,9 @@ row_upd_clust_step( mode = BTR_MODIFY_LEAF; } - success = btr_pcur_restore_position(mode, pcur, &mtr); - - if (!success) { + if (!btr_pcur_restore_position(mode, pcur, &mtr)) { err = DB_RECORD_NOT_FOUND; - - mtr_commit(&mtr); - - return(err); + goto exit_func; } /* If this is a row in SYS_INDEXES table of the data dictionary, @@ -3162,14 +3145,9 @@ row_upd_clust_step( mtr.start(); index->set_modified(mtr); - success = btr_pcur_restore_position(BTR_MODIFY_LEAF, pcur, - &mtr); - if (!success) { + if (!btr_pcur_restore_position(BTR_MODIFY_LEAF, pcur, &mtr)) { err = DB_ERROR; - - mtr.commit(); - - return(err); + goto exit_func; } } @@ -3182,7 +3160,6 @@ row_upd_clust_step( 0, btr_pcur_get_block(pcur), rec, index, offsets, thr); if (err != DB_SUCCESS) { - mtr.commit(); goto exit_func; } } @@ -3193,8 +3170,6 @@ row_upd_clust_step( btr_pcur_get_block(pcur), page_rec_get_heap_no(rec))); - /* NOTE: the following function calls will also commit mtr */ - if (node->is_delete == PLAIN_DELETE) { err = row_upd_del_mark_clust_rec( node, index, offsets, thr, referenced, @@ -3202,13 +3177,7 @@ row_upd_clust_step( foreign, #endif &mtr); - - if (err == DB_SUCCESS) { - node->state = UPD_NODE_UPDATE_ALL_SEC; - node->index = dict_table_get_next_index(index); - } - - goto exit_func; + goto all_done; } /* If the update is made for MySQL, we already have the update vector @@ -3223,14 +3192,13 @@ row_upd_clust_step( } if (!node->is_delete && node->cmpl_info & UPD_NODE_NO_ORD_CHANGE) { - err = row_upd_clust_rec( flags, node, index, offsets, &heap, thr, &mtr); goto exit_func; } - if(!row_upd_store_row(node, trx->mysql_thd, - thr->prebuilt ? thr->prebuilt->m_mysql_table : NULL)) { + if (!row_upd_store_row(node, trx->mysql_thd, thr->prebuilt + ? thr->prebuilt->m_mysql_table : NULL)) { err = DB_COMPUTE_VALUE_FAILED; goto exit_func; } @@ -3255,34 +3223,31 @@ row_upd_clust_step( foreign, #endif &mtr); - if (err != DB_SUCCESS) { - - goto exit_func; +all_done: + if (err == DB_SUCCESS) { + node->state = UPD_NODE_UPDATE_ALL_SEC; +success: + node->index = dict_table_get_next_index(index); } - - node->state = UPD_NODE_UPDATE_ALL_SEC; } else { err = row_upd_clust_rec( flags, node, index, offsets, &heap, thr, &mtr); - if (err != DB_SUCCESS) { - - goto exit_func; + if (err == DB_SUCCESS) { + ut_ad(node->is_delete != PLAIN_DELETE); + node->state = node->is_delete + ? UPD_NODE_UPDATE_ALL_SEC + : UPD_NODE_UPDATE_SOME_SEC; + goto success; } - - ut_ad(node->is_delete != PLAIN_DELETE); - node->state = node->is_delete ? - UPD_NODE_UPDATE_ALL_SEC : - UPD_NODE_UPDATE_SOME_SEC; } - node->index = dict_table_get_next_index(index); - exit_func: - if (heap) { + mtr.commit(); + if (UNIV_LIKELY_NULL(heap)) { mem_heap_free(heap); } - return(err); + return err; } /***********************************************************//** diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 9fd0e097b86..3da92d48feb 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -489,9 +489,6 @@ current_time % 5 != 0. */ #endif /* MEM_PERIODIC_CHECK */ # define SRV_MASTER_DICT_LRU_INTERVAL (47) -/** Simulate compression failures. */ -UNIV_INTERN uint srv_simulate_comp_failures; - /** Buffer pool dump status frequence in percentages */ UNIV_INTERN ulong srv_buf_dump_status_frequency; |