mirror of
https://github.com/postgres/postgres.git
synced 2025-06-02 00:01:40 -04:00
Add debugging help in OwnLatch().
Build farm animal gharial recently failed a few times in a parallel worker's call to OwnLatch() with "ERROR: latch already owned". Let's turn that into a PANIC and show the PID of the owner, to try to learn more. Discussion: https://postgr.es/m/CA%2BhUKGJ_0RGcr7oUNzcHdn7zHqHSB_wLSd3JyS2YC_DYB%2B-V%3Dg%40mail.gmail.com
This commit is contained in:
parent
5f0adec253
commit
12e28aac8e
@ -402,6 +402,8 @@ InitSharedLatch(Latch *latch)
|
|||||||
void
|
void
|
||||||
OwnLatch(Latch *latch)
|
OwnLatch(Latch *latch)
|
||||||
{
|
{
|
||||||
|
int owner_pid;
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
Assert(latch->is_shared);
|
Assert(latch->is_shared);
|
||||||
|
|
||||||
@ -410,8 +412,9 @@ OwnLatch(Latch *latch)
|
|||||||
Assert(selfpipe_readfd >= 0 && selfpipe_owner_pid == MyProcPid);
|
Assert(selfpipe_readfd >= 0 && selfpipe_owner_pid == MyProcPid);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (latch->owner_pid != 0)
|
owner_pid = latch->owner_pid;
|
||||||
elog(ERROR, "latch already owned");
|
if (owner_pid != 0)
|
||||||
|
elog(PANIC, "latch already owned by PID %d", owner_pid);
|
||||||
|
|
||||||
latch->owner_pid = MyProcPid;
|
latch->owner_pid = MyProcPid;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user