Comment fixes. Don't try to skip AbsorbFsyncRequests in bgwriter when in
authorHeikki Linnakangas <[email protected]>
Wed, 18 Feb 2009 14:06:34 +0000 (16:06 +0200)
committerHeikki Linnakangas <[email protected]>
Wed, 18 Feb 2009 14:06:34 +0000 (16:06 +0200)
recovery. We do it elsewhere anyway, and it's a very inexpensive call.

src/backend/access/transam/xlog.c
src/backend/postmaster/bgwriter.c
src/backend/postmaster/postmaster.c
src/backend/storage/buffer/README
src/include/access/xlog.h
src/include/storage/pmsignal.h

index ebe68f3d9cf3f4c38911f4cc015f405bdf4653de..97fb14868a44f9c0960860506f4fb38f62195596 100644 (file)
@@ -1775,7 +1775,7 @@ XLogSetAsyncCommitLSN(XLogRecPtr asyncCommitLSN)
  * database is consistent. 
  * 
  * If 'force' is true, 'lsn' argument is ignored. Otherwise, minRecoveryPoint
- * is is only updated if it's already greater than or equal to 'lsn'.
+ * is is only updated if it's not already greater than or equal to 'lsn'.
  */
 static void
 UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force)
@@ -1802,8 +1802,8 @@ UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force)
                XLogRecPtr newMinRecoveryPoint;
 
                /*
-                * To avoid having to update the control file too often, we update
-                * it all the way to the last record being replayed, even though 'lsn'
+                * To avoid having to update the control file too often, we update it
+                * all the way to the last record being replayed, even though 'lsn'
                 * would suffice for correctness.
                 */
                SpinLockAcquire(&xlogctl->info_lck);
@@ -2747,8 +2747,8 @@ RestoreArchivedFile(char *path, const char *xlogfname,
        /*
         * Set in_restore_command to tell the signal handler that we should exit
         * right away on SIGTERM. We know that we're in a safe point to do that.
-        * Check if we had already received the signal, so that we don't miss
-        * shutdown request received just before this.
+        * Check if we had already received the signal, so that we don't miss a
+        * shutdown request received just before this.
         */
        in_restore_command = true;
        if (shutdown_requested)
@@ -6059,9 +6059,9 @@ CreateCheckPoint(int flags)
        /*
         * Acquire CheckpointLock to ensure only one checkpoint happens at a time.
         * During normal operation, bgwriter is the only process that creates
-        * checkpoints, but at the end archive recovery, the bgwriter can be busy
-        * creating a restartpoint while the startup process tries to perform the
-        * startup checkpoint.
+        * checkpoints, but at the end of archive recovery, the bgwriter can be
+        * busy creating a restartpoint while the startup process tries to perform
+        * the startup checkpoint.
         */
        if (!LWLockConditionalAcquire(CheckpointLock, LW_EXCLUSIVE))
        {
@@ -6620,8 +6620,8 @@ RequestXLogSwitch(void)
 /*
  * XLOG resource manager's routines
  *
- * Definitions of message info are in include/catalog/pg_control.h,
- * though not all messages relate to control file processing.
+ * Definitions of info values are in include/catalog/pg_control.h, though
+ * not all records types are related to control file processing.
  */
 void
 xlog_redo(XLogRecPtr lsn, XLogRecord *record)
index 45d61277bbd74c009e17b10b8f5447568671e8e1..d916f3242f1851f8ecb161ba28b0206a6365fe92 100644 (file)
@@ -618,8 +618,7 @@ BgWriterNap(void)
                (ckpt_active ? ImmediateCheckpointRequested() : checkpoint_requested))
                        break;
                pg_usleep(1000000L);
-               if (!RecoveryInProgress())
-                       AbsorbFsyncRequests();
+               AbsorbFsyncRequests();
                udelay -= 1000000L;
        }
 
index 721d8eae3f9cc57267fea6d2c61e3e9346e44b35..70d9ca246c4fee02b577782ffa57bf56ec232720 100644 (file)
@@ -276,6 +276,8 @@ static int  RecoveryStatus = NoRecovery;
  * states, nor in PM_SHUTDOWN states (because we don't enter those states
  * when trying to recover from a crash).  It can be true in PM_STARTUP state,
  * because we don't clear it until we've successfully started WAL redo.
+ * Similarly, RecoveryError means that we have crashed during recovery, and
+ * should not try to restart.
  */
 typedef enum
 {
@@ -2162,9 +2164,9 @@ reaper(SIGNAL_ARGS)
                        /*
                         * Check if we've received a signal from the startup process
                         * first. This can change pmState. If the startup process sends
-                        * a signal, and exits immediately after that, we might not have
-                        * processed the signal yet, and we need to know if it completed
-                        * recovery before exiting.
+                        * a signal and exits immediately after that, we might not have
+                        * processed the signal yet. We need to know if it completed
+                        * recovery before it exited.
                         */
                        CheckRecoverySignals();
 
index a7b81e37a710e65fba277ac465752c126d69886c..bfacfea0f1d2d997a4c1032ed2e1f12028173e07 100644 (file)
@@ -272,8 +272,4 @@ reasons mentioned under buffer access rules.
 As of 8.4, background writer starts during recovery mode when there is
 some form of potentially extended recovery to perform. It performs an
 identical service to normal processing, except that checkpoints it
-writes are technically restartpoints. Flushing outstanding WAL for dirty
-buffers is also skipped, though there shouldn't ever be new WAL entries
-at that time in any case. We could choose to start background writer
-immediately but we hold off until we can prove the database is in a 
-consistent state so that postmaster has a single, clean state change.
+writes are technically restartpoints.
index 71a15605611bd28bfc6f487d3339f4fe7e7612a1..f8720bbc2cdedfc090c13ed1644d85acdbed01cc 100644 (file)
@@ -133,9 +133,7 @@ typedef struct XLogRecData
 } XLogRecData;
 
 extern TimeLineID ThisTimeLineID;              /* current TLI */
-
-extern bool InRecovery;        
-                                                                               
+extern bool InRecovery;
 extern XLogRecPtr XactLastRecEnd;
 
 /* these variables are GUC parameters related to XLOG */
index 62dddfcf5e793cf4f89da1ed07451adc94e84145..21b1e90f5952a7fc359ce1dc3aa570bcc7c94430 100644 (file)
@@ -24,7 +24,7 @@ typedef enum
 {
        PMSIGNAL_RECOVERY_STARTED,      /* recovery has started */
        PMSIGNAL_RECOVERY_CONSISTENT, /* recovery has reached consistent state */
-       PMSIGNAL_RECOVERY_COMPLETED, /* recovery completed */
+       PMSIGNAL_RECOVERY_COMPLETED, /* recovery has completed */
        PMSIGNAL_PASSWORD_CHANGE,       /* pg_auth file has changed */
        PMSIGNAL_WAKEN_ARCHIVER,        /* send a NOTIFY signal to xlog archiver */
        PMSIGNAL_ROTATE_LOGFILE,        /* send SIGUSR1 to syslogger to rotate logfile */