diff options
author | Robert Haas | 2015-04-02 18:38:06 +0000 |
---|---|---|
committer | Robert Haas | 2015-04-02 18:38:06 +0000 |
commit | b3a5e76e126553d2a553694d3c54ac9e48b3a4a2 (patch) | |
tree | c647e6f88ae711195caec021dbc67cd6c5d1bb84 | |
parent | abd94bcac4582903765be7be959d1dbc121df0d0 (diff) |
After a crash, don't restart workers with BGW_NEVER_RESTART.
Amit Khandekar
-rw-r--r-- | src/backend/postmaster/bgworker.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/backend/postmaster/bgworker.c b/src/backend/postmaster/bgworker.c index cf7524f4921..99f4b65ea65 100644 --- a/src/backend/postmaster/bgworker.c +++ b/src/backend/postmaster/bgworker.c @@ -419,9 +419,9 @@ BackgroundWorkerStopNotifications(pid_t pid) /* * Reset background worker crash state. * - * We assume that, after a crash-and-restart cycle, background workers should - * be restarted immediately, instead of waiting for bgw_restart_time to - * elapse. + * We assume that, after a crash-and-restart cycle, background workers without + * the never-restart flag should be restarted immediately, instead of waiting + * for bgw_restart_time to elapse. */ void ResetBackgroundWorkerCrashTimes(void) @@ -433,7 +433,14 @@ ResetBackgroundWorkerCrashTimes(void) RegisteredBgWorker *rw; rw = slist_container(RegisteredBgWorker, rw_lnode, iter.cur); - rw->rw_crashed_at = 0; + + /* + * For workers that should not be restarted, we don't want to lose + * the information that they have crashed; otherwise, they would be + * restarted, which is wrong. + */ + if (rw->rw_worker.bgw_restart_time != BGW_NEVER_RESTART) + rw->rw_crashed_at = 0; } } |