Rename InnoDB transaction undo logging predicates.
trx::has_logged_persistent(): Renamed from trx_is_redo_rseg_updated(). Determines if a transaction has generated any persistent undo log. trx::has_logged(): Renamed from trx_is_rseg_updated(). Determines if a transaction has generated any undo log.
This commit is contained in:
parent
d1374c5b77
commit
a0c79bcf00
@ -5017,8 +5017,6 @@ innobase_rollback_trx(
|
||||
/*==================*/
|
||||
trx_t* trx) /*!< in: transaction */
|
||||
{
|
||||
dberr_t error = DB_SUCCESS;
|
||||
|
||||
DBUG_ENTER("innobase_rollback_trx");
|
||||
DBUG_PRINT("trans", ("aborting transaction"));
|
||||
|
||||
@ -5037,13 +5035,13 @@ innobase_rollback_trx(
|
||||
lock_unlock_table_autoinc(trx);
|
||||
}
|
||||
|
||||
if (trx_is_rseg_updated(trx)) {
|
||||
error = trx_rollback_for_mysql(trx);
|
||||
} else {
|
||||
if (!trx->has_logged()) {
|
||||
trx->will_lock = 0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
DBUG_RETURN(convert_error_code_to_mysql(error, 0, trx->mysql_thd));
|
||||
DBUG_RETURN(convert_error_code_to_mysql(trx_rollback_for_mysql(trx),
|
||||
0, trx->mysql_thd));
|
||||
}
|
||||
|
||||
|
||||
@ -5397,7 +5395,7 @@ innobase_close_connection(
|
||||
in the 1st and 3rd case. */
|
||||
if (trx_is_started(trx)) {
|
||||
if (trx_state_eq(trx, TRX_STATE_PREPARED)) {
|
||||
if (trx_is_redo_rseg_updated(trx)) {
|
||||
if (trx->has_logged_persistent()) {
|
||||
trx_disconnect_prepared(trx);
|
||||
} else {
|
||||
trx_rollback_for_mysql(trx);
|
||||
|
@ -8610,7 +8610,7 @@ ha_innobase::commit_inplace_alter_table(
|
||||
trx_rollback_for_mysql(trx);
|
||||
} else {
|
||||
ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE));
|
||||
ut_ad(trx_is_rseg_updated(trx));
|
||||
ut_ad(trx->has_logged());
|
||||
|
||||
if (mtr.get_log()->size() > 0) {
|
||||
ut_ad(*mtr.get_log()->front()->begin()
|
||||
|
@ -579,13 +579,6 @@ Kill all transactions that are blocking this transaction from acquiring locks.
|
||||
void
|
||||
trx_kill_blocking(trx_t* trx);
|
||||
|
||||
/**
|
||||
Check if redo/noredo rseg is modified for insert/update.
|
||||
@param[in] trx Transaction to check */
|
||||
UNIV_INLINE
|
||||
bool
|
||||
trx_is_rseg_updated(const trx_t* trx);
|
||||
|
||||
/**
|
||||
Transactions that aren't started by the MySQL server don't set
|
||||
the trx_t::mysql_thd field. For such transactions we set the lock
|
||||
@ -645,7 +638,7 @@ Check transaction state */
|
||||
#define assert_trx_is_free(t) do { \
|
||||
ut_ad(trx_state_eq((t), TRX_STATE_NOT_STARTED) \
|
||||
|| trx_state_eq((t), TRX_STATE_FORCED_ROLLBACK)); \
|
||||
ut_ad(!trx_is_rseg_updated(trx)); \
|
||||
ut_ad(!trx->has_logged()); \
|
||||
ut_ad(!MVCC::is_view_active((t)->read_view)); \
|
||||
ut_ad((t)->lock.wait_thr == NULL); \
|
||||
ut_ad(UT_LIST_GET_LEN((t)->lock.trx_locks) == 0); \
|
||||
@ -1290,6 +1283,18 @@ struct trx_t {
|
||||
#endif /* WITH_WSREP */
|
||||
|
||||
ulint magic_n;
|
||||
|
||||
/** @return whether any persistent undo log has been generated */
|
||||
bool has_logged_persistent() const
|
||||
{
|
||||
return(rsegs.m_redo.insert_undo || rsegs.m_redo.update_undo);
|
||||
}
|
||||
|
||||
/** @return whether any undo log has been generated */
|
||||
bool has_logged() const
|
||||
{
|
||||
return(has_logged_persistent() || rsegs.m_noredo.undo);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -213,29 +213,6 @@ ok:
|
||||
trx->dict_operation = op;
|
||||
}
|
||||
|
||||
/********************************************************************//**
|
||||
Check if redo rseg is modified for insert/update. */
|
||||
UNIV_INLINE
|
||||
bool
|
||||
trx_is_redo_rseg_updated(
|
||||
/*=====================*/
|
||||
const trx_t* trx) /*!< in: transaction */
|
||||
{
|
||||
return(trx->rsegs.m_redo.insert_undo != 0
|
||||
|| trx->rsegs.m_redo.update_undo != 0);
|
||||
}
|
||||
|
||||
/********************************************************************//**
|
||||
Check if redo/noredo rseg is modified for insert/update. */
|
||||
UNIV_INLINE
|
||||
bool
|
||||
trx_is_rseg_updated(
|
||||
/*================*/
|
||||
const trx_t* trx) /*!< in: transaction */
|
||||
{
|
||||
return(trx_is_redo_rseg_updated(trx) || trx->rsegs.m_noredo.undo);
|
||||
}
|
||||
|
||||
/**
|
||||
Increase the reference count. If the transaction is in state
|
||||
TRX_STATE_COMMITTED_IN_MEMORY then the transaction is considered
|
||||
|
@ -102,7 +102,7 @@ trx_rollback_to_savepoint_low(
|
||||
|
||||
trx->error_state = DB_SUCCESS;
|
||||
|
||||
if (trx_is_rseg_updated(trx)) {
|
||||
if (trx->has_logged()) {
|
||||
|
||||
ut_ad(trx->rsegs.m_redo.rseg != 0
|
||||
|| trx->rsegs.m_noredo.rseg != 0);
|
||||
@ -213,7 +213,7 @@ trx_rollback_low(
|
||||
|
||||
case TRX_STATE_PREPARED:
|
||||
ut_ad(!trx_is_autocommit_non_locking(trx));
|
||||
if (trx_is_redo_rseg_updated(trx)) {
|
||||
if (trx->has_logged_persistent()) {
|
||||
/* Change the undo log state back from
|
||||
TRX_UNDO_PREPARED to TRX_UNDO_ACTIVE
|
||||
so that if the system gets killed,
|
||||
@ -243,7 +243,7 @@ trx_rollback_low(
|
||||
if (trx->mysql_thd == NULL) {
|
||||
/* We could be executing XA ROLLBACK after
|
||||
XA PREPARE and a server restart. */
|
||||
} else if (!trx_is_redo_rseg_updated(trx)) {
|
||||
} else if (!trx->has_logged_persistent()) {
|
||||
/* innobase_close_connection() may roll back a
|
||||
transaction that did not generate any
|
||||
persistent undo log. The DEBUG_SYNC
|
||||
|
@ -2028,7 +2028,7 @@ trx_commit_low(
|
||||
assert_trx_nonlocking_or_in_list(trx);
|
||||
ut_ad(!trx_state_eq(trx, TRX_STATE_COMMITTED_IN_MEMORY));
|
||||
ut_ad(!mtr || mtr->is_active());
|
||||
ut_ad(!mtr == !(trx_is_rseg_updated(trx)));
|
||||
ut_ad(!mtr == !trx->has_logged());
|
||||
|
||||
/* undo_no is non-zero if we're doing the final commit. */
|
||||
if (trx->fts_trx != NULL && trx->undo_no != 0) {
|
||||
@ -2081,7 +2081,7 @@ trx_commit_low(
|
||||
mtr_commit(mtr);
|
||||
|
||||
DBUG_EXECUTE_IF("ib_crash_during_trx_commit_in_mem",
|
||||
if (trx_is_rseg_updated(trx)) {
|
||||
if (trx->has_logged()) {
|
||||
log_make_checkpoint_at(LSN_MAX, TRUE);
|
||||
DBUG_SUICIDE();
|
||||
});
|
||||
@ -2099,7 +2099,7 @@ trx_commit_low(
|
||||
thd->debug_sync_control defined any longer. However the stack
|
||||
is possible only with a prepared trx not updating any data.
|
||||
*/
|
||||
if (trx->mysql_thd != NULL && trx_is_redo_rseg_updated(trx)) {
|
||||
if (trx->mysql_thd != NULL && trx->has_logged_persistent()) {
|
||||
DEBUG_SYNC_C("before_trx_state_committed_in_memory");
|
||||
}
|
||||
#endif
|
||||
@ -2120,7 +2120,7 @@ trx_commit(
|
||||
DBUG_EXECUTE_IF("ib_trx_commit_crash_before_trx_commit_start",
|
||||
DBUG_SUICIDE(););
|
||||
|
||||
if (trx_is_rseg_updated(trx)) {
|
||||
if (trx->has_logged()) {
|
||||
mtr = &local_mtr;
|
||||
mtr_start_sync(mtr);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user