diff options
Diffstat (limited to 'src/backend/postmaster/autovacuum.c')
-rw-r--r-- | src/backend/postmaster/autovacuum.c | 49 |
1 files changed, 4 insertions, 45 deletions
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 062b1209051..a26eee25d46 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -64,7 +64,6 @@ #include <signal.h> #include <sys/types.h> #include <sys/time.h> -#include <time.h> #include <unistd.h> #include "access/heapam.h" @@ -383,12 +382,11 @@ StartAutoVacLauncher(void) #ifndef EXEC_BACKEND case 0: /* in postmaster child ... */ + InitPostmasterChild(); + /* Close the postmaster's sockets */ ClosePostmasterPorts(false); - /* Lose the postmaster's on-exit routines */ - on_exit_reset(); - AutoVacLauncherMain(0, NULL); break; #endif @@ -408,16 +406,8 @@ AutoVacLauncherMain(int argc, char *argv[]) { sigjmp_buf local_sigjmp_buf; - /* we are a postmaster subprocess now */ - IsUnderPostmaster = true; am_autovacuum_launcher = true; - /* reset MyProcPid */ - MyProcPid = getpid(); - - /* record Start Time for logging */ - MyStartTime = time(NULL); - /* Identify myself via ps */ init_ps_display("autovacuum launcher process", "", "", ""); @@ -430,17 +420,6 @@ AutoVacLauncherMain(int argc, char *argv[]) SetProcessingMode(InitProcessing); /* - * If possible, make this process a group leader, so that the postmaster - * can signal any child processes too. (autovacuum probably never has any - * child processes, but for consistency we make all postmaster child - * processes do this.) - */ -#ifdef HAVE_SETSID - if (setsid() < 0) - elog(FATAL, "setsid() failed: %m"); -#endif - - /* * Set up signal handlers. We operate on databases much like a regular * backend, so we use the same signal handling. See equivalent code in * tcop/postgres.c. @@ -1455,12 +1434,11 @@ StartAutoVacWorker(void) #ifndef EXEC_BACKEND case 0: /* in postmaster child ... */ + InitPostmasterChild(); + /* Close the postmaster's sockets */ ClosePostmasterPorts(false); - /* Lose the postmaster's on-exit routines */ - on_exit_reset(); - AutoVacWorkerMain(0, NULL); break; #endif @@ -1481,33 +1459,14 @@ AutoVacWorkerMain(int argc, char *argv[]) sigjmp_buf local_sigjmp_buf; Oid dbid; - /* we are a postmaster subprocess now */ - IsUnderPostmaster = true; am_autovacuum_worker = true; - /* reset MyProcPid */ - MyProcPid = getpid(); - - /* record Start Time for logging */ - MyStartTime = time(NULL); - /* Identify myself via ps */ init_ps_display("autovacuum worker process", "", "", ""); SetProcessingMode(InitProcessing); /* - * If possible, make this process a group leader, so that the postmaster - * can signal any child processes too. (autovacuum probably never has any - * child processes, but for consistency we make all postmaster child - * processes do this.) - */ -#ifdef HAVE_SETSID - if (setsid() < 0) - elog(FATAL, "setsid() failed: %m"); -#endif - - /* * Set up signal handlers. We operate on databases much like a regular * backend, so we use the same signal handling. See equivalent code in * tcop/postgres.c. |