Add debugging code for the "latch already owned" error.
We've seen such a case on a stable release but it is hard to debug via the
message only, so let's provide more details in the error message.
@@ -260,7 +260,8 @@ OwnLatch(volatile Latch *latch)
#endif
if (latch->owner_pid != 0)
- elog(ERROR, "latch already owned");
+ elog(ERROR, "latch already owned by pid %d (is_set: %d)",
+ latch->owner_pid, (int) latch->is_set);
latch->owner_pid = MyProcPid;
}
