diff options
Diffstat (limited to 'storage/innobase/lock/lock0lock.cc')
-rw-r--r-- | storage/innobase/lock/lock0lock.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 791f77f583d..223783a11bc 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -5376,11 +5376,12 @@ static void lock_release_autoinc_locks(trx_t *trx, bool owns_wait_mutex) (ib_vector_get(autoinc_locks, size - 1)); ut_ad(lock->type_mode == (LOCK_AUTO_INC | LOCK_TABLE)); dict_table_t *table= lock->un_member.tab_lock.table; - /* The mutex is only necessary if !lock_sys.is_writer() */ - table->lock_mutex_lock(); + if (!owns_wait_mutex) + table->lock_mutex_lock(); lock_table_dequeue(lock, owns_wait_mutex); lock_trx_table_locks_remove(lock); - table->lock_mutex_unlock(); + if (!owns_wait_mutex) + table->lock_mutex_unlock(); } } @@ -5424,7 +5425,8 @@ void lock_sys_t::cancel(trx_t *trx, lock_t *lock) { dict_table_t *table= lock->un_member.tab_lock.table; table->lock_mutex_lock(); - lock_cancel_waiting_and_release(lock); + if (lock->is_waiting()) + lock_cancel_waiting_and_release(lock); table->lock_mutex_unlock(); } else @@ -5433,7 +5435,8 @@ void lock_sys_t::cancel(trx_t *trx, lock_t *lock) (lock_sys.hash_get(lock->type_mode).cell_get (lock->un_member.rec_lock.page_id.fold())); latch->acquire(); - lock_cancel_waiting_and_release(lock); + if (lock->is_waiting()) + lock_cancel_waiting_and_release(lock); latch->release(); } } |