Author: Noah Misch Commit: Noah Misch diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c index 7767657..a1c0d38 100644 --- a/src/backend/storage/ipc/procsignal.c +++ b/src/backend/storage/ipc/procsignal.c @@ -638,6 +638,8 @@ void procsignal_sigusr1_handler(SIGNAL_ARGS) { int save_errno = errno; + static bool slept = false; + bool got; if (CheckProcSignal(PROCSIG_CATCHUP_INTERRUPT)) HandleCatchupInterrupt(); @@ -663,13 +665,21 @@ procsignal_sigusr1_handler(SIGNAL_ARGS) if (CheckProcSignal(PROCSIG_RECOVERY_CONFLICT_TABLESPACE)) RecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_TABLESPACE); + got = CheckProcSignal(PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK); + if (got && !slept) + { + slept = true; + /* probably must exceed max_standby_streaming_delay */ + pg_usleep(60 * 1000); + } + if (CheckProcSignal(PROCSIG_RECOVERY_CONFLICT_LOCK)) RecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_LOCK); if (CheckProcSignal(PROCSIG_RECOVERY_CONFLICT_SNAPSHOT)) RecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_SNAPSHOT); - if (CheckProcSignal(PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK)) + if (got) RecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK); if (CheckProcSignal(PROCSIG_RECOVERY_CONFLICT_BUFFERPIN)) diff --git a/src/backend/storage/ipc/standby.c b/src/backend/storage/ipc/standby.c index f43229d..204ae80 100644 --- a/src/backend/storage/ipc/standby.c +++ b/src/backend/storage/ipc/standby.c @@ -854,6 +854,7 @@ ResolveRecoveryConflictWithBufferPin(void) * is basically no so long. But we should fix this? */ SendRecoveryConflictWithBufferPin(PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK); + pg_usleep(90 * 1000); } /* diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 01d264b..854e0db 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -3003,6 +3003,9 @@ RecoveryConflictInterrupt(ProcSignalReason reason) { int save_errno = errno; + /* Not elog(), which would process interrupts. */ + fprintf(stderr, "reason = %d inprog=%d\n", reason, proc_exit_inprogress); + /* * Don't joggle the elbow of proc_exit */