Skip to content

Commit b3a5e76

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

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
@@ -419,9 +419,9 @@ BackgroundWorkerStopNotifications(pid_t pid)
419419
/*
420420
* Reset background worker crash state.
421421
*
422-
* We assume that, after a crash-and-restart cycle, background workers should
423-
* be restarted immediately, instead of waiting for bgw_restart_time to
424-
* elapse.
422+
* We assume that, after a crash-and-restart cycle, background workers without
423+
* the never-restart flag should be restarted immediately, instead of waiting
424+
* for bgw_restart_time to elapse.
425425
*/
426426
void
427427
ResetBackgroundWorkerCrashTimes(void)
@@ -433,7 +433,14 @@ ResetBackgroundWorkerCrashTimes(void)
433433
RegisteredBgWorker *rw;
434434

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy