summaryrefslogtreecommitdiff
path: root/storage/innobase/row/row0uins.cc
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2020-06-04 14:37:36 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2020-06-04 19:42:13 +0530
commit6d4c121d98d9d221a2eb22436de8613287c38ac4 (patch)
treeaf67b33766ca5c38d16dd9c30134b9a2ca862632 /storage/innobase/row/row0uins.cc
parent2fcff310d024cc2201586c568391ba8b039f0bf3 (diff)
downloadmariadb-git-10.5-MDEV-515.tar.gz
MDEV-515 innodb bulk insert10.5-MDEV-515
- Introduced assign_stat_n_rows() in dict_table_t. It calculates the number of rows in the table and assign stat_n_rows during ha_innobase::open() - Introduced empty_table() in dict_table_t. Basically it empties all the indexes associated with table (not covered the fts index). This is undo operation of bulk operation. - Introduced new variable bulk_trx_id in dict_table_t. It stores the transaction id of bulk insert. Basically it is protected by exclusive lock of the table. - If table is empty then INSERT, INSERT..SELECT does take exclusive lock on the table. - Introduced new undo log record "TRX_UNDO_UNEMPTY". It should be first undo log during bulk operation. While rollback, if innodb encounters the undo record then it should empty the table. Limitations: =========== - InnoDB should write the undo log for consecutive insert during bulk operation - Parallel read should give empty table depends on bulk_trx_id. - Fix all test case failure in innodb suite - FTS index should be handled while rollback of bulk operation
Diffstat (limited to 'storage/innobase/row/row0uins.cc')
-rw-r--r--storage/innobase/row/row0uins.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/storage/innobase/row/row0uins.cc b/storage/innobase/row/row0uins.cc
index 63edbd9b86d..6329825defd 100644
--- a/storage/innobase/row/row0uins.cc
+++ b/storage/innobase/row/row0uins.cc
@@ -382,6 +382,7 @@ static bool row_undo_ins_parse_undo_rec(undo_node_t* node, bool dict_locked)
ut_ad("wrong undo record type" == 0);
goto close_table;
case TRX_UNDO_INSERT_METADATA:
+ case TRX_UNDO_UNEMPTY:
case TRX_UNDO_INSERT_REC:
break;
case TRX_UNDO_RENAME_TABLE:
@@ -425,8 +426,12 @@ close_table:
node->heap);
} else {
node->ref = &trx_undo_metadata;
+ if (node->rec_type == TRX_UNDO_UNEMPTY) {
+ return true;
+ }
}
+
if (!row_undo_search_clust_to_pcur(node)) {
/* An error probably occurred during
an insert into the clustered index,
@@ -588,6 +593,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_UNEMPTY:
+ node->table->empty_table();
+ err = DB_SUCCESS;
+ break;
}
dict_table_close(node->table, dict_locked, FALSE);