summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2015-04-02 14:38:06 -0400
committerRobert Haas <rhaas@postgresql.org>2015-04-02 14:39:18 -0400
commita1f4ade01ca625332a43434061f1b72788cb71e2 (patch)
tree2d791f5f3bc071bcb4599896574b4fafb736fd70 /src
parent3ebe6d895624b0c2820a0043929250beaf3e6d8b (diff)
After a crash, don't restart workers with BGW_NEVER_RESTART.
Amit Khandekar
Diffstat (limited to 'src')
-rw-r--r--src/backend/postmaster/bgworker.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/backend/postmaster/bgworker.c b/src/backend/postmaster/bgworker.c
index c22066fad2a..87347c3f3ea 100644
--- a/src/backend/postmaster/bgworker.c
+++ b/src/backend/postmaster/bgworker.c
@@ -420,9 +420,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)
@@ -434,7 +434,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;
}
}