Skip to content

Commit 6ae0897

Browse files
committed
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
1 parent 0464f25 commit 6ae0897

File tree

1 file changed

+14
-15
lines changed
  • src/backend/storage/lmgr

1 file changed

+14
-15
lines changed

src/backend/storage/lmgr/lock.c

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,23 +1100,8 @@ LockAcquireExtended(const LOCKTAG *locktag,
11001100
* case, because while trying to go to sleep, we may discover that we
11011101
* can acquire the lock immediately after all.
11021102
*/
1103-
1104-
TRACE_POSTGRESQL_LOCK_WAIT_START(locktag->locktag_field1,
1105-
locktag->locktag_field2,
1106-
locktag->locktag_field3,
1107-
locktag->locktag_field4,
1108-
locktag->locktag_type,
1109-
lockmode);
1110-
11111103
WaitOnLock(locallock, owner, dontWait);
11121104

1113-
TRACE_POSTGRESQL_LOCK_WAIT_DONE(locktag->locktag_field1,
1114-
locktag->locktag_field2,
1115-
locktag->locktag_field3,
1116-
locktag->locktag_field4,
1117-
locktag->locktag_type,
1118-
lockmode);
1119-
11201105
/*
11211106
* NOTE: do not do any material change of state between here and
11221107
* return. All required changes in locktable state must have been
@@ -1860,6 +1845,13 @@ WaitOnLock(LOCALLOCK *locallock, ResourceOwner owner, bool dontWait)
18601845
LOCKMETHODID lockmethodid = LOCALLOCK_LOCKMETHOD(*locallock);
18611846
LockMethod lockMethodTable = LockMethods[lockmethodid];
18621847

1848+
TRACE_POSTGRESQL_LOCK_WAIT_START(locallock->tag.lock.locktag_field1,
1849+
locallock->tag.lock.locktag_field2,
1850+
locallock->tag.lock.locktag_field3,
1851+
locallock->tag.lock.locktag_field4,
1852+
locallock->tag.lock.locktag_type,
1853+
locallock->tag.mode);
1854+
18631855
LOCK_PRINT("WaitOnLock: sleeping on lock",
18641856
locallock->lock, locallock->tag.mode);
18651857

@@ -1932,6 +1924,13 @@ WaitOnLock(LOCALLOCK *locallock, ResourceOwner owner, bool dontWait)
19321924

19331925
LOCK_PRINT("WaitOnLock: wakeup on lock",
19341926
locallock->lock, locallock->tag.mode);
1927+
1928+
TRACE_POSTGRESQL_LOCK_WAIT_DONE(locallock->tag.lock.locktag_field1,
1929+
locallock->tag.lock.locktag_field2,
1930+
locallock->tag.lock.locktag_field3,
1931+
locallock->tag.lock.locktag_field4,
1932+
locallock->tag.lock.locktag_type,
1933+
locallock->tag.mode);
19351934
}
19361935

19371936
/*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy