*** pgsql/src/backend/postmaster/postmaster.c 2009/08/11 11:51:22 1.583.2.3 --- pgsql/src/backend/postmaster/postmaster.c 2009/08/24 17:23:17 1.583.2.4 *************** *** 37,43 **** * * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.583.2.2 2009/08/07 05:59:42 heikki Exp $ * * NOTES * --- 37,43 ---- * * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.583.2.3 2009/08/11 11:51:22 mha Exp $ * * NOTES * *************** bool redirection_done = false; /* stder *** 290,295 **** --- 290,297 ---- /* received START_AUTOVAC_LAUNCHER signal */ static volatile sig_atomic_t start_autovac_launcher = false; + /* the launcher needs to be signalled to communicate some condition */ + static volatile bool avlauncher_needs_signal = false; /* * State for assigning random salts and cancel keys. *************** ServerLoop(void) *** 1391,1396 **** --- 1393,1406 ---- if (PgStatPID == 0 && pmState == PM_RUN) PgStatPID = pgstat_start(); + /* If we need to signal the autovacuum launcher, do so now */ + if (avlauncher_needs_signal) + { + avlauncher_needs_signal = false; + if (AutoVacPID != 0) + kill(AutoVacPID, SIGUSR1); + } + /* * Touch the socket and lock file every 58 minutes, to ensure that * they are not removed by overzealous /tmp-cleaning tasks. We assume *************** BackendStartup(Port *port) *** 3014,3019 **** --- 3024,3030 ---- /* in parent, fork failed */ int save_errno = errno; + (void) ReleasePostmasterChildSlot(bn->child_slot); free(bn); errno = save_errno; ereport(LOG, *************** StartAutovacuumWorker(void) *** 4343,4348 **** --- 4354,4360 ---- * fork failed, fall through to report -- actual error message was * logged by StartAutoVacWorker */ + (void) ReleasePostmasterChildSlot(bn->child_slot); free(bn); } else *************** StartAutovacuumWorker(void) *** 4354,4365 **** /* * Report the failure to the launcher, if it's running. (If it's not, we * might not even be connected to shared memory, so don't try to call ! * AutoVacWorkerFailed.) */ if (AutoVacPID != 0) { AutoVacWorkerFailed(); ! kill(AutoVacPID, SIGUSR1); } } --- 4366,4381 ---- /* * Report the failure to the launcher, if it's running. (If it's not, we * might not even be connected to shared memory, so don't try to call ! * AutoVacWorkerFailed.) Note that we also need to signal it so that it ! * responds to the condition, but we don't do that here, instead waiting ! * for ServerLoop to do it. This way we avoid a ping-pong signalling in ! * quick succession between the autovac launcher and postmaster in case ! * things get ugly. */ if (AutoVacPID != 0) { AutoVacWorkerFailed(); ! avlauncher_needs_signal = true; } }