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(
goto error_handling;
}
trx_commit(ctx->trx);
ctx->trx->commit();
trx_start_for_ddl(ctx->trx, op);
if (!ctx->new_table->fts
......@@ -11101,7 +11101,7 @@ ha_innobase::commit_inplace_alter_table(
logical sense the commit in the file-based
data structures happens here. */
trx_commit_low(trx, &mtr);
trx->commit_low(&mtr);
}
/* If server crashes here, the dictionary in
......
......@@ -181,17 +181,6 @@ trx_start_for_ddl_low(
trx_start_for_ddl_low((t), (o))
#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.
@return DB_SUCCESS or error number */
......@@ -898,10 +887,10 @@ struct trx_t {
defer flush of the logs to disk
until after we release the
mutex. */
bool must_flush_log_later;/*!< this flag is set to TRUE in
trx_commit() if flush_log_later was
TRUE, and there were modifications by
the transaction; in that case we must
bool must_flush_log_later;/*!< set in commit()
if flush_log_later was
set and redo log was written;
in that case we will
flush the log in
trx_commit_complete_for_mysql() */
ulint duplicates; /*!< TRX_DUP_IGNORE | TRX_DUP_REPLACE */
......@@ -1132,11 +1121,20 @@ struct trx_t {
@param[in] table_id table identifier */
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()
{
return n_ref > 0;
}
/** Commit the transaction in a mini-transaction.
@param mtr mini-transaction (if there are any persistent modifications) */
void commit_low(mtr_t *mtr= nullptr);
bool is_referenced() const { return n_ref > 0; }
void reference()
......
......@@ -6865,7 +6865,7 @@ DeadlockChecker::trx_rollback()
print("*** WE ROLL BACK TRANSACTION (1)\n");
#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);
}
#endif
......@@ -6956,8 +6956,7 @@ DeadlockChecker::check_and_resolve(const lock_t* lock, trx_t* trx)
print("*** WE ROLL BACK TRANSACTION (2)\n");
#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(trx->mysql_thd,
victim_trx->mysql_thd);
}
......
......@@ -59,7 +59,7 @@ static bool trx_rollback_finish(trx_t* trx)
trx->mod_tables.clear();
bool finished = trx->error_state == DB_SUCCESS;
if (UNIV_LIKELY(finished)) {
trx_commit(trx);
trx->commit();
} else {
ut_a(trx->error_state == DB_INTERRUPTED);
ut_ad(!srv_is_being_started);
......@@ -84,7 +84,7 @@ static bool trx_rollback_finish(trx_t* trx)
ut_free(undo);
undo = NULL;
}
trx_commit_low(trx, NULL);
trx->commit_low();
}
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