Skip to content

Commit 1459e84

Browse files
committed
Don't auto-restart per-database autoprewarm workers.
We should try to prewarm each database only once. Otherwise, if prewarming fails for some reason, it will just keep retrying in an infnite loop. This can happen if, for example, the database has been dropped. The existing code was intended to implement the try-once behavior, but failed to do so because it neglected to set worker.bgw_restart_time to BGW_NEVER_RESTART. Mithun Cy, per a report from Hans Buschmann Discussion: http://postgr.es/m/CA+hUKGKpQJCWcgyy3QTC9vdn6uKAR_8r__A-MMm2GYfj45caag@mail.gmail.com
1 parent 6776142 commit 1459e84

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

contrib/pg_prewarm/autoprewarm.c

+1
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,7 @@ apw_start_database_worker(void)
840840
worker.bgw_flags =
841841
BGWORKER_SHMEM_ACCESS | BGWORKER_BACKEND_DATABASE_CONNECTION;
842842
worker.bgw_start_time = BgWorkerStart_ConsistentState;
843+
worker.bgw_restart_time = BGW_NEVER_RESTART;
843844
strcpy(worker.bgw_library_name, "pg_prewarm");
844845
strcpy(worker.bgw_function_name, "autoprewarm_database_main");
845846
strcpy(worker.bgw_name, "autoprewarm worker");

0 commit comments

Comments
 (0)