summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2018-03-30 15:10:40 +0400
committerSergey Vojtovich <svoj@mariadb.org>2018-04-04 14:09:37 +0400
commit3d5f7ad23ad71ab3a79a753f4c9d04d34c92f411 (patch)
tree3b8305cdd76381ec248f12352e59800ee0b7359a
parent0993d6b81b6cf7a5fc0710d99e962a8271018b9d (diff)
downloadmariadb-git-3d5f7ad23ad71ab3a79a753f4c9d04d34c92f411.tar.gz
MDEV-15773 - Simplified away trx_free_for_(mysql|background)
-rw-r--r--storage/innobase/dict/dict0crea.cc6
-rw-r--r--storage/innobase/dict/dict0dict.cc4
-rw-r--r--storage/innobase/dict/dict0load.cc4
-rw-r--r--storage/innobase/dict/dict0stats.cc6
-rw-r--r--storage/innobase/fts/fts0fts.cc32
-rw-r--r--storage/innobase/fts/fts0opt.cc4
-rw-r--r--storage/innobase/fts/fts0que.cc2
-rw-r--r--storage/innobase/handler/ha_innodb.cc20
-rw-r--r--storage/innobase/handler/handler0alter.cc15
-rw-r--r--storage/innobase/handler/i_s.cc6
-rw-r--r--storage/innobase/include/trx0trx.h14
-rw-r--r--storage/innobase/row/row0ftsort.cc2
-rw-r--r--storage/innobase/row/row0import.cc2
-rw-r--r--storage/innobase/row/row0merge.cc2
-rw-r--r--storage/innobase/row/row0mysql.cc6
-rw-r--r--storage/innobase/row/row0trunc.cc2
-rw-r--r--storage/innobase/trx/trx0purge.cc2
-rw-r--r--storage/innobase/trx/trx0roll.cc2
-rw-r--r--storage/innobase/trx/trx0trx.cc94
19 files changed, 96 insertions, 129 deletions
diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc
index e2ea9e27c58..fa9eeeae620 100644
--- a/storage/innobase/dict/dict0crea.cc
+++ b/storage/innobase/dict/dict0crea.cc
@@ -1588,7 +1588,7 @@ dict_create_or_check_foreign_constraint_tables(void)
row_mysql_unlock_data_dictionary(trx);
- trx_free_for_background(trx);
+ trx_free(trx);
srv_file_per_table = srv_file_per_table_backup;
@@ -1692,7 +1692,7 @@ dict_create_or_check_sys_virtual()
row_mysql_unlock_data_dictionary(trx);
- trx_free_for_background(trx);
+ trx_free(trx);
srv_file_per_table = srv_file_per_table_backup;
@@ -2356,7 +2356,7 @@ dict_create_or_check_sys_tablespace(void)
row_mysql_unlock_data_dictionary(trx);
- trx_free_for_background(trx);
+ trx_free(trx);
srv_file_per_table = srv_file_per_table_backup;
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index c88dceafd2d..e6ec915c0b3 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -444,7 +444,7 @@ dict_table_try_drop_aborted(
}
row_mysql_unlock_data_dictionary(trx);
- trx_free_for_background(trx);
+ trx_free(trx);
}
/**********************************************************************//**
@@ -2046,7 +2046,7 @@ dict_table_remove_from_cache_low(
row_merge_drop_indexes_dict(trx, table->id);
trx_commit_for_mysql(trx);
trx->dict_operation_lock_mode = 0;
- trx_free_for_background(trx);
+ trx_free(trx);
}
/* Free virtual column template if any */
diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc
index 517b9019524..c82dffd36b2 100644
--- a/storage/innobase/dict/dict0load.cc
+++ b/storage/innobase/dict/dict0load.cc
@@ -914,7 +914,7 @@ dict_update_filepath(
trx_commit_for_mysql(trx);
trx->dict_operation_lock_mode = 0;
- trx_free_for_background(trx);
+ trx_free(trx);
if (err == DB_SUCCESS) {
/* We just updated SYS_DATAFILES due to the contents in
@@ -976,7 +976,7 @@ dict_replace_tablespace_and_filepath(
trx_commit_for_mysql(trx);
trx->dict_operation_lock_mode = 0;
- trx_free_for_background(trx);
+ trx_free(trx);
return(err);
}
diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc
index 1c4c3845431..88460978ade 100644
--- a/storage/innobase/dict/dict0stats.cc
+++ b/storage/innobase/dict/dict0stats.cc
@@ -333,7 +333,7 @@ dict_stats_exec_sql(
}
if (trx_started) {
- trx_free_for_background(trx);
+ trx_free(trx);
}
return(err);
@@ -2602,7 +2602,7 @@ dict_stats_save(
trx_commit_for_mysql(trx);
end:
- trx_free_for_background(trx);
+ trx_free(trx);
mutex_exit(&dict_sys->mutex);
rw_lock_x_unlock(dict_operation_lock);
@@ -3078,7 +3078,7 @@ dict_stats_fetch_from_ps(
trx_commit_for_mysql(trx);
- trx_free_for_background(trx);
+ trx_free(trx);
if (!index_fetch_arg.stats_were_modified) {
return(DB_STATS_DO_NOT_EXIST);
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index da92f0f4a69..c06de6a9add 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -552,7 +552,7 @@ cleanup:
mutex_exit(&dict_sys->mutex);
}
- trx_free_for_background(trx);
+ trx_free(trx);
return(ret);
}
@@ -2758,7 +2758,7 @@ func_exit:
}
}
- trx_free_for_background(trx);
+ trx_free(trx);
return(error);
}
@@ -2839,7 +2839,7 @@ fts_update_sync_doc_id(
fts_sql_rollback(trx);
}
- trx_free_for_background(trx);
+ trx_free(trx);
}
return(error);
@@ -3084,7 +3084,7 @@ fts_commit_table(
fts_sql_commit(trx);
- trx_free_for_background(trx);
+ trx_free(trx);
return(error);
}
@@ -3875,7 +3875,7 @@ fts_doc_fetch_by_doc_id(
error = fts_eval_sql(trx, graph);
fts_sql_commit(trx);
- trx_free_for_background(trx);
+ trx_free(trx);
if (!get_doc) {
fts_que_graph_free(graph);
@@ -4271,7 +4271,7 @@ fts_sync_commit(
/* Avoid assertion in trx_free(). */
trx->dict_operation_lock_mode = 0;
- trx_free_for_background(trx);
+ trx_free(trx);
return(error);
}
@@ -4325,7 +4325,7 @@ fts_sync_rollback(
/* Avoid assertion in trx_free(). */
trx->dict_operation_lock_mode = 0;
- trx_free_for_background(trx);
+ trx_free(trx);
}
/** Run SYNC on the table, i.e., write out data from the cache to the
@@ -5055,7 +5055,7 @@ fts_get_rows_count(
fts_que_graph_free(graph);
- trx_free_for_background(trx);
+ trx_free(trx);
return(count);
}
@@ -5081,7 +5081,7 @@ fts_update_max_cache_size(
fts_sql_commit(trx);
- trx_free_for_background(trx);
+ trx_free(trx);
}
#endif /* FTS_CACHE_SIZE_DEBUG */
@@ -6394,14 +6394,14 @@ fts_rename_aux_tables_to_hex_format_low(
<< table->name << ". Please revert"
" manually.";
fts_sql_rollback(trx_bg);
- trx_free_for_background(trx_bg);
+ trx_free(trx_bg);
/* Continue to clear aux tables' flags2 */
not_rename = true;
continue;
}
fts_sql_commit(trx_bg);
- trx_free_for_background(trx_bg);
+ trx_free(trx_bg);
}
DICT_TF2_FLAG_UNSET(parent_table, DICT_TF2_FTS_AUX_HEX_NAME);
@@ -6643,12 +6643,12 @@ fts_rename_aux_tables_to_hex_format(
fts_parent_all_index_set_corrupt(trx_corrupt, parent_table);
trx_corrupt->dict_operation_lock_mode = 0;
fts_sql_commit(trx_corrupt);
- trx_free_for_background(trx_corrupt);
+ trx_free(trx_corrupt);
} else {
fts_sql_commit(trx_rename);
}
- trx_free_for_background(trx_rename);
+ trx_free(trx_rename);
ib_vector_reset(aux_tables);
}
@@ -6726,7 +6726,7 @@ fts_drop_obsolete_aux_table_from_vector(
fts_sql_commit(trx_drop);
}
- trx_free_for_background(trx_drop);
+ trx_free(trx_drop);
}
}
@@ -7221,7 +7221,7 @@ fts_drop_orphaned_tables(void)
row_mysql_unlock_data_dictionary(trx);
- trx_free_for_background(trx);
+ trx_free(trx);
if (heap != NULL) {
mem_heap_free(heap);
@@ -7402,7 +7402,7 @@ cleanup:
fts_sql_rollback(trx);
}
- trx_free_for_background(trx);
+ trx_free(trx);
}
if (!cache->stopword_info.cached_stopword) {
diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc
index da71069a29b..2d8944f0290 100644
--- a/storage/innobase/fts/fts0opt.cc
+++ b/storage/innobase/fts/fts0opt.cc
@@ -1028,7 +1028,7 @@ fts_table_fetch_doc_ids(
}
if (alloc_bk_trx) {
- trx_free_for_background(trx);
+ trx_free(trx);
}
return(error);
@@ -1740,7 +1740,7 @@ fts_optimize_free(
mem_heap_t* heap = static_cast<mem_heap_t*>(optim->self_heap->arg);
trx_commit_for_mysql(optim->trx);
- trx_free_for_background(optim->trx);
+ trx_free(optim->trx);
fts_doc_ids_free(optim->to_delete);
fts_optimize_graph_free(&optim->graph);
diff --git a/storage/innobase/fts/fts0que.cc b/storage/innobase/fts/fts0que.cc
index 0be85ba8595..598573c2192 100644
--- a/storage/innobase/fts/fts0que.cc
+++ b/storage/innobase/fts/fts0que.cc
@@ -4120,7 +4120,7 @@ fts_query(
func_exit:
fts_query_free(&query);
- trx_free_for_background(query_trx);
+ trx_free(query_trx);
return(error);
}
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 96557a1d028..3c4e0427668 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -4244,7 +4244,7 @@ innobase_end(handlerton*, ha_panic_function)
if (thd) { // may be UNINSTALL PLUGIN statement
trx_t* trx = thd_to_trx(thd);
if (trx) {
- trx_free_for_mysql(trx);
+ trx_free(trx);
}
}
@@ -5013,7 +5013,7 @@ innobase_close_connection(
} else {
rollback_and_free:
innobase_rollback_trx(trx);
- trx_free_for_mysql(trx);
+ trx_free(trx);
}
}
@@ -12582,7 +12582,7 @@ create_table_info_t::create_table_update_dict()
if (!innobase_fts_load_stopword(innobase_table, NULL, m_thd)) {
dict_table_close(innobase_table, FALSE, FALSE);
srv_active_wake_master_thread();
- trx_free_for_mysql(m_trx);
+ trx_free(m_trx);
DBUG_RETURN(-1);
}
}
@@ -12707,14 +12707,14 @@ ha_innobase::create(
srv_active_wake_master_thread();
- trx_free_for_mysql(trx);
+ trx_free(trx);
DBUG_RETURN(error);
cleanup:
trx_rollback_for_mysql(trx);
row_mysql_unlock_data_dictionary(trx);
- trx_free_for_mysql(trx);
+ trx_free(trx);
DBUG_RETURN(error);
}
@@ -13076,7 +13076,7 @@ ha_innobase::delete_table(
innobase_commit_low(trx);
- trx_free_for_mysql(trx);
+ trx_free(trx);
DBUG_RETURN(convert_error_code_to_mysql(err, 0, NULL));
}
@@ -13149,7 +13149,7 @@ innobase_drop_database(
innobase_commit_low(trx);
- trx_free_for_mysql(trx);
+ trx_free(trx);
}
/*********************************************************************//**
@@ -13276,7 +13276,7 @@ ha_innobase::rename_table(
innobase_commit_low(trx);
- trx_free_for_mysql(trx);
+ trx_free(trx);
if (error == DB_SUCCESS) {
char norm_from[MAX_FULL_NAME_LEN];
@@ -17102,7 +17102,7 @@ innobase_commit_by_xid(
ut_ad(trx->mysql_thd == NULL);
trx_deregister_from_2pc(trx);
ut_ad(!trx->will_lock); /* trx cache requirement */
- trx_free_for_background(trx);
+ trx_free(trx);
return(XA_OK);
} else {
@@ -17132,7 +17132,7 @@ innobase_rollback_by_xid(
int ret = innobase_rollback_trx(trx);
trx_deregister_from_2pc(trx);
ut_ad(!trx->will_lock);
- trx_free_for_background(trx);
+ trx_free(trx);
return(ret);
} else {
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index d2c5ed748fe..1e0c4087b2d 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -2933,7 +2933,7 @@ online_retry_drop_indexes(
online_retry_drop_indexes_low(table, trx);
trx_commit_for_mysql(trx);
row_mysql_unlock_data_dictionary(trx);
- trx_free_for_mysql(trx);
+ trx_free(trx);
}
ut_d(mutex_enter(&dict_sys->mutex));
@@ -5751,7 +5751,7 @@ err_exit:
if (ctx->trx) {
row_mysql_unlock_data_dictionary(ctx->trx);
- trx_free_for_mysql(ctx->trx);
+ trx_free(ctx->trx);
}
trx_commit_for_mysql(ctx->prebuilt->trx);
@@ -7376,7 +7376,7 @@ rollback_inplace_alter_table(
trx_commit_for_mysql(ctx->trx);
row_mysql_unlock_data_dictionary(ctx->trx);
- trx_free_for_mysql(ctx->trx);
+ trx_free(ctx->trx);
func_exit:
#ifndef DBUG_OFF
@@ -9089,8 +9089,7 @@ ha_innobase::commit_inplace_alter_table(
= static_cast<ha_innobase_inplace_ctx*>(*pctx);
if (ctx->trx) {
- trx_free_for_mysql(ctx->trx);
- ctx->trx = NULL;
+ trx_free(ctx->trx);
}
}
@@ -9518,7 +9517,7 @@ foreign_fail:
}
row_mysql_unlock_data_dictionary(trx);
- trx_free_for_mysql(trx);
+ trx_free(trx);
DBUG_RETURN(true);
}
@@ -9561,7 +9560,7 @@ foreign_fail:
}
row_mysql_unlock_data_dictionary(trx);
- trx_free_for_mysql(trx);
+ trx_free(trx);
MONITOR_ATOMIC_DEC(MONITOR_PENDING_ALTER_TABLE);
DBUG_RETURN(false);
}
@@ -9695,7 +9694,7 @@ foreign_fail:
}
row_mysql_unlock_data_dictionary(trx);
- trx_free_for_mysql(trx);
+ trx_free(trx);
/* TODO: The following code could be executed
while allowing concurrent access to the table
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index da1f2ad6547..637f82d04ec 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -2967,7 +2967,7 @@ i_s_fts_deleted_generic_fill(
BREAK_IF(ret = schema_table_store_record(thd, table));
}
- trx_free_for_background(trx);
+ trx_free(trx);
fts_doc_ids_free(deleted);
@@ -3534,7 +3534,7 @@ i_s_fts_index_table_fill_selected(
que_graph_free(graph);
mutex_exit(&dict_sys->mutex);
- trx_free_for_background(trx);
+ trx_free(trx);
if (fetch.total_memory >= fts_result_cache_limit) {
error = DB_FTS_EXCEED_RESULT_CACHE_LIMIT;
@@ -4023,7 +4023,7 @@ i_s_fts_config_fill(
fts_sql_commit(trx);
- trx_free_for_background(trx);
+ trx_free(trx);
dict_table_close(user_table, FALSE, FALSE);
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
index a39b842b0fd..8a4a1151b46 100644
--- a/storage/innobase/include/trx0trx.h
+++ b/storage/innobase/include/trx0trx.h
@@ -86,20 +86,16 @@ trx_get_error_info(
/** @return a trx_t instance from trx_pools. */
trx_t *trx_create();
-/** Free a transaction that was allocated by background or user threads.
-@param trx trx object to free */
-void
-trx_free_for_background(trx_t* trx);
+/**
+ Release a trx_t instance back to the pool.
+ @param trx the instance to release.
+*/
+void trx_free(trx_t*& trx);
/** At shutdown, frees a transaction object. */
void
trx_free_at_shutdown(trx_t *trx);
-/** Free a transaction object for MySQL.
-@param[in,out] trx transaction */
-void
-trx_free_for_mysql(trx_t* trx);
-
/** Disconnect a prepared transaction from MySQL.
@param[in,out] trx transaction */
void
diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc
index 7fe550b5772..e6ee5eb70f4 100644
--- a/storage/innobase/row/row0ftsort.cc
+++ b/storage/innobase/row/row0ftsort.cc
@@ -1821,7 +1821,7 @@ exit:
error = ins_ctx.btr_bulk->finish(error);
UT_DELETE(ins_ctx.btr_bulk);
- trx_free_for_background(trx);
+ trx_free(trx);
mem_heap_free(heap);
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index c6693cfe683..9a839cc4458 100644
--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -2063,7 +2063,7 @@ row_import_cleanup(
row_mysql_unlock_data_dictionary(trx);
- trx_free_for_mysql(trx);
+ trx_free(trx);
prebuilt->trx->op_info = "";
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index b8e1bc60cba..394d54d408e 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -4089,7 +4089,7 @@ row_merge_drop_temp_indexes(void)
trx_commit_for_mysql(trx);
row_mysql_unlock_data_dictionary(trx);
- trx_free_for_background(trx);
+ trx_free(trx);
}
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 804e06cddf9..fa8daf3795e 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -2731,7 +2731,7 @@ row_drop_table_for_mysql_in_background(
trx_commit_for_mysql(trx);
- trx_free_for_background(trx);
+ trx_free(trx);
return(error);
}
@@ -2889,7 +2889,7 @@ row_mysql_drop_garbage_tables()
btr_pcur_close(&pcur);
mtr.commit();
row_mysql_unlock_data_dictionary(trx);
- trx_free_for_background(trx);
+ trx_free(trx);
mem_heap_free(heap);
}
@@ -4726,7 +4726,7 @@ funct_exit:
trx_bg->dict_operation_lock_mode = 0;
trx_commit_for_mysql(trx_bg);
- trx_free_for_background(trx_bg);
+ trx_free(trx_bg);
}
if (table != NULL) {
diff --git a/storage/innobase/row/row0trunc.cc b/storage/innobase/row/row0trunc.cc
index 2d00ed5814e..305aa26a827 100644
--- a/storage/innobase/row/row0trunc.cc
+++ b/storage/innobase/row/row0trunc.cc
@@ -1459,7 +1459,7 @@ row_truncate_update_sys_tables_during_fix_up(
}
trx_commit_for_mysql(trx);
- trx_free_for_background(trx);
+ trx_free(trx);
return(err);
}
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index d8495dfa7a5..ba2b73aa8b6 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -193,7 +193,7 @@ void purge_sys_t::close()
ut_ad(!trx->id);
ut_ad(trx->state == TRX_STATE_ACTIVE);
trx->state = TRX_STATE_NOT_STARTED;
- trx_free_for_background(trx);
+ trx_free(trx);
rw_lock_free(&latch);
/* rw_lock_free() already called latch.~rw_lock_t(); tame the
debug assertions when the destructor will be called once more. */
diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc
index b3d590482e0..6874f929726 100644
--- a/storage/innobase/trx/trx0roll.cc
+++ b/storage/innobase/trx/trx0roll.cc
@@ -833,7 +833,7 @@ discard:
trx_free_at_shutdown(trx);
}
else
- trx_free_for_background(trx);
+ trx_free(trx);
}
}
}
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index 1c93f76bd60..aad5c47d42b 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -431,49 +431,10 @@ trx_t *trx_create()
}
/**
-Release a trx_t instance back to the pool.
-@param trx the instance to release. */
-static
-void
-trx_free(trx_t*& trx)
-{
- mutex_enter(&trx_sys.mutex);
- UT_LIST_REMOVE(trx_sys.trx_list, trx);
- mutex_exit(&trx_sys.mutex);
-
- assert_trx_is_free(trx);
-
- trx_sys.rw_trx_hash.put_pins(trx);
- trx->mysql_thd = 0;
- trx->mysql_log_file_name = 0;
-
- // FIXME: We need to avoid this heap free/alloc for each commit.
- if (trx->autoinc_locks != NULL) {
- ut_ad(ib_vector_is_empty(trx->autoinc_locks));
- /* We allocated a dedicated heap for the vector. */
- ib_vector_free(trx->autoinc_locks);
- trx->autoinc_locks = NULL;
- }
-
- trx->mod_tables.clear();
-
- ut_ad(!trx->read_view.is_open());
- trx->read_view.close();
-
- /* trx locking state should have been reset before returning trx
- to pool */
- ut_ad(trx->will_lock == 0);
-
- trx_pools->mem_free(trx);
-
- trx = NULL;
-}
-
-/** Check state of transaction before freeing it.
-@param trx trx object to validate */
-static
-void
-trx_validate_state_before_free(trx_t* trx)
+ Release a trx_t instance back to the pool.
+ @param trx the instance to release.
+*/
+void trx_free(trx_t*& trx)
{
ut_ad(!trx->declared_to_be_inside_innodb);
ut_ad(!trx->n_mysql_tables_in_use);
@@ -510,16 +471,37 @@ trx_validate_state_before_free(trx_t* trx)
trx->dict_operation = TRX_DICT_OP_NONE;
assert_trx_is_inactive(trx);
-}
-/** Free a transaction that was allocated by background or user threads.
-@param trx trx object to free */
-void
-trx_free_for_background(trx_t* trx)
-{
- trx_validate_state_before_free(trx);
+ mutex_enter(&trx_sys.mutex);
+ UT_LIST_REMOVE(trx_sys.trx_list, trx);
+ mutex_exit(&trx_sys.mutex);
- trx_free(trx);
+ assert_trx_is_free(trx);
+
+ trx_sys.rw_trx_hash.put_pins(trx);
+ trx->mysql_thd = 0;
+ trx->mysql_log_file_name = 0;
+
+ // FIXME: We need to avoid this heap free/alloc for each commit.
+ if (trx->autoinc_locks != NULL) {
+ ut_ad(ib_vector_is_empty(trx->autoinc_locks));
+ /* We allocated a dedicated heap for the vector. */
+ ib_vector_free(trx->autoinc_locks);
+ trx->autoinc_locks = NULL;
+ }
+
+ trx->mod_tables.clear();
+
+ ut_ad(!trx->read_view.is_open());
+ trx->read_view.close();
+
+ /* trx locking state should have been reset before returning trx
+ to pool */
+ ut_ad(trx->will_lock == 0);
+
+ trx_pools->mem_free(trx);
+
+ trx = NULL;
}
/** At shutdown, frees a transaction object. */
@@ -573,16 +555,6 @@ void trx_disconnect_prepared(trx_t *trx)
trx->will_lock= 0;
}
-/**
- Free a transaction object for MySQL
- @param[in,out] trx transaction
-*/
-void trx_free_for_mysql(trx_t *trx)
-{
- ut_ad(trx->mysql_thd);
- trx_free_for_background(trx);
-}
-
/****************************************************************//**
Resurrect the table locks for a resurrected transaction. */
static