Commit 5e77a1df authored by sunny's avatar sunny

branches/zip: Fix bug# 46650: Innodb assertion autoinc_lock == lock in...

branches/zip: Fix bug# 46650:  Innodb assertion autoinc_lock == lock in lock_table_remove_low on INSERT SELECT

We only store the autoinc locks that are granted in the transaction's autoinc
lock vector. A transacton, that has been rolled back due to a deadlock because
of an AUTOINC lock attempt, will not have added that lock to the vector. We
need to check for that when we remove that lock.

rb://145
Approved by Marko.
parent cc305b73
......@@ -3580,7 +3580,8 @@ lock_table_remove_low(
and lock_grant()). Therefore it can be empty and we
need to check for that. */
if (!ib_vector_is_empty(trx->autoinc_locks)) {
if (!lock_get_wait(lock)
&& !ib_vector_is_empty(trx->autoinc_locks)) {
lock_t* autoinc_lock;
autoinc_lock = ib_vector_pop(trx->autoinc_locks);
......@@ -3653,8 +3654,10 @@ lock_table_enqueue_waiting(
if (lock_deadlock_occurs(lock, trx)) {
lock_reset_lock_and_trx_wait(lock);
/* The order here is important, we don't want to
lose the state of the lock before calling remove. */
lock_table_remove_low(lock);
lock_reset_lock_and_trx_wait(lock);
return(DB_DEADLOCK);
}
......
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