[Commits] e3e66e6e0: Don't call lock_tree::release_locks({empty buffer}). This is dangerous.
revision-id: e3e66e6e0af211cb2b963e4cd9c0539b746e0b8d (v5.8-1024-ge3e66e6e0) parent(s): dd648b42fde54a15675002981c305cf786db8594 author: Sergei Petrunia committer: Sergei Petrunia timestamp: 2019-01-06 00:17:19 +0300 message: Don't call lock_tree::release_locks({empty buffer}). This is dangerous. --- utilities/transactions/transaction_lock_mgr.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/utilities/transactions/transaction_lock_mgr.cc b/utilities/transactions/transaction_lock_mgr.cc index 53e60679d..395bcbaaf 100644 --- a/utilities/transactions/transaction_lock_mgr.cc +++ b/utilities/transactions/transaction_lock_mgr.cc @@ -857,7 +857,13 @@ void RangeLockMgr::UnLockAll(const PessimisticTransaction* txn, if (txn->owned_locks) { RangeLockList* range_list= (RangeLockList*)txn->owned_locks.get(); - lt->release_locks(txn->GetID(), &range_list->buffer, true); + + // Don't try to call release_locks() if the buffer is empty! if we are + // not holding any locks, other transaction may be in STO-mode currently + // and our attempt to release an empty set of locks will cause an + // assertion failure. + if (range_list->buffer.get_num_ranges()) + lt->release_locks(txn->GetID(), &range_list->buffer, true); range_list->buffer.destroy(); range_list->buffer.create(); toku::lock_request::retry_all_lock_requests(lt, nullptr /* lock_wait_needed_callback */);
participants (1)
-
Sergei Petrunia