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
|
||||
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. */
|
||||
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.
|
||||
Note: this is done in a background thread.
|
||||
@return a dummy parameter */
|
||||
|
|
|
@ -3118,6 +3118,11 @@ recv_recovery_from_checkpoint_finish(void)
|
|||
#ifndef UNIV_LOG_DEBUG
|
||||
recv_sys_free();
|
||||
#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. */
|
||||
row_merge_drop_temp_indexes();
|
||||
|
|
|
@ -532,28 +532,26 @@ trx_rollback_active(
|
|||
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 */
|
||||
transaction was not yet committed, then we roll it back. */
|
||||
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 */
|
||||
void
|
||||
trx_rollback_or_clean_recovered(
|
||||
/*============================*/
|
||||
ibool all) /*!< in: FALSE=roll back dictionary transactions;
|
||||
TRUE=roll back all non-PREPARED transactions */
|
||||
{
|
||||
trx_t* trx;
|
||||
|
||||
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,
|
||||
"InnoDB: Starting in background the rollback"
|
||||
" of uncommitted transactions\n");
|
||||
} else {
|
||||
goto leave_function;
|
||||
}
|
||||
|
||||
mutex_exit(&kernel_mutex);
|
||||
|
@ -582,18 +580,42 @@ loop:
|
|||
goto loop;
|
||||
|
||||
case TRX_ACTIVE:
|
||||
if (all || trx_get_dict_operation(trx)
|
||||
!= TRX_DICT_OP_NONE) {
|
||||
mutex_exit(&kernel_mutex);
|
||||
trx_rollback_active(trx);
|
||||
goto loop;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (all) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: Rollback of non-prepared transactions completed\n");
|
||||
" InnoDB: Rollback of non-prepared"
|
||||
" transactions completed\n");
|
||||
}
|
||||
|
||||
leave_function:
|
||||
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
|
||||
thread should always use that to exit and not use return() to exit. */
|
||||
|
|
Loading…
Add table
Reference in a new issue