Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0d34314

Browse files
committed
Add logging for excessive ProcSignalBarrier waits.
To enable diagnosis of systems that are not processing ProcSignalBarrierrequests promptly, add a LOG message every 5 seconds if we seem to bewedged. Although you could already see this state as a wait event inpg_stat_activity, the log message also shows the PID of the process thatis preventing progress.Also add DEBUG1 logging around the whole wait loop.Reviewed-by: Robert Haas <robertmhaas@gmail.com>Discussion:https://postgr.es/m/CA%2BTgmoYJ03r5359gQutRGP9BtigYCg3_UskcmnVjBf-QO3-0pQ%40mail.gmail.com
1 parentf95d53e commit0d34314

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

‎src/backend/storage/ipc/procsignal.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,11 @@ WaitForProcSignalBarrier(uint64 generation)
393393
{
394394
Assert(generation <=pg_atomic_read_u64(&ProcSignal->psh_barrierGeneration));
395395

396+
elog(DEBUG1,
397+
"waiting for all backends to process ProcSignalBarrier generation "
398+
UINT64_FORMAT,
399+
generation);
400+
396401
for (inti=NumProcSignalSlots-1;i >=0;i--)
397402
{
398403
ProcSignalSlot*slot=&ProcSignal->psh_slot[i];
@@ -407,13 +412,22 @@ WaitForProcSignalBarrier(uint64 generation)
407412
oldval=pg_atomic_read_u64(&slot->pss_barrierGeneration);
408413
while (oldval<generation)
409414
{
410-
ConditionVariableSleep(&slot->pss_barrierCV,
411-
WAIT_EVENT_PROC_SIGNAL_BARRIER);
415+
if (ConditionVariableTimedSleep(&slot->pss_barrierCV,
416+
5000,
417+
WAIT_EVENT_PROC_SIGNAL_BARRIER))
418+
ereport(LOG,
419+
(errmsg("still waiting for backend with PID %lu to accept ProcSignalBarrier",
420+
(unsigned long)slot->pss_pid)));
412421
oldval=pg_atomic_read_u64(&slot->pss_barrierGeneration);
413422
}
414423
ConditionVariableCancelSleep();
415424
}
416425

426+
elog(DEBUG1,
427+
"finished waiting for all backends to process ProcSignalBarrier generation "
428+
UINT64_FORMAT,
429+
generation);
430+
417431
/*
418432
* The caller is probably calling this function because it wants to read
419433
* the shared state or perform further writes to shared state once all

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp