mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 07:23:03 +01:00
Cleanup. New nbackup internals don't need this code anymore.
This commit is contained in:
parent
285bdb0aac
commit
b3843ebca4
@ -466,34 +466,6 @@ SLONG LCK_get_owner_handle_by_type(thread_db* tdbb, lck_owner_t lck_owner_type)
|
||||
}
|
||||
|
||||
|
||||
bool LCK_set_owner_handle(Jrd::thread_db* tdbb, Jrd::Lock* lock, SLONG owner_handle)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* L C K _ s e t _ o w n e r _ h a n d l e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Change lock owner, remove request from old owner que and
|
||||
* grant it onto new one.
|
||||
*
|
||||
**************************************/
|
||||
SET_TDBB(tdbb);
|
||||
Database* const dbb = tdbb->getDatabase();
|
||||
|
||||
fb_assert(LCK_CHECK_LOCK(lock));
|
||||
fb_assert(lock->lck_physical > LCK_none);
|
||||
|
||||
const bool result = dbb->dbb_lock_mgr->setOwnerHandle(lock->lck_id, owner_handle);
|
||||
|
||||
if (result)
|
||||
lock->lck_owner_handle = owner_handle;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void LCK_init(thread_db* tdbb, enum lck_owner_t owner_type)
|
||||
{
|
||||
/**************************************
|
||||
|
@ -38,7 +38,6 @@ void LCK_downgrade(Jrd::thread_db*, Jrd::Lock*);
|
||||
void LCK_fini(Jrd::thread_db*, Jrd::lck_owner_t);
|
||||
SLONG LCK_get_owner_handle(Jrd::thread_db*, Jrd::lck_t);
|
||||
SLONG LCK_get_owner_handle_by_type(Jrd::thread_db*, Jrd::lck_owner_t);
|
||||
bool LCK_set_owner_handle(Jrd::thread_db*, Jrd::Lock*, SLONG);
|
||||
void LCK_init(Jrd::thread_db*, Jrd::lck_owner_t);
|
||||
bool LCK_lock(Jrd::thread_db*, Jrd::Lock*, USHORT, SSHORT);
|
||||
bool LCK_lock_opt(Jrd::thread_db*, Jrd::Lock*, USHORT, SSHORT);
|
||||
|
@ -382,74 +382,6 @@ void LockManager::shutdownOwner(thread_db* tdbb, SRQ_PTR* owner_offset)
|
||||
}
|
||||
|
||||
|
||||
bool LockManager::setOwnerHandle(SRQ_PTR request_offset, SRQ_PTR new_owner_offset)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* s e t O w n e r H a n d l e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Set new owner handle for granted request.
|
||||
*
|
||||
**************************************/
|
||||
LOCK_TRACE(("LOCK_set_owner_handle (%ld)\n", request_offset));
|
||||
|
||||
Firebird::MutexLockGuard guard(m_localMutex);
|
||||
|
||||
lrq* request = get_request(request_offset);
|
||||
|
||||
// We need not to change owner
|
||||
if (request->lrq_owner == new_owner_offset)
|
||||
return true;
|
||||
|
||||
acquire_shmem(new_owner_offset);
|
||||
|
||||
request = (lrq*) SRQ_ABS_PTR(request_offset); // Re-init after a potential remap
|
||||
#ifdef DEV_BUILD
|
||||
own* const old_owner = (own*) SRQ_ABS_PTR(request->lrq_owner);
|
||||
fb_assert(old_owner->own_pending_request != request_offset);
|
||||
#endif
|
||||
own* const new_owner = (own*) SRQ_ABS_PTR(new_owner_offset);
|
||||
fb_assert(new_owner->own_pending_request != request_offset);
|
||||
#ifdef DEV_BUILD
|
||||
const prc* const old_process = (prc*) SRQ_ABS_PTR(old_owner->own_process);
|
||||
const prc* const new_process = (prc*) SRQ_ABS_PTR(new_owner->own_process);
|
||||
fb_assert(old_process->prc_process_id == new_process->prc_process_id);
|
||||
#endif
|
||||
lbl *lck = (lbl*) SRQ_ABS_PTR(request->lrq_lock);
|
||||
|
||||
// Make sure that change of lock owner is possible
|
||||
SRQ lock_srq;
|
||||
SRQ_LOOP(lck->lbl_requests, lock_srq)
|
||||
{
|
||||
lrq* granted_request = (lrq*) ((UCHAR*) lock_srq - OFFSET(lrq*, lrq_own_requests));
|
||||
// One owner must have the only granted request on the same lock resource
|
||||
if (granted_request->lrq_owner == new_owner_offset)
|
||||
{
|
||||
LOCK_TRACE(("The owner already has a granted request"));
|
||||
release_shmem(request->lrq_owner);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
remove_que(&request->lrq_own_requests);
|
||||
request->lrq_owner = new_owner_offset;
|
||||
insert_tail(&new_owner->own_requests, &request->lrq_own_requests);
|
||||
|
||||
if (request->lrq_flags & LRQ_blocking)
|
||||
{
|
||||
remove_que(&request->lrq_own_blocks);
|
||||
insert_tail(&new_owner->own_blocks, &request->lrq_own_blocks);
|
||||
}
|
||||
|
||||
release_shmem(new_owner_offset);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
SRQ_PTR LockManager::enqueue(thread_db* tdbb,
|
||||
SRQ_PTR prior_request,
|
||||
SRQ_PTR parent_request,
|
||||
|
@ -55,7 +55,6 @@ public:
|
||||
|
||||
bool initializeOwner(thread_db*, LOCK_OWNER_T, UCHAR, SRQ_PTR*);
|
||||
void shutdownOwner(thread_db*, SRQ_PTR*);
|
||||
bool setOwnerHandle(SRQ_PTR, SRQ_PTR);
|
||||
|
||||
SLONG enqueue(thread_db*, SRQ_PTR, SRQ_PTR, const USHORT, const UCHAR*, const USHORT, UCHAR,
|
||||
lock_ast_t, void*, SLONG, SSHORT, SRQ_PTR);
|
||||
|
Loading…
Reference in New Issue
Block a user