Skip to content
Permalink
Browse files
MDEV-15773 - trx_allocate_for_background() -> trx_create()
trx_free_resurrected(): Remove, unused function
  • Loading branch information
Sergey Vojtovich committed Apr 4, 2018
1 parent a5da1c6 commit d6d5883
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 75 deletions.
@@ -422,7 +422,7 @@ dict_table_try_drop_aborted(
{
trx_t* trx;

trx = trx_allocate_for_background();
trx = trx_create();
trx->op_info = "try to drop any indexes after an aborted index creation";
row_mysql_lock_data_dictionary(trx);
trx_set_dict_operation(trx, TRX_DICT_OP_INDEX);
@@ -2034,7 +2034,7 @@ dict_table_remove_from_cache_low(
/* When evicting the table definition,
drop the orphan indexes from the data dictionary
and free the index pages. */
trx_t* trx = trx_allocate_for_background();
trx_t* trx = trx_create();

ut_ad(mutex_own(&dict_sys->mutex));
ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
@@ -894,7 +894,7 @@ dict_update_filepath(
ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
ut_ad(mutex_own(&dict_sys->mutex));

trx = trx_allocate_for_background();
trx = trx_create();
trx->op_info = "update filepath";
trx->dict_operation_lock_mode = RW_X_LATCH;
trx_start_for_ddl(trx, TRX_DICT_OP_INDEX);
@@ -963,7 +963,7 @@ dict_replace_tablespace_and_filepath(
ut_ad(mutex_own(&dict_sys->mutex));
ut_ad(filepath);

trx = trx_allocate_for_background();
trx = trx_create();
trx->op_info = "insert tablespace and filepath";
trx->dict_operation_lock_mode = RW_X_LATCH;
trx_start_for_ddl(trx, TRX_DICT_OP_INDEX);
@@ -299,7 +299,7 @@ dict_stats_exec_sql(
}

if (trx == NULL) {
trx = trx_allocate_for_background();
trx = trx_create();
trx_started = true;

if (srv_read_only_mode) {
@@ -2505,7 +2505,7 @@ dict_stats_save(
return(ret);
}

trx_t* trx = trx_allocate_for_background();
trx_t* trx = trx_create();
trx_start_internal(trx);

dict_index_t* index;
@@ -2984,7 +2984,7 @@ dict_stats_fetch_from_ps(
stats. */
dict_stats_empty_table(table, true);

trx = trx_allocate_for_background();
trx = trx_create();

/* Use 'read-uncommitted' so that the SELECTs we execute
do not get blocked in case some user has locked the rows we
@@ -472,7 +472,7 @@ fts_load_user_stopword(
trx_t* trx;
ibool has_lock = fts->fts_status & TABLE_DICT_LOCKED;

trx = trx_allocate_for_background();
trx = trx_create();
trx->op_info = "Load user stopword table into FTS cache";

if (!has_lock) {
@@ -2672,7 +2672,7 @@ fts_cmp_set_sync_doc_id(

fts_table.parent = table->name.m_name;

trx = trx_allocate_for_background();
trx = trx_create();
if (srv_read_only_mode) {
trx_start_internal_read_only(trx);
} else {
@@ -2801,7 +2801,7 @@ fts_update_sync_doc_id(
}

if (!trx) {
trx = trx_allocate_for_background();
trx = trx_create();
trx_start_internal(trx);

trx->op_info = "setting last FTS document id";
@@ -3042,7 +3042,7 @@ fts_commit_table(
ib_rbt_t* rows;
dberr_t error = DB_SUCCESS;
fts_cache_t* cache = ftt->table->fts->cache;
trx_t* trx = trx_allocate_for_background();
trx_t* trx = trx_create();

trx_start_internal(trx);

@@ -3784,7 +3784,7 @@ fts_doc_fetch_by_doc_id(
const char* select_str;
doc_id_t write_doc_id;
dict_index_t* index;
trx_t* trx = trx_allocate_for_background();
trx_t* trx = trx_create();
que_t* graph;

trx->op_info = "fetching indexed FTS document";
@@ -4126,7 +4126,7 @@ fts_sync_begin(

sync->start_time = ut_time();

sync->trx = trx_allocate_for_background();
sync->trx = trx_create();
trx_start_internal(sync->trx);

if (fts_enable_diag_print) {
@@ -5001,7 +5001,7 @@ fts_get_rows_count(
ulint count = 0;
char table_name[MAX_FULL_NAME_LEN];

trx = trx_allocate_for_background();
trx = trx_create();
trx->op_info = "fetching FT table rows count";

info = pars_info_create();
@@ -5072,7 +5072,7 @@ fts_update_max_cache_size(
trx_t* trx;
fts_table_t fts_table;

trx = trx_allocate_for_background();
trx = trx_create();

FTS_INIT_FTS_TABLE(&fts_table, "CONFIG", FTS_COMMON_TABLE, sync->table);

@@ -6376,7 +6376,7 @@ fts_rename_aux_tables_to_hex_format_low(
continue;
}

trx_bg = trx_allocate_for_background();
trx_bg = trx_create();
trx_bg->op_info = "Revert half done rename";
trx_bg->dict_operation_lock_mode = RW_X_LATCH;
trx_start_for_ddl(trx_bg, TRX_DICT_OP_TABLE);
@@ -6618,7 +6618,7 @@ fts_rename_aux_tables_to_hex_format(
dict_table_t* parent_table)
{
dberr_t err;
trx_t* trx_rename = trx_allocate_for_background();
trx_t* trx_rename = trx_create();
trx_rename->op_info = "Rename aux tables to hex format";
trx_rename->dict_operation_lock_mode = RW_X_LATCH;
trx_start_for_ddl(trx_rename, TRX_DICT_OP_TABLE);
@@ -6637,7 +6637,7 @@ fts_rename_aux_tables_to_hex_format(

/* Corrupting the fts index related to parent table. */
trx_t* trx_corrupt;
trx_corrupt = trx_allocate_for_background();
trx_corrupt = trx_create();
trx_corrupt->dict_operation_lock_mode = RW_X_LATCH;
trx_start_for_ddl(trx_corrupt, TRX_DICT_OP_TABLE);
fts_parent_all_index_set_corrupt(trx_corrupt, parent_table);
@@ -6697,7 +6697,7 @@ fts_drop_obsolete_aux_table_from_vector(
fts_aux_table_t* aux_drop_table;
aux_drop_table = static_cast<fts_aux_table_t*>(
ib_vector_get(tables, count));
trx_t* trx_drop = trx_allocate_for_background();
trx_t* trx_drop = trx_create();
trx_drop->op_info = "Drop obsolete aux tables";
trx_drop->dict_operation_lock_mode = RW_X_LATCH;
trx_start_for_ddl(trx_drop, TRX_DICT_OP_TABLE);
@@ -7166,7 +7166,7 @@ fts_drop_orphaned_tables(void)

mutex_exit(&fil_system.mutex);

trx = trx_allocate_for_background();
trx = trx_create();
trx->op_info = "dropping orphaned FTS tables";
row_mysql_lock_data_dictionary(trx);

@@ -7322,7 +7322,7 @@ fts_load_stopword(
}

if (!trx) {
trx = trx_allocate_for_background();
trx = trx_create();
if (srv_read_only_mode) {
trx_start_internal_read_only(trx);
} else {
@@ -988,7 +988,7 @@ fts_table_fetch_doc_ids(
ut_a(fts_table->type == FTS_COMMON_TABLE);

if (!trx) {
trx = trx_allocate_for_background();
trx = trx_create();
alloc_bk_trx = TRUE;
}

@@ -1615,7 +1615,7 @@ fts_optimize_create(

optim->table = table;

optim->trx = trx_allocate_for_background();
optim->trx = trx_create();
trx_start_internal(optim->trx);

optim->fts_common_table.parent = table->name.m_name;
@@ -3951,7 +3951,7 @@ fts_query(

*result = NULL;
memset(&query, 0x0, sizeof(query));
query_trx = trx_allocate_for_background();
query_trx = trx_create();
query_trx->op_info = "FTS query";

start_time_ms = ut_time_ms();
@@ -2944,7 +2944,7 @@ i_s_fts_deleted_generic_fill(

deleted = fts_doc_ids_create();

trx = trx_allocate_for_background();
trx = trx_create();
trx->op_info = "Select for FTS DELETE TABLE";

FTS_INIT_FTS_TABLE(&fts_table,
@@ -3477,7 +3477,7 @@ i_s_fts_index_table_fill_selected(
fts_result_cache_limit = 8192;
);

trx = trx_allocate_for_background();
trx = trx_create();

trx->op_info = "fetching FTS index nodes";

@@ -3972,7 +3972,7 @@ i_s_fts_config_fill(
DBUG_RETURN(0);
}

trx = trx_allocate_for_background();
trx = trx_create();
trx->op_info = "Select for FTS CONFIG TABLE";

FTS_INIT_FTS_TABLE(&fts_table, "CONFIG", FTS_COMMON_TABLE, user_table);
@@ -88,17 +88,9 @@ Creates a transaction object for MySQL.
trx_t*
trx_allocate_for_mysql(void);
/*========================*/
/********************************************************************//**
Creates a transaction object for background operations by the master thread.
@return own: transaction object */
trx_t*
trx_allocate_for_background(void);
/*=============================*/

/** Frees and initialize a transaction object instantinated during recovery.
@param trx trx object to free and initialize during recovery */
void
trx_free_resurrected(trx_t* trx);
/** @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 */
@@ -1595,7 +1595,7 @@ row_fts_merge_insert(
/* We use the insert query graph as the dummy graph
needed in the row module call */

trx = trx_allocate_for_background();
trx = trx_create();
trx_start_if_not_started(trx, true);

trx->op_info = "inserting index entries";
@@ -4066,7 +4066,7 @@ row_merge_drop_temp_indexes(void)
/* Load the table definitions that contain partially defined
indexes, so that the data dictionary information can be checked
when accessing the tablename.ibd files. */
trx = trx_allocate_for_background();
trx = trx_create();
trx->op_info = "dropping partially created indexes";
row_mysql_lock_data_dictionary(trx);
/* Ensure that this transaction will be rolled back and locks
@@ -2717,7 +2717,7 @@ row_drop_table_for_mysql_in_background(
dberr_t error;
trx_t* trx;

trx = trx_allocate_for_background();
trx = trx_create();

/* If the original transaction was dropping a table referenced by
foreign keys, we must set the following to be able to drop the
@@ -2832,7 +2832,7 @@ row_mysql_drop_garbage_tables()
mem_heap_t* heap = mem_heap_create(FN_REFLEN);
btr_pcur_t pcur;
mtr_t mtr;
trx_t* trx = trx_allocate_for_background();
trx_t* trx = trx_create();
trx->op_info = "dropping garbage tables";
row_mysql_lock_data_dictionary(trx);

@@ -4702,7 +4702,7 @@ row_rename_table_for_mysql(
&& table != NULL && (table->space != 0)) {

char* orig_name = table->name.m_name;
trx_t* trx_bg = trx_allocate_for_background();
trx_t* trx_bg = trx_create();

/* If the first fts_rename fails, the trx would
be rolled back and committed, we can't use it any more,
@@ -1402,7 +1402,7 @@ row_truncate_update_sys_tables_during_fix_up(
ibool reserve_dict_mutex,
bool mark_index_corrupted)
{
trx_t* trx = trx_allocate_for_background();
trx_t* trx = trx_create();

trx_set_dict_operation(trx, TRX_DICT_OP_TABLE);

@@ -138,7 +138,7 @@ purge_graph_build()
{
ut_a(srv_n_purge_threads > 0);

trx_t* trx = trx_allocate_for_background();
trx_t* trx = trx_create();
ut_ad(!trx->id);
trx->start_time = ut_time();
trx->state = TRX_STATE_ACTIVE;
@@ -394,9 +394,7 @@ trx_pool_close()
}

/** @return a trx_t instance from trx_pools. */
static
trx_t*
trx_create_low()
trx_t *trx_create()
{
trx_t* trx = trx_pools->get();

@@ -465,20 +463,6 @@ trx_free(trx_t*& trx)
trx = NULL;
}

/********************************************************************//**
Creates a transaction object for background operations by the master thread.
@return own: transaction object */
trx_t*
trx_allocate_for_background(void)
/*=============================*/
{
trx_t* trx;

trx = trx_create_low();

return(trx);
}

/********************************************************************//**
Creates a transaction object for MySQL.
@return own: transaction object */
@@ -488,7 +472,7 @@ trx_allocate_for_mysql(void)
{
trx_t* trx;

trx = trx_allocate_for_background();
trx = trx_create();

mutex_enter(&trx_sys.mutex);

@@ -543,18 +527,6 @@ trx_validate_state_before_free(trx_t* trx)
assert_trx_is_inactive(trx);
}

/** Free and initialize a transaction object instantinated during recovery.
@param trx trx object to free and initialize during recovery */
void
trx_free_resurrected(trx_t* trx)
{
trx_validate_state_before_free(trx);

trx_init(trx);

trx_free(trx);
}

/** Free a transaction that was allocated by background or user threads.
@param trx trx object to free */
void
@@ -785,7 +757,7 @@ static void trx_resurrect(trx_undo_t *undo, trx_rseg_t *rseg,
return;
}

trx_t *trx= trx_allocate_for_background();
trx_t *trx= trx_create();
trx->state= state;
ut_d(trx->start_file= __FILE__);
ut_d(trx->start_line= __LINE__);

0 comments on commit d6d5883

Please sign in to comment.