Commit cfbbf542 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-7962: Follow-up fix for 10.4

Replace wsrep_on() with trx_t::is_wsrep() where possible.

Also, rename some functions to member functions and
remove unused DBUG_EXECUTE_IF instrumentation:

trx_t::commit(): Renamed from trx_commit().

trx_t::commit_low(): Renamed from trx_commit_low().

trx_t::commit_in_memory(): Renamed from trx_commit_in_memory().
parent 0632b803
...@@ -7079,7 +7079,7 @@ prepare_inplace_alter_table_dict( ...@@ -7079,7 +7079,7 @@ prepare_inplace_alter_table_dict(
goto error_handling; goto error_handling;
} }
trx_commit(ctx->trx); ctx->trx->commit();
trx_start_for_ddl(ctx->trx, op); trx_start_for_ddl(ctx->trx, op);
if (!ctx->new_table->fts if (!ctx->new_table->fts
...@@ -11101,7 +11101,7 @@ ha_innobase::commit_inplace_alter_table( ...@@ -11101,7 +11101,7 @@ ha_innobase::commit_inplace_alter_table(
logical sense the commit in the file-based logical sense the commit in the file-based
data structures happens here. */ data structures happens here. */
trx_commit_low(trx, &mtr); trx->commit_low(&mtr);
} }
/* If server crashes here, the dictionary in /* If server crashes here, the dictionary in
......
...@@ -181,17 +181,6 @@ trx_start_for_ddl_low( ...@@ -181,17 +181,6 @@ trx_start_for_ddl_low(
trx_start_for_ddl_low((t), (o)) trx_start_for_ddl_low((t), (o))
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
/****************************************************************//**
Commits a transaction. */
void
trx_commit(
/*=======*/
trx_t* trx); /*!< in/out: transaction */
/** Commit a transaction and a mini-transaction.
@param[in,out] trx transaction
@param[in,out] mtr mini-transaction (NULL if no modifications) */
void trx_commit_low(trx_t* trx, mtr_t* mtr);
/**********************************************************************//** /**********************************************************************//**
Does the transaction commit for MySQL. Does the transaction commit for MySQL.
@return DB_SUCCESS or error number */ @return DB_SUCCESS or error number */
...@@ -898,10 +887,10 @@ struct trx_t { ...@@ -898,10 +887,10 @@ struct trx_t {
defer flush of the logs to disk defer flush of the logs to disk
until after we release the until after we release the
mutex. */ mutex. */
bool must_flush_log_later;/*!< this flag is set to TRUE in bool must_flush_log_later;/*!< set in commit()
trx_commit() if flush_log_later was if flush_log_later was
TRUE, and there were modifications by set and redo log was written;
the transaction; in that case we must in that case we will
flush the log in flush the log in
trx_commit_complete_for_mysql() */ trx_commit_complete_for_mysql() */
ulint duplicates; /*!< TRX_DUP_IGNORE | TRX_DUP_REPLACE */ ulint duplicates; /*!< TRX_DUP_IGNORE | TRX_DUP_REPLACE */
...@@ -1132,11 +1121,20 @@ struct trx_t { ...@@ -1132,11 +1121,20 @@ struct trx_t {
@param[in] table_id table identifier */ @param[in] table_id table identifier */
void evict_table(table_id_t table_id); void evict_table(table_id_t table_id);
private:
/** Mark a transaction committed in the main memory data structures. */
inline void commit_in_memory(const mtr_t *mtr);
public:
/** Commit the transaction. */
void commit();
bool is_referenced() /** Commit the transaction in a mini-transaction.
{ @param mtr mini-transaction (if there are any persistent modifications) */
return n_ref > 0; void commit_low(mtr_t *mtr= nullptr);
}
bool is_referenced() const { return n_ref > 0; }
void reference() void reference()
......
...@@ -6865,7 +6865,7 @@ DeadlockChecker::trx_rollback() ...@@ -6865,7 +6865,7 @@ DeadlockChecker::trx_rollback()
print("*** WE ROLL BACK TRANSACTION (1)\n"); print("*** WE ROLL BACK TRANSACTION (1)\n");
#ifdef WITH_WSREP #ifdef WITH_WSREP
if (wsrep_on(trx->mysql_thd) && wsrep_thd_is_SR(trx->mysql_thd)) { if (trx->is_wsrep() && wsrep_thd_is_SR(trx->mysql_thd)) {
wsrep_handle_SR_rollback(m_start->mysql_thd, trx->mysql_thd); wsrep_handle_SR_rollback(m_start->mysql_thd, trx->mysql_thd);
} }
#endif #endif
...@@ -6956,8 +6956,7 @@ DeadlockChecker::check_and_resolve(const lock_t* lock, trx_t* trx) ...@@ -6956,8 +6956,7 @@ DeadlockChecker::check_and_resolve(const lock_t* lock, trx_t* trx)
print("*** WE ROLL BACK TRANSACTION (2)\n"); print("*** WE ROLL BACK TRANSACTION (2)\n");
#ifdef WITH_WSREP #ifdef WITH_WSREP
if (wsrep_on(trx->mysql_thd) if (trx->is_wsrep() && wsrep_thd_is_SR(trx->mysql_thd)) {
&& wsrep_thd_is_SR(trx->mysql_thd)) {
wsrep_handle_SR_rollback(trx->mysql_thd, wsrep_handle_SR_rollback(trx->mysql_thd,
victim_trx->mysql_thd); victim_trx->mysql_thd);
} }
......
...@@ -59,7 +59,7 @@ static bool trx_rollback_finish(trx_t* trx) ...@@ -59,7 +59,7 @@ static bool trx_rollback_finish(trx_t* trx)
trx->mod_tables.clear(); trx->mod_tables.clear();
bool finished = trx->error_state == DB_SUCCESS; bool finished = trx->error_state == DB_SUCCESS;
if (UNIV_LIKELY(finished)) { if (UNIV_LIKELY(finished)) {
trx_commit(trx); trx->commit();
} else { } else {
ut_a(trx->error_state == DB_INTERRUPTED); ut_a(trx->error_state == DB_INTERRUPTED);
ut_ad(!srv_is_being_started); ut_ad(!srv_is_being_started);
...@@ -84,7 +84,7 @@ static bool trx_rollback_finish(trx_t* trx) ...@@ -84,7 +84,7 @@ static bool trx_rollback_finish(trx_t* trx)
ut_free(undo); ut_free(undo);
undo = NULL; undo = NULL;
} }
trx_commit_low(trx, NULL); trx->commit_low();
} }
trx->lock.que_state = TRX_QUE_RUNNING; trx->lock.que_state = TRX_QUE_RUNNING;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment