Move TRACE calls into WaitOnLock()
LockAcquire is a long and complex function. Pushing more stuff to its subroutines makes it a little more manageable. Reviewed-by: Maxim Orlov Discussion: https://www.postgresql.org/message-id/7c2090cd-a72a-4e34-afaa-6dd2ef31440e@iki.fi
This commit is contained in:
parent
0464f25b6a
commit
6ae0897e42
@ -1100,23 +1100,8 @@ LockAcquireExtended(const LOCKTAG *locktag,
|
|||||||
* case, because while trying to go to sleep, we may discover that we
|
* case, because while trying to go to sleep, we may discover that we
|
||||||
* can acquire the lock immediately after all.
|
* can acquire the lock immediately after all.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TRACE_POSTGRESQL_LOCK_WAIT_START(locktag->locktag_field1,
|
|
||||||
locktag->locktag_field2,
|
|
||||||
locktag->locktag_field3,
|
|
||||||
locktag->locktag_field4,
|
|
||||||
locktag->locktag_type,
|
|
||||||
lockmode);
|
|
||||||
|
|
||||||
WaitOnLock(locallock, owner, dontWait);
|
WaitOnLock(locallock, owner, dontWait);
|
||||||
|
|
||||||
TRACE_POSTGRESQL_LOCK_WAIT_DONE(locktag->locktag_field1,
|
|
||||||
locktag->locktag_field2,
|
|
||||||
locktag->locktag_field3,
|
|
||||||
locktag->locktag_field4,
|
|
||||||
locktag->locktag_type,
|
|
||||||
lockmode);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NOTE: do not do any material change of state between here and
|
* NOTE: do not do any material change of state between here and
|
||||||
* return. All required changes in locktable state must have been
|
* return. All required changes in locktable state must have been
|
||||||
@ -1860,6 +1845,13 @@ WaitOnLock(LOCALLOCK *locallock, ResourceOwner owner, bool dontWait)
|
|||||||
LOCKMETHODID lockmethodid = LOCALLOCK_LOCKMETHOD(*locallock);
|
LOCKMETHODID lockmethodid = LOCALLOCK_LOCKMETHOD(*locallock);
|
||||||
LockMethod lockMethodTable = LockMethods[lockmethodid];
|
LockMethod lockMethodTable = LockMethods[lockmethodid];
|
||||||
|
|
||||||
|
TRACE_POSTGRESQL_LOCK_WAIT_START(locallock->tag.lock.locktag_field1,
|
||||||
|
locallock->tag.lock.locktag_field2,
|
||||||
|
locallock->tag.lock.locktag_field3,
|
||||||
|
locallock->tag.lock.locktag_field4,
|
||||||
|
locallock->tag.lock.locktag_type,
|
||||||
|
locallock->tag.mode);
|
||||||
|
|
||||||
LOCK_PRINT("WaitOnLock: sleeping on lock",
|
LOCK_PRINT("WaitOnLock: sleeping on lock",
|
||||||
locallock->lock, locallock->tag.mode);
|
locallock->lock, locallock->tag.mode);
|
||||||
|
|
||||||
@ -1932,6 +1924,13 @@ WaitOnLock(LOCALLOCK *locallock, ResourceOwner owner, bool dontWait)
|
|||||||
|
|
||||||
LOCK_PRINT("WaitOnLock: wakeup on lock",
|
LOCK_PRINT("WaitOnLock: wakeup on lock",
|
||||||
locallock->lock, locallock->tag.mode);
|
locallock->lock, locallock->tag.mode);
|
||||||
|
|
||||||
|
TRACE_POSTGRESQL_LOCK_WAIT_DONE(locallock->tag.lock.locktag_field1,
|
||||||
|
locallock->tag.lock.locktag_field2,
|
||||||
|
locallock->tag.lock.locktag_field3,
|
||||||
|
locallock->tag.lock.locktag_field4,
|
||||||
|
locallock->tag.lock.locktag_type,
|
||||||
|
locallock->tag.mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user