diff options
Diffstat (limited to 'storage/innobase/row/row0ins.cc')
-rw-r--r-- | storage/innobase/row/row0ins.cc | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index c45d6554627..44c9ac32d16 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -1314,7 +1314,7 @@ row_ins_foreign_check_on_constraint( row_mysql_freeze_data_dictionary(thr_get_trx(thr)); - mtr_start(mtr); + mtr_start_trx(mtr, trx); /* Restore pcur position */ @@ -1342,7 +1342,7 @@ nonstandard_exit_func: btr_pcur_store_position(pcur, mtr); mtr_commit(mtr); - mtr_start(mtr); + mtr_start_trx(mtr, trx); btr_pcur_restore_position(BTR_SEARCH_LEAF, pcur, mtr); @@ -1550,7 +1550,7 @@ run_again: } } - mtr_start(&mtr); + mtr_start_trx(&mtr, trx); /* Store old value on n_fields_cmp */ @@ -1973,7 +1973,7 @@ row_ins_scan_sec_index_for_duplicate( do { const rec_t* rec = btr_pcur_get_rec(&pcur); const buf_block_t* block = btr_pcur_get_block(&pcur); - ulint lock_type; + const ulint lock_type = LOCK_ORDINARY; if (page_rec_is_infimum(rec)) { @@ -1983,16 +1983,6 @@ row_ins_scan_sec_index_for_duplicate( offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &offsets_heap); - /* If the transaction isolation level is no stronger than - READ COMMITTED, then avoid gap locks. */ - if (!page_rec_is_supremum(rec) - && thr_get_trx(thr)->isolation_level - <= TRX_ISO_READ_COMMITTED) { - lock_type = LOCK_REC_NOT_GAP; - } else { - lock_type = LOCK_ORDINARY; - } - if (flags & BTR_NO_LOCKING_FLAG) { /* Set no locks when applying log in online table rebuild. */ @@ -2358,7 +2348,7 @@ row_ins_clust_index_entry_low( || n_uniq == dict_index_get_n_unique(index)); ut_ad(!n_uniq || n_uniq == dict_index_get_n_unique(index)); - mtr_start(&mtr); + mtr_start_trx(&mtr, thr_get_trx(thr)); if (mode == BTR_MODIFY_LEAF && dict_index_is_online_ddl(index)) { mode = BTR_MODIFY_LEAF | BTR_ALREADY_S_LATCHED; @@ -2571,9 +2561,10 @@ Starts a mini-transaction and checks if the index will be dropped. @return true if the index is to be dropped */ static __attribute__((nonnull, warn_unused_result)) bool -row_ins_sec_mtr_start_and_check_if_aborted( +row_ins_sec_mtr_start_trx_and_check_if_aborted( /*=======================================*/ mtr_t* mtr, /*!< out: mini-transaction */ + trx_t* trx, /*!< in: transaction handle */ dict_index_t* index, /*!< in/out: secondary index */ bool check, /*!< in: whether to check */ ulint search_mode) @@ -2581,7 +2572,7 @@ row_ins_sec_mtr_start_and_check_if_aborted( { ut_ad(!dict_index_is_clust(index)); - mtr_start(mtr); + mtr_start_trx(mtr, trx); if (!check) { return(false); @@ -2639,13 +2630,14 @@ row_ins_sec_index_entry_low( ulint n_unique; mtr_t mtr; ulint* offsets = NULL; + trx_t* trx = thr_get_trx(thr); ut_ad(!dict_index_is_clust(index)); ut_ad(mode == BTR_MODIFY_LEAF || mode == BTR_MODIFY_TREE); cursor.thr = thr; ut_ad(thr_get_trx(thr)->id); - mtr_start(&mtr); + mtr_start_trx(&mtr, trx); /* Ensure that we acquire index->lock when inserting into an index with index->online_status == ONLINE_INDEX_COMPLETE, but @@ -2706,8 +2698,8 @@ row_ins_sec_index_entry_low( DEBUG_SYNC_C("row_ins_sec_index_unique"); - if (row_ins_sec_mtr_start_and_check_if_aborted( - &mtr, index, check, search_mode)) { + if (row_ins_sec_mtr_start_trx_and_check_if_aborted( + &mtr, trx, index, check, search_mode)) { goto func_exit; } @@ -2741,8 +2733,8 @@ row_ins_sec_index_entry_low( return(err); } - if (row_ins_sec_mtr_start_and_check_if_aborted( - &mtr, index, check, search_mode)) { + if (row_ins_sec_mtr_start_trx_and_check_if_aborted( + &mtr, trx, index, check, search_mode)) { goto func_exit; } |