mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
MDEV-15773 - Simplified away trx_t::in_mysql_trx_list
This commit is contained in:
parent
d6d58836bb
commit
061c767cce
7 changed files with 20 additions and 39 deletions
|
@ -1504,7 +1504,7 @@ dict_create_or_check_foreign_constraint_tables(void)
|
|||
return(DB_READ_ONLY);
|
||||
}
|
||||
|
||||
trx = trx_allocate_for_mysql();
|
||||
trx = trx_create();
|
||||
|
||||
trx_set_dict_operation(trx, TRX_DICT_OP_TABLE);
|
||||
|
||||
|
@ -1588,7 +1588,7 @@ dict_create_or_check_foreign_constraint_tables(void)
|
|||
|
||||
row_mysql_unlock_data_dictionary(trx);
|
||||
|
||||
trx_free_for_mysql(trx);
|
||||
trx_free_for_background(trx);
|
||||
|
||||
srv_file_per_table = srv_file_per_table_backup;
|
||||
|
||||
|
@ -1634,7 +1634,7 @@ dict_create_or_check_sys_virtual()
|
|||
return(DB_READ_ONLY);
|
||||
}
|
||||
|
||||
trx = trx_allocate_for_mysql();
|
||||
trx = trx_create();
|
||||
|
||||
trx_set_dict_operation(trx, TRX_DICT_OP_TABLE);
|
||||
|
||||
|
@ -1692,7 +1692,7 @@ dict_create_or_check_sys_virtual()
|
|||
|
||||
row_mysql_unlock_data_dictionary(trx);
|
||||
|
||||
trx_free_for_mysql(trx);
|
||||
trx_free_for_background(trx);
|
||||
|
||||
srv_file_per_table = srv_file_per_table_backup;
|
||||
|
||||
|
@ -2289,7 +2289,7 @@ dict_create_or_check_sys_tablespace(void)
|
|||
return(DB_READ_ONLY);
|
||||
}
|
||||
|
||||
trx = trx_allocate_for_mysql();
|
||||
trx = trx_create();
|
||||
|
||||
trx_set_dict_operation(trx, TRX_DICT_OP_TABLE);
|
||||
|
||||
|
@ -2356,7 +2356,7 @@ dict_create_or_check_sys_tablespace(void)
|
|||
|
||||
row_mysql_unlock_data_dictionary(trx);
|
||||
|
||||
trx_free_for_mysql(trx);
|
||||
trx_free_for_background(trx);
|
||||
|
||||
srv_file_per_table = srv_file_per_table_backup;
|
||||
|
||||
|
|
|
@ -2320,7 +2320,7 @@ dict_stats_save_index_stat(
|
|||
char db_utf8[MAX_DB_UTF8_LEN];
|
||||
char table_utf8[MAX_TABLE_UTF8_LEN];
|
||||
|
||||
ut_ad(!trx || trx->internal || trx->in_mysql_trx_list);
|
||||
ut_ad(!trx || trx->internal || trx->mysql_thd);
|
||||
ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
|
||||
ut_ad(mutex_own(&dict_sys->mutex));
|
||||
|
||||
|
|
|
@ -521,7 +521,7 @@ The tranasction must be in the mysql_trx_list. */
|
|||
trx_state_t t_state = (t)->state; \
|
||||
ut_ad((t)->read_only); \
|
||||
ut_ad(!(t)->is_recovered); \
|
||||
ut_ad((t)->in_mysql_trx_list); \
|
||||
ut_ad((t)->mysql_thd); \
|
||||
ut_ad(t_state == TRX_STATE_NOT_STARTED \
|
||||
|| t_state == TRX_STATE_ACTIVE); \
|
||||
} else { \
|
||||
|
@ -854,7 +854,7 @@ public:
|
|||
do we remove it from the read-only list and put it on the read-write
|
||||
list. During this switch we assign it a rollback segment.
|
||||
|
||||
When a transaction is NOT_STARTED, it can be in_mysql_trx_list if
|
||||
When a transaction is NOT_STARTED, it can be in mysql_trx_list if
|
||||
it is a user transaction. It cannot be in rw_trx_hash.
|
||||
|
||||
ACTIVE->PREPARED->COMMITTED is only possible when trx is in rw_trx_hash.
|
||||
|
@ -976,11 +976,6 @@ public:
|
|||
UT_LIST_NODE_T(trx_t)
|
||||
mysql_trx_list; /*!< list of transactions created for
|
||||
MySQL; protected by trx_sys.mutex */
|
||||
#ifdef UNIV_DEBUG
|
||||
bool in_mysql_trx_list;
|
||||
/*!< true if in
|
||||
trx_sys.mysql_trx_list */
|
||||
#endif /* UNIV_DEBUG */
|
||||
/*------------------------------*/
|
||||
dberr_t error_state; /*!< 0 if no error, otherwise error
|
||||
number; NOTE That ONLY the thread
|
||||
|
|
|
@ -4674,7 +4674,7 @@ struct PrintNotStarted {
|
|||
|
||||
void operator()(const trx_t* trx)
|
||||
{
|
||||
ut_ad(trx->in_mysql_trx_list);
|
||||
ut_ad(trx->mysql_thd);
|
||||
ut_ad(mutex_own(&trx_sys.mutex));
|
||||
|
||||
/* See state transitions and locking rules in trx0trx.h */
|
||||
|
|
|
@ -279,7 +279,7 @@ trx_purge_add_undo_to_history(const trx_t* trx, trx_undo_t*& undo, mtr_t* mtr)
|
|||
&& purge_sys.state == PURGE_STATE_INIT)
|
||||
|| (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND
|
||||
&& purge_sys.state == PURGE_STATE_DISABLED)
|
||||
|| ((trx->undo_no == 0 || trx->in_mysql_trx_list
|
||||
|| ((trx->undo_no == 0 || trx->mysql_thd
|
||||
|| trx->internal)
|
||||
&& srv_fast_shutdown));
|
||||
|
||||
|
|
|
@ -201,11 +201,11 @@ dberr_t trx_rollback_for_mysql(trx_t* trx)
|
|||
switch (trx->state) {
|
||||
case TRX_STATE_NOT_STARTED:
|
||||
trx->will_lock = 0;
|
||||
ut_ad(trx->in_mysql_trx_list);
|
||||
ut_ad(trx->mysql_thd);
|
||||
return(DB_SUCCESS);
|
||||
|
||||
case TRX_STATE_ACTIVE:
|
||||
ut_ad(trx->in_mysql_trx_list);
|
||||
ut_ad(trx->mysql_thd);
|
||||
assert_trx_nonlocking_or_in_list(trx);
|
||||
return(trx_rollback_for_mysql_low(trx));
|
||||
|
||||
|
@ -282,7 +282,7 @@ trx_rollback_last_sql_stat_for_mysql(
|
|||
here, because the statement rollback should be invoked for a
|
||||
running active MySQL transaction that is associated with the
|
||||
current thread. */
|
||||
ut_ad(trx->in_mysql_trx_list);
|
||||
ut_ad(trx->mysql_thd);
|
||||
|
||||
switch (trx->state) {
|
||||
case TRX_STATE_NOT_STARTED:
|
||||
|
@ -404,7 +404,7 @@ trx_rollback_to_savepoint_for_mysql_low(
|
|||
dberr_t err;
|
||||
|
||||
ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE));
|
||||
ut_ad(trx->in_mysql_trx_list);
|
||||
ut_ad(trx->mysql_thd);
|
||||
|
||||
/* Free all savepoints strictly later than savep. */
|
||||
|
||||
|
@ -461,7 +461,7 @@ trx_rollback_to_savepoint_for_mysql(
|
|||
here, because the savepoint rollback should be invoked for a
|
||||
running active MySQL transaction that is associated with the
|
||||
current thread. */
|
||||
ut_ad(trx->in_mysql_trx_list);
|
||||
ut_ad(trx->mysql_thd);
|
||||
|
||||
savep = trx_savepoint_find(trx, savepoint_name);
|
||||
|
||||
|
@ -554,7 +554,7 @@ trx_release_savepoint_for_mysql(
|
|||
|
||||
ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE, true)
|
||||
|| trx_state_eq(trx, TRX_STATE_PREPARED, true));
|
||||
ut_ad(trx->in_mysql_trx_list);
|
||||
ut_ad(trx->mysql_thd);
|
||||
|
||||
savep = trx_savepoint_find(trx, savepoint_name);
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ struct TrxFactory {
|
|||
static void destroy(trx_t* trx)
|
||||
{
|
||||
ut_a(trx->magic_n == TRX_MAGIC_N);
|
||||
ut_ad(!trx->in_mysql_trx_list);
|
||||
ut_ad(!trx->mysql_thd);
|
||||
|
||||
ut_a(trx->lock.wait_lock == NULL);
|
||||
ut_a(trx->lock.wait_thr == NULL);
|
||||
|
@ -303,8 +303,6 @@ struct TrxFactory {
|
|||
|
||||
ut_ad(trx->mysql_thd == 0);
|
||||
|
||||
ut_ad(!trx->in_mysql_trx_list);
|
||||
|
||||
ut_a(trx->lock.wait_thr == NULL);
|
||||
ut_a(trx->lock.wait_lock == NULL);
|
||||
ut_a(trx->dict_operation_lock_mode == 0);
|
||||
|
@ -475,10 +473,7 @@ trx_allocate_for_mysql(void)
|
|||
trx = trx_create();
|
||||
|
||||
mutex_enter(&trx_sys.mutex);
|
||||
|
||||
ut_d(trx->in_mysql_trx_list = TRUE);
|
||||
UT_LIST_ADD_FIRST(trx_sys.mysql_trx_list, trx);
|
||||
|
||||
mutex_exit(&trx_sys.mutex);
|
||||
|
||||
return(trx);
|
||||
|
@ -586,13 +581,10 @@ trx_disconnect_from_mysql(
|
|||
trx_t* trx,
|
||||
bool prepared)
|
||||
{
|
||||
ut_ad(trx->mysql_thd);
|
||||
trx->read_view.close();
|
||||
|
||||
mutex_enter(&trx_sys.mutex);
|
||||
|
||||
ut_ad(trx->in_mysql_trx_list);
|
||||
ut_d(trx->in_mysql_trx_list = FALSE);
|
||||
|
||||
UT_LIST_REMOVE(trx_sys.mysql_trx_list, trx);
|
||||
|
||||
if (prepared) {
|
||||
|
@ -604,7 +596,6 @@ trx_disconnect_from_mysql(
|
|||
/* todo/fixme: suggest to do it at innodb prepare */
|
||||
trx->will_lock = 0;
|
||||
}
|
||||
|
||||
mutex_exit(&trx_sys.mutex);
|
||||
}
|
||||
|
||||
|
@ -1061,11 +1052,6 @@ trx_start_low(
|
|||
ut_a(ib_vector_is_empty(trx->autoinc_locks));
|
||||
ut_a(trx->lock.table_locks.empty());
|
||||
|
||||
/* If this transaction came from trx_allocate_for_mysql(),
|
||||
trx->in_mysql_trx_list would hold. In that case, the trx->state
|
||||
change must be protected by the trx_sys.mutex, so that
|
||||
lock_print_info_all_transactions() will have a consistent view. */
|
||||
|
||||
/* No other thread can access this trx object through rw_trx_hash, thus
|
||||
we don't need trx_sys.mutex protection for that purpose. Still this
|
||||
trx can be found through trx_sys.mysql_trx_list, which means state
|
||||
|
@ -1541,7 +1527,7 @@ trx_commit_in_memory(
|
|||
DBUG_LOG("trx", "Commit in memory: " << trx);
|
||||
trx->state = TRX_STATE_NOT_STARTED;
|
||||
|
||||
/* trx->in_mysql_trx_list would hold between
|
||||
/* trx->mysql_thd != 0 would hold between
|
||||
trx_allocate_for_mysql() and trx_free_for_mysql(). It does not
|
||||
hold for recovered transactions or system transactions. */
|
||||
assert_trx_is_free(trx);
|
||||
|
|
Loading…
Reference in a new issue