Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a1f4ade

Browse files
committed
After a crash, don't restart workers with BGW_NEVER_RESTART.
Amit Khandekar
1 parent 3ebe6d8 commit a1f4ade

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/backend/postmaster/bgworker.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,9 @@ BackgroundWorkerStopNotifications(pid_t pid)
420420
/*
421421
* Reset background worker crash state.
422422
*
423-
* We assume that, after a crash-and-restart cycle, background workers should
424-
* be restarted immediately, instead of waiting for bgw_restart_time to
425-
* elapse.
423+
* We assume that, after a crash-and-restart cycle, background workers without
424+
* the never-restart flag should be restarted immediately, instead of waiting
425+
* for bgw_restart_time to elapse.
426426
*/
427427
void
428428
ResetBackgroundWorkerCrashTimes(void)
@@ -434,7 +434,14 @@ ResetBackgroundWorkerCrashTimes(void)
434434
RegisteredBgWorker *rw;
435435

436436
rw = slist_container(RegisteredBgWorker, rw_lnode, iter.cur);
437-
rw->rw_crashed_at = 0;
437+
438+
/*
439+
* For workers that should not be restarted, we don't want to lose
440+
* the information that they have crashed; otherwise, they would be
441+
* restarted, which is wrong.
442+
*/
443+
if (rw->rw_worker.bgw_restart_time != BGW_NEVER_RESTART)
444+
rw->rw_crashed_at = 0;
438445
}
439446
}
440447

0 commit comments

Comments
 (0)