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

Remove dead code lock_remove_recovered_trx_record_locks()

Contrary to what the comment said, trx_resurrect_table_locks()
does associate table locks with every recovered transaction that
modified any records, ever since this bug fix in MySQL 5.6.12:

Bug#16593427 ROLLBACK OF RECOVERED TRANSACTION CORRUPTS NON-ONLINE ADD INDEX
parent 2b67b7cb
......@@ -964,11 +964,6 @@ struct lock_sys_t{
in the waiting_threads array,
protected by
lock_sys->wait_mutex */
ibool rollback_complete;
/*!< TRUE if rollback of all
recovered transactions is
complete. Protected by
lock_sys->mutex */
ulint n_lock_max_wait_time; /*!< Max wait time */
......
......@@ -5418,77 +5418,6 @@ lock_remove_all_on_table_for_trx(
}
}
/*******************************************************************//**
Remove any explicit record locks held by recovering transactions on
the table.
@return number of recovered transactions examined */
static
ulint
lock_remove_recovered_trx_record_locks(
/*===================================*/
dict_table_t* table) /*!< in: check if there are any locks
held on records in this table or on the
table itself */
{
ut_a(table != NULL);
ut_ad(lock_mutex_own());
ulint n_recovered_trx = 0;
mutex_enter(&trx_sys->mutex);
for (trx_t* trx = UT_LIST_GET_FIRST(trx_sys->rw_trx_list);
trx != NULL;
trx = UT_LIST_GET_NEXT(trx_list, trx)) {
assert_trx_in_rw_list(trx);
if (!trx->is_recovered) {
continue;
}
/* Because we are holding the lock_sys->mutex,
implicit locks cannot be converted to explicit ones
while we are scanning the explicit locks. */
lock_t* next_lock;
for (lock_t* lock = UT_LIST_GET_FIRST(trx->lock.trx_locks);
lock != NULL;
lock = next_lock) {
ut_a(lock->trx == trx);
/* Recovered transactions can't wait on a lock. */
ut_a(!lock_get_wait(lock));
next_lock = UT_LIST_GET_NEXT(trx_locks, lock);
switch (lock_get_type_low(lock)) {
default:
ut_error;
case LOCK_TABLE:
if (lock->un_member.tab_lock.table == table) {
lock_trx_table_locks_remove(lock);
lock_table_remove_low(lock);
}
break;
case LOCK_REC:
if (lock->index->table == table) {
lock_rec_discard(lock);
}
}
}
++n_recovered_trx;
}
mutex_exit(&trx_sys->mutex);
return(n_recovered_trx);
}
/*********************************************************************//**
Removes locks on a table to be dropped or truncated.
If remove_also_table_sx_locks is TRUE then table-level S and X locks are
......@@ -5550,17 +5479,6 @@ lock_remove_all_on_table(
}
}
/* Note: Recovered transactions don't have table level IX or IS locks
but can have implicit record locks that have been converted to explicit
record locks. Such record locks cannot be freed by traversing the
transaction lock list in dict_table_t (as above). */
if (!lock_sys->rollback_complete
&& lock_remove_recovered_trx_record_locks(table) == 0) {
lock_sys->rollback_complete = TRUE;
}
lock_mutex_exit();
}
......
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