From f3ebaad45b473f3a53de2cd2a5252cd653aa46f3 Mon Sep 17 00:00:00 2001 From: Simon Riggs Date: Tue, 1 Nov 2011 18:48:47 +0000 Subject: [PATCH] Comment changes to show bgwriter no longer performs checkpoints. --- src/backend/access/transam/xlog.c | 6 +++--- src/backend/commands/dbcommands.c | 8 ++++---- src/backend/postmaster/bgwriter.c | 9 ++------- src/backend/replication/README | 2 +- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 5fec88691a..a6aee9eb30 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -8001,8 +8001,8 @@ RecoveryRestartPoint(const CheckPoint *checkPoint) } /* - * Copy the checkpoint record to shared memory, so that bgwriter can use - * it the next time it wants to perform a restartpoint. + * Copy the checkpoint record to shared memory, so that checkpointer + * can work out the next time it wants to perform a restartpoint. */ SpinLockAcquire(&xlogctl->info_lck); XLogCtl->lastCheckPointRecPtr = ReadRecPtr; @@ -10151,7 +10151,7 @@ XLogPageRead(XLogRecPtr *RecPtr, int emode, bool fetching_ckpt, if (readFile >= 0 && !XLByteInSeg(*RecPtr, readId, readSeg)) { /* - * Signal bgwriter to start a restartpoint if we've replayed too much + * Request a restartpoint if we've replayed too much * xlog since the last one. */ if (StandbyMode && bgwriterLaunched) diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index 2c0581481b..4551db7fb0 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -847,7 +847,7 @@ dropdb(const char *dbname, bool missing_ok) pgstat_drop_database(db_id); /* - * Tell bgwriter to forget any pending fsync and unlink requests for files + * Tell checkpointer to forget any pending fsync and unlink requests for files * in the database; else the fsyncs will fail at next checkpoint, or * worse, it will delete files that belong to a newly created database * with the same OID. @@ -855,9 +855,9 @@ dropdb(const char *dbname, bool missing_ok) ForgetDatabaseFsyncRequests(db_id); /* - * Force a checkpoint to make sure the bgwriter has received the message + * Force a checkpoint to make sure the checkpointer has received the message * sent by ForgetDatabaseFsyncRequests. On Windows, this also ensures that - * the bgwriter doesn't hold any open files, which would cause rmdir() to + * background procs don't hold any open files, which would cause rmdir() to * fail. */ RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT); @@ -1088,7 +1088,7 @@ movedb(const char *dbname, const char *tblspcname) * process any pending unlink requests. Otherwise, the check for existing * files in the target directory might fail unnecessarily, not to mention * that the copy might fail due to source files getting deleted under it. - * On Windows, this also ensures that the bgwriter doesn't hold any open + * On Windows, this also ensures that background procs don't hold any open * files, which would cause rmdir() to fail. */ RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT); diff --git a/src/backend/postmaster/bgwriter.c b/src/backend/postmaster/bgwriter.c index 2841cdfc81..cacedab202 100644 --- a/src/backend/postmaster/bgwriter.c +++ b/src/backend/postmaster/bgwriter.c @@ -114,11 +114,6 @@ BackgroundWriterMain(void) /* * Properly accept or ignore signals the postmaster might send us * - * Note: we deliberately ignore SIGTERM, because during a standard Unix - * system shutdown cycle, init will SIGTERM all processes at once. We - * want to wait for the backends to exit, whereupon the postmaster will - * tell us it's okay to shut down (via SIGUSR2). - * * SIGUSR1 is presently unused; keep it spare in case someday we want this * process to participate in ProcSignal signalling. */ @@ -129,7 +124,7 @@ BackgroundWriterMain(void) pqsignal(SIGALRM, SIG_IGN); pqsignal(SIGPIPE, SIG_IGN); pqsignal(SIGUSR1, SIG_IGN); /* reserve for ProcSignal */ - pqsignal(SIGUSR2, SIG_IGN); /* request shutdown */ + pqsignal(SIGUSR2, SIG_IGN); /* * Reset some signals that are accepted by postmaster but not here @@ -359,7 +354,7 @@ BgSigHupHandler(SIGNAL_ARGS) got_SIGHUP = true; } -/* SIGUSR2: set flag to run a shutdown checkpoint and exit */ +/* SIGTERM: set flag to shutdown and exit */ static void ReqShutdownHandler(SIGNAL_ARGS) { diff --git a/src/backend/replication/README b/src/backend/replication/README index 7585429805..c227d054f9 100644 --- a/src/backend/replication/README +++ b/src/backend/replication/README @@ -68,7 +68,7 @@ that's not desirable for walsenders, because we want the standby servers to receive all the WAL, including the shutdown checkpoint, before the master is shut down. Therefore postmaster treats walsenders like the pgarch process, and instructs them to terminate at PM_SHUTDOWN_2 phase, after all regular -backends have died and bgwriter has written the shutdown checkpoint. +backends have died and checkpointer has issued the shutdown checkpoint. When postmaster accepts a connection, it immediately forks a new process to handle the handshake and authentication, and the process initializes to