mirror of
https://github.com/MariaDB/server.git
synced 2025-02-01 11:31:51 +01:00
branches/zip: Roll back recovered dictionary transactions before
dropping incomplete indexes (Issue #337). trx_rollback_or_clean_recovered(ibool all): New function, split from trx_rollback_or_clean_all_recovered(). all==FALSE will only roll back dictionary transactions. recv_recovery_from_checkpoint_finish(): Call trx_rollback_or_clean_recovered(FALSE) before row_merge_drop_temp_indexes(). rb://158 approved by Sunny Bains
This commit is contained in:
parent
3bd1a9fbfd
commit
7fd517a79d
3 changed files with 56 additions and 18 deletions
|
@ -133,6 +133,17 @@ trx_rollback(
|
||||||
Rollback or clean up any incomplete transactions which were
|
Rollback or clean up any incomplete transactions which were
|
||||||
encountered in crash recovery. If the transaction already was
|
encountered in crash recovery. If the transaction already was
|
||||||
committed, then we clean up a possible insert undo log. If the
|
committed, then we clean up a possible insert undo log. If the
|
||||||
|
transaction was not yet committed, then we roll it back. */
|
||||||
|
UNIV_INTERN
|
||||||
|
void
|
||||||
|
trx_rollback_or_clean_recovered(
|
||||||
|
/*============================*/
|
||||||
|
ibool all); /*!< in: FALSE=roll back dictionary transactions;
|
||||||
|
TRUE=roll back all non-PREPARED transactions */
|
||||||
|
/*******************************************************************//**
|
||||||
|
Rollback or clean up any incomplete transactions which were
|
||||||
|
encountered in crash recovery. If the transaction already was
|
||||||
|
committed, then we clean up a possible insert undo log. If the
|
||||||
transaction was not yet committed, then we roll it back.
|
transaction was not yet committed, then we roll it back.
|
||||||
Note: this is done in a background thread.
|
Note: this is done in a background thread.
|
||||||
@return a dummy parameter */
|
@return a dummy parameter */
|
||||||
|
|
|
@ -3118,6 +3118,11 @@ recv_recovery_from_checkpoint_finish(void)
|
||||||
#ifndef UNIV_LOG_DEBUG
|
#ifndef UNIV_LOG_DEBUG
|
||||||
recv_sys_free();
|
recv_sys_free();
|
||||||
#endif
|
#endif
|
||||||
|
/* Roll back any recovered data dictionary transactions, so
|
||||||
|
that the data dictionary tables will be free of any locks.
|
||||||
|
The data dictionary latch should guarantee that there is at
|
||||||
|
most one data dictionary transaction active at a time. */
|
||||||
|
trx_rollback_or_clean_recovered(FALSE);
|
||||||
|
|
||||||
/* Drop partially created indexes. */
|
/* Drop partially created indexes. */
|
||||||
row_merge_drop_temp_indexes();
|
row_merge_drop_temp_indexes();
|
||||||
|
|
|
@ -532,28 +532,26 @@ trx_rollback_active(
|
||||||
Rollback or clean up any incomplete transactions which were
|
Rollback or clean up any incomplete transactions which were
|
||||||
encountered in crash recovery. If the transaction already was
|
encountered in crash recovery. If the transaction already was
|
||||||
committed, then we clean up a possible insert undo log. If the
|
committed, then we clean up a possible insert undo log. If the
|
||||||
transaction was not yet committed, then we roll it back.
|
transaction was not yet committed, then we roll it back. */
|
||||||
Note: this is done in a background thread.
|
|
||||||
@return a dummy parameter */
|
|
||||||
UNIV_INTERN
|
UNIV_INTERN
|
||||||
os_thread_ret_t
|
void
|
||||||
trx_rollback_or_clean_all_recovered(
|
trx_rollback_or_clean_recovered(
|
||||||
/*================================*/
|
/*============================*/
|
||||||
void* arg __attribute__((unused)))
|
ibool all) /*!< in: FALSE=roll back dictionary transactions;
|
||||||
/*!< in: a dummy parameter required by
|
TRUE=roll back all non-PREPARED transactions */
|
||||||
os_thread_create */
|
|
||||||
{
|
{
|
||||||
trx_t* trx;
|
trx_t* trx;
|
||||||
|
|
||||||
mutex_enter(&kernel_mutex);
|
mutex_enter(&kernel_mutex);
|
||||||
|
|
||||||
if (UT_LIST_GET_FIRST(trx_sys->trx_list)) {
|
if (!UT_LIST_GET_FIRST(trx_sys->trx_list)) {
|
||||||
|
goto leave_function;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (all) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"InnoDB: Starting in background the rollback"
|
"InnoDB: Starting in background the rollback"
|
||||||
" of uncommitted transactions\n");
|
" of uncommitted transactions\n");
|
||||||
} else {
|
|
||||||
goto leave_function;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_exit(&kernel_mutex);
|
mutex_exit(&kernel_mutex);
|
||||||
|
@ -582,18 +580,42 @@ loop:
|
||||||
goto loop;
|
goto loop;
|
||||||
|
|
||||||
case TRX_ACTIVE:
|
case TRX_ACTIVE:
|
||||||
|
if (all || trx_get_dict_operation(trx)
|
||||||
|
!= TRX_DICT_OP_NONE) {
|
||||||
mutex_exit(&kernel_mutex);
|
mutex_exit(&kernel_mutex);
|
||||||
trx_rollback_active(trx);
|
trx_rollback_active(trx);
|
||||||
goto loop;
|
goto loop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (all) {
|
||||||
ut_print_timestamp(stderr);
|
ut_print_timestamp(stderr);
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
" InnoDB: Rollback of non-prepared transactions completed\n");
|
" InnoDB: Rollback of non-prepared"
|
||||||
|
" transactions completed\n");
|
||||||
|
}
|
||||||
|
|
||||||
leave_function:
|
leave_function:
|
||||||
mutex_exit(&kernel_mutex);
|
mutex_exit(&kernel_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************//**
|
||||||
|
Rollback or clean up any incomplete transactions which were
|
||||||
|
encountered in crash recovery. If the transaction already was
|
||||||
|
committed, then we clean up a possible insert undo log. If the
|
||||||
|
transaction was not yet committed, then we roll it back.
|
||||||
|
Note: this is done in a background thread.
|
||||||
|
@return a dummy parameter */
|
||||||
|
UNIV_INTERN
|
||||||
|
os_thread_ret_t
|
||||||
|
trx_rollback_or_clean_all_recovered(
|
||||||
|
/*================================*/
|
||||||
|
void* arg __attribute__((unused)))
|
||||||
|
/*!< in: a dummy parameter required by
|
||||||
|
os_thread_create */
|
||||||
|
{
|
||||||
|
trx_rollback_or_clean_recovered(TRUE);
|
||||||
|
|
||||||
/* We count the number of threads in os_thread_exit(). A created
|
/* We count the number of threads in os_thread_exit(). A created
|
||||||
thread should always use that to exit and not use return() to exit. */
|
thread should always use that to exit and not use return() to exit. */
|
||||||
|
|
Loading…
Add table
Reference in a new issue