diff options
author | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2020-12-11 17:27:53 +0530 |
---|---|---|
committer | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2020-12-11 17:34:50 +0530 |
commit | f369e4b9b01599ad9e308e969fc8401438b5ae64 (patch) | |
tree | 1e980db121f342b5366ab0f1e0cedaca3a3f8de5 /storage/innobase/row/row0uins.cc | |
parent | 0c7c449267655ed759f223067c5095d7df3665b3 (diff) | |
download | mariadb-git-bb-10.5-MDEV-515-1.tar.gz |
MDEV-515 InnoDB bulk insertbb-10.5-MDEV-515-1
dict_table_t::bulk_trx_id: Stores the bulk insert
transaction id. Protected by exclusive lock of the table.
It can be used by other connection read operation to
identify whether to read the table
dict_table_t::allow_insert_undo: Allows normal insert row
undo logging for the table during bulk transaction
Introduced new undo log record "TRX_UNDO_EMPTY".
It should be first undo log during bulk insert operation.
While rollback, if innodb encounters the undo record
then it should empty the table
dict_table_t::empty_table(): Basically it empties all the
indexes associated with table . This is undo operation
of bulk insert operation. Metadata record should be retained
during this rollback operation
dict_table_t::remove_bulk_trx(): Resets the bulk_trx_id and
allow_insert_undo
row_log_table_empty(): If the table is being created during
empty_table() then log the EMPTY operation in the online log
row_log_online_op(): If the secondary index is being created
during empty_table() then log ROW_OP_EMPTY operation
in online log
row_log_table_apply_empty(): Applies the ROW_T_EMPTY to the
table that was being rebuild. It does call empty_table() to
empty the table.
btr_root_page_init(): Initialize the root page of the b-tree.
It is used during dict_index_t::empty() and btr_create().
btr_cur_ins_lock_and_undo(): During first insert of bulk
insert operation, write UNDO_EMPTY undo log of it and
reset DB_TRX_ID and DB_ROLL_PTR.
trx_mark_sql_stat_end(): Set the allow_insert_undo for
bulk operation of the table. So that consecutive insert
does allow undo operation.
row_search_mvcc(): check whether the current transaction
can view the table records based on bulk_trx_id.
row_merge_read_clustered_index(): Avoid the table read if the
bulk transaction id of the table is not visible within
current transaction read view.
- Add new insert in many test case to avoid the hang. Because
MDEV-515 takes X-lock of the table for first insert. So concurrent
insert will wait for X-lock to be released.
Diffstat (limited to 'storage/innobase/row/row0uins.cc')
-rw-r--r-- | storage/innobase/row/row0uins.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/storage/innobase/row/row0uins.cc b/storage/innobase/row/row0uins.cc index 0ce136c5906..f4c37d26d76 100644 --- a/storage/innobase/row/row0uins.cc +++ b/storage/innobase/row/row0uins.cc @@ -384,6 +384,7 @@ static bool row_undo_ins_parse_undo_rec(undo_node_t* node, bool dict_locked) goto close_table; case TRX_UNDO_INSERT_METADATA: case TRX_UNDO_INSERT_REC: + case TRX_UNDO_EMPTY: break; case TRX_UNDO_RENAME_TABLE: dict_table_t* table = node->table; @@ -424,6 +425,9 @@ close_table: ptr = trx_undo_rec_get_row_ref( ptr, clust_index, &node->ref, node->heap); + } else if (node->rec_type == TRX_UNDO_EMPTY) { + node->ref = nullptr; + return true; } else { node->ref = &trx_undo_metadata; if (!row_undo_search_clust_to_pcur(node)) { @@ -596,6 +600,11 @@ row_undo_ins( log_free_check(); ut_ad(!node->table->is_temporary()); err = row_undo_ins_remove_clust_rec(node); + break; + case TRX_UNDO_EMPTY: + node->table->empty_table(thr); + err = DB_SUCCESS; + break; } dict_table_close(node->table, dict_locked, FALSE); |