diff options
Diffstat (limited to 'storage/innobase/btr/btr0cur.cc')
-rw-r--r-- | storage/innobase/btr/btr0cur.cc | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 9efa2d8f8bd..48b2cf58c09 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -3242,6 +3242,41 @@ btr_cur_ins_lock_and_undo( || (flags & BTR_CREATE_FLAG)); ut_ad(mtr->is_named_space(index->table->space)); + if (thr){ + trx_t* trx = thr_get_trx(thr); + + if (index->table->bulk_trx_id + && index->table->bulk_trx_id == trx->id) { + /* For first insert */ + if (trx->mod_tables.empty() + || trx->mod_tables.find(index->table) + == trx->mod_tables.end()) { + + dfield_t *t = dtuple_get_nth_field( + entry, index->db_trx_id()); + + ut_ad(t->len == DATA_TRX_ID_LEN); + memset(t->data, 0, DATA_TRX_ID_LEN); + + err = trx_undo_report_row_operation( + thr, index, entry, NULL, 0, + NULL, NULL, &roll_ptr); + + if (err == DB_SUCCESS) { + roll_ptr = roll_ptr_t(1) + << ROLL_PTR_INSERT_FLAG_POS; + goto upd_sys; + } + + return err; + } + + if (!index->table->allow_insert_undo) { + flags |= BTR_NO_UNDO_LOG_FLAG; + } + } + } + /* Check if there is predicate or GAP lock preventing the insertion */ if (!(flags & BTR_NO_LOCKING_FLAG)) { if (dict_index_is_spatial(index)) { @@ -3526,7 +3561,9 @@ fail_err: ut_ad(thr->graph->trx->id == trx_read_trx_id( static_cast<const byte*>( - trx_id->data))); + trx_id->data)) + || thr->graph->trx->id + == index->table->bulk_trx_id); } } #endif @@ -3582,7 +3619,7 @@ fail_err: } else if (entry->info_bits & REC_INFO_MIN_REC_FLAG) { ut_ad(entry->is_metadata()); ut_ad(index->is_instant()); - ut_ad(flags == BTR_NO_LOCKING_FLAG); + ut_ad(flags & BTR_NO_LOCKING_FLAG); } else { rw_lock_t* ahi_latch = btr_search_sys.get_latch(*index); if (!reorg && cursor->flag == BTR_CUR_HASH) { @@ -5522,6 +5559,7 @@ btr_cur_optimistic_delete_func( if (index->is_instant()) { /* MDEV-17383: free metadata BLOBs! */ index->clear_instant_alter(); + index->table->remove_bulk_trx(); } page_cur_set_after_last(block, btr_cur_get_page_cur(cursor)); @@ -5739,6 +5777,7 @@ btr_cur_pessimistic_delete( if (index->is_instant()) { /* MDEV-17383: free metadata BLOBs! */ index->clear_instant_alter(); + index->table->remove_bulk_trx(); } page_cur_set_after_last( block, |