diff options
author | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2021-09-15 14:45:43 +0530 |
---|---|---|
committer | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2021-09-15 20:45:46 +0530 |
commit | 43fc608b1eb1567b0fd77ac382cefdbc172296be (patch) | |
tree | 5604e85ab4ae654a1e47f640e4ab07b6dce2fba6 | |
parent | a197727e59abb11d08d5521ada5d7647283dec50 (diff) | |
download | mariadb-git-bb-10.7-MDEV-24621.tar.gz |
MDEV-24621 In bulk insert, pre-sort and build indexes one page at a timebb-10.7-MDEV-24621
- InnoDB stats should check whether the bulk transaction is nonzero
and a transaction by that ID is active, In that case, InnoDB should
pretend that table is empty.
-rw-r--r-- | storage/innobase/dict/dict0stats.cc | 7 | ||||
-rw-r--r-- | storage/innobase/row/row0merge.cc | 19 |
2 files changed, 17 insertions, 9 deletions
diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc index d7466ae5f8a..bd33ea58e7d 100644 --- a/storage/innobase/dict/dict0stats.cc +++ b/storage/innobase/dict/dict0stats.cc @@ -3435,6 +3435,13 @@ dict_stats_update( return(DB_SUCCESS); } + if (trx_id_t bulk_trx_id = table->bulk_trx_id) { + if (trx_sys.find(nullptr, bulk_trx_id, false)) { + dict_stats_empty_table(table, false); + return DB_SUCCESS; + } + } + switch (stats_upd_option) { case DICT_STATS_RECALC_PERSISTENT: diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index 72155b35094..5a2d6dce95d 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -1061,11 +1061,11 @@ tuple field @param blob_file file to store the blob data */ static dberr_t row_merge_buf_blob( const mtuple_t *entry, ulint n_fields, - mem_heap_t *heap, merge_file_t *blob_file) + mem_heap_t **heap, merge_file_t *blob_file) { - if (heap == nullptr) - heap= mem_heap_create(100); + if (*heap == nullptr) + *heap= mem_heap_create(100); for (ulint i= 0; i < n_fields; i++) { @@ -1086,7 +1086,7 @@ static dberr_t row_merge_buf_blob( return err; byte *data= static_cast<byte*>( - mem_heap_alloc(heap, BTR_EXTERN_FIELD_REF_SIZE)); + mem_heap_alloc(*heap, BTR_EXTERN_FIELD_REF_SIZE)); /* Write zeroes for first 8 bytes */ mach_write_to_8(data, 0); @@ -1114,6 +1114,7 @@ row_merge_buf_write( ulint n_fields= dict_index_get_n_fields(index); byte* b = &block[0]; mem_heap_t* blob_heap = nullptr; + dberr_t err = DB_SUCCESS; DBUG_ENTER("row_merge_buf_write"); @@ -1122,10 +1123,10 @@ row_merge_buf_write( if (blob_file) { ut_ad(buf->index->is_primary()); - dberr_t err = row_merge_buf_blob( - entry, n_fields, blob_heap, blob_file); + err = row_merge_buf_blob( + entry, n_fields, &blob_heap, blob_file); if (err != DB_SUCCESS) { - DBUG_RETURN(err); + goto func_exit; } } @@ -1151,12 +1152,12 @@ row_merge_buf_write( DBUG_LOG("ib_merge_sort", "write " << reinterpret_cast<const void*>(b) << ',' << of->fd << ',' << of->offset << " EOF"); - +func_exit: if (blob_heap) { mem_heap_free(blob_heap); } - DBUG_RETURN(DB_SUCCESS); + DBUG_RETURN(err); } /******************************************************//** |