recovery-conflict-fail-extra-logging.patch
text/x-patch
Filename: recovery-conflict-fail-extra-logging.patch
Type: text/x-patch
Part: 0
Patch
Format: unified
| File | + | − |
|---|---|---|
| src/backend/replication/slot.c | 2 | 0 |
| src/backend/storage/ipc/procarray.c | 2 | 0 |
| src/backend/storage/ipc/procsignal.c | 6 | 1 |
| src/backend/tcop/postgres.c | 3 | 0 |
diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c
index 28c7019402b..cc25abbb5ce 100644
--- a/src/backend/replication/slot.c
+++ b/src/backend/replication/slot.c
@@ -2122,6 +2122,8 @@ InvalidatePossiblyObsoleteSlot(uint32 possible_causes,
last_signaled_pid = active_pid;
}
+ else
+ elog(LOG, "XXX: same process (%d) is still blocking us, not signaling again", active_pid);
/* Wait until the slot is released. */
ConditionVariableSleep(&s->active_cv,
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index 40312df2cac..c82761f5da3 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -3473,6 +3473,8 @@ SignalRecoveryConflict(PGPROC *proc, pid_t pid, RecoveryConflictReason reason)
(void) SendProcSignal(pid, PROCSIG_RECOVERY_CONFLICT, GetNumberFromPGProc(proc));
found = true;
}
+ else
+ elog(LOG, "XXX: SignalRecoveryConflict signaling pid %d, because it's gone (proc->pid == %d)", pid, proc->pid);
LWLockRelease(ProcArrayLock);
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index d47d180a32f..b561dc64265 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -289,19 +289,24 @@ SendProcSignal(pid_t pid, ProcSignalReason reason, ProcNumber procNumber)
if (procNumber != INVALID_PROC_NUMBER)
{
+ uint32 slot_pid;
Assert(procNumber < NumProcSignalSlots);
slot = &ProcSignal->psh_slot[procNumber];
SpinLockAcquire(&slot->pss_mutex);
- if (pg_atomic_read_u32(&slot->pss_pid) == pid)
+ slot_pid = pg_atomic_read_u32(&slot->pss_pid);
+ if (slot_pid == pid)
{
/* Atomically set the proper flag */
slot->pss_signalFlags[reason] = true;
SpinLockRelease(&slot->pss_mutex);
+ elog(LOG, "XXX: SendProcSignal sending SIGUSR1 to pid %d", pid);
/* Send signal */
return kill(pid, SIGUSR1);
}
SpinLockRelease(&slot->pss_mutex);
+ elog(LOG, "XXX: SendProcSignal NOT sending SIGUSR1 to pid %d, because it's gone (slot->pss_pid %u)",
+ pid, slot_pid);
}
else
{
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index d01a09dd0c4..734ff056dad 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -3182,6 +3182,9 @@ report_recovery_conflict(RecoveryConflictReason reason)
{
bool fatal;
+ elog(LOG, "XXX: report_recovery_conflict called; reason %d; IsAbortedTransactionBlockState() %d; DoingCommandRead %d; QueryCancelHoldoffCount %d",
+ reason, IsAbortedTransactionBlockState(), DoingCommandRead, QueryCancelHoldoffCount);
+
if (reason == RECOVERY_CONFLICT_DATABASE)
{
/* note: no hint about reconnecting, and different errcode */