mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
Fix build with LWLOCK_STATS or dtrace.
Also fix the name of the dtrace probe for LWLockAcquireOrWait(). The function was renamed from LWLockWaitUntilFree to LWLockAqcuireOrWait, but the dtrace probe was neglected. Pointed out by Andres Freund and the buildfarm.
This commit is contained in:
parent
1494931d73
commit
dea6ed2c98
@ -859,13 +859,13 @@ LWLockAcquireOrWait(LWLock *l, LWLockMode mode)
|
||||
/* Failed to get lock, so release interrupt holdoff */
|
||||
RESUME_INTERRUPTS();
|
||||
LOG_LWDEBUG("LWLockAcquireOrWait", T_NAME(l), T_ID(l), "failed");
|
||||
TRACE_POSTGRESQL_LWLOCK_WAIT_UNTIL_FREE_FAIL(T_NAME(l), T_ID(l), mode);
|
||||
TRACE_POSTGRESQL_LWLOCK_ACQUIRE_OR_WAIT_FAIL(T_NAME(l), T_ID(l), mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Add lock to list of locks held by this backend */
|
||||
held_lwlocks[num_held_lwlocks++] = l;
|
||||
TRACE_POSTGRESQL_LWLOCK_WAIT_UNTIL_FREE(T_NAME(l), T_ID(l), mode);
|
||||
TRACE_POSTGRESQL_LWLOCK_ACQUIRE_OR_WAIT(T_NAME(l), T_ID(l), mode);
|
||||
}
|
||||
|
||||
return !mustwait;
|
||||
@ -897,6 +897,15 @@ LWLockWaitForVar(LWLock *l, uint64 *valptr, uint64 oldval, uint64 *newval)
|
||||
PGPROC *proc = MyProc;
|
||||
int extraWaits = 0;
|
||||
bool result = false;
|
||||
#ifdef LWLOCK_STATS
|
||||
lwlock_stats *lwstats;
|
||||
#endif
|
||||
|
||||
PRINT_LWDEBUG("LWLockWaitForVar", lock);
|
||||
|
||||
#ifdef LWLOCK_STATS
|
||||
lwstats = get_lwlock_stats_entry(l);
|
||||
#endif /* LWLOCK_STATS */
|
||||
|
||||
/*
|
||||
* Quick test first to see if it the slot is free right now.
|
||||
@ -986,7 +995,7 @@ LWLockWaitForVar(LWLock *l, uint64 *valptr, uint64 oldval, uint64 *newval)
|
||||
lwstats->block_count++;
|
||||
#endif
|
||||
|
||||
TRACE_POSTGRESQL_LWLOCK_WAIT_START(T_NAME(l), T_ID(l), mode);
|
||||
TRACE_POSTGRESQL_LWLOCK_WAIT_START(T_NAME(l), T_ID(l), LW_EXCLUSIVE);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
@ -997,7 +1006,7 @@ LWLockWaitForVar(LWLock *l, uint64 *valptr, uint64 oldval, uint64 *newval)
|
||||
extraWaits++;
|
||||
}
|
||||
|
||||
TRACE_POSTGRESQL_LWLOCK_WAIT_DONE(T_NAME(l), T_ID(l), mode);
|
||||
TRACE_POSTGRESQL_LWLOCK_WAIT_DONE(T_NAME(l), T_ID(l), LW_EXCLUSIVE);
|
||||
|
||||
LOG_LWDEBUG("LWLockWaitForVar", T_NAME(l), T_ID(l), "awakened");
|
||||
|
||||
@ -1007,7 +1016,7 @@ LWLockWaitForVar(LWLock *l, uint64 *valptr, uint64 oldval, uint64 *newval)
|
||||
/* We are done updating shared state of the lock itself. */
|
||||
SpinLockRelease(&lock->mutex);
|
||||
|
||||
TRACE_POSTGRESQL_LWLOCK_ACQUIRE(T_NAME(l), T_ID(l), mode);
|
||||
TRACE_POSTGRESQL_LWLOCK_ACQUIRE(T_NAME(l), T_ID(l), LW_EXCLUSIVE);
|
||||
|
||||
/*
|
||||
* Fix the process wait semaphore's count for any absorbed wakeups.
|
||||
|
@ -34,8 +34,8 @@ provider postgresql {
|
||||
probe lwlock__wait__done(const char *, int, LWLockMode);
|
||||
probe lwlock__condacquire(const char *, int, LWLockMode);
|
||||
probe lwlock__condacquire__fail(const char *, int, LWLockMode);
|
||||
probe lwlock__wait__until__free(const char *, int, LWLockMode);
|
||||
probe lwlock__wait__until__free__fail(const char *, int, LWLockMode);
|
||||
probe lwlock__acquire__or__wait(const char *, int, LWLockMode);
|
||||
probe lwlock__acquire__or__wait__fail(const char *, int, LWLockMode);
|
||||
|
||||
probe lock__wait__start(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, LOCKMODE);
|
||||
probe lock__wait__done(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, LOCKMODE);
|
||||
|
Loading…
Reference in New Issue
Block a user