Hi all, While doing something I should not have done, I have been able to trigger latch.c with the error of $subject. Adding in the elog generated some information about the PID owning the latch and MyProcPid has made me understand immediately why I was wrong. Would there be any objections to add more information in this case?
The attached patch does so. Thanks, -- Michael
diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c
index f4123e7de7..ab902b265e 100644
--- a/src/backend/storage/ipc/latch.c
+++ b/src/backend/storage/ipc/latch.c
@@ -936,7 +936,8 @@ AddWaitEventToSet(WaitEventSet *set, uint32 events, pgsocket fd, Latch *latch,
if (latch)
{
if (latch->owner_pid != MyProcPid)
- elog(ERROR, "cannot wait on a latch owned by another process");
+ elog(ERROR, "cannot wait on a latch owned by another process (%d,%d)",
+ latch->owner_pid, MyProcPid);
if (set->latch)
elog(ERROR, "cannot wait on more than one latch");
if ((events & WL_LATCH_SET) != WL_LATCH_SET)
@@ -1046,7 +1047,8 @@ ModifyWaitEvent(WaitEventSet *set, int pos, uint32 events, Latch *latch)
if (events == WL_LATCH_SET)
{
if (latch && latch->owner_pid != MyProcPid)
- elog(ERROR, "cannot wait on a latch owned by another process");
+ elog(ERROR, "cannot wait on a latch owned by another process (%d,%d)",
+ latch->owner_pid, MyProcPid);
set->latch = latch;
/*
signature.asc
Description: PGP signature
