Reduce the chatter to the log when starting a standby server. Don't
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 12 Feb 2010 09:49:08 +0000 (09:49 +0000)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 12 Feb 2010 09:49:08 +0000 (09:49 +0000)
echo all the recovery.conf options. Don't emit the "initializing
recovery connections" message, which doesn't mean anything to a user.
Remove the "starting archive recovery" message and replace the
"automatic recovery in progress" message with a more informative message
saying whether the server is doing PITR, normal archive recovery, or
standby mode.

src/backend/access/transam/xlog.c

index 4da8df4b0dcb46de5e990a5987ebce1862a78eb4..e7b4516ee94228c2746ea1052de3561909efde76 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.372 2010/02/12 07:56:36 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.373 2010/02/12 09:49:08 heikki Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -4882,9 +4882,6 @@ readRecoveryCommandFile(void)
                        RECOVERY_COMMAND_FILE)));
    }
 
-   ereport(LOG,
-           (errmsg("starting archive recovery")));
-
    /*
     * Parse the file...
     */
@@ -4927,14 +4924,14 @@ readRecoveryCommandFile(void)
        if (strcmp(tok1, "restore_command") == 0)
        {
            recoveryRestoreCommand = pstrdup(tok2);
-           ereport(LOG,
+           ereport(DEBUG2,
                    (errmsg("restore_command = '%s'",
                            recoveryRestoreCommand)));
        }
        else if (strcmp(tok1, "recovery_end_command") == 0)
        {
            recoveryEndCommand = pstrdup(tok2);
-           ereport(LOG,
+           ereport(DEBUG2,
                    (errmsg("recovery_end_command = '%s'",
                            recoveryEndCommand)));
        }
@@ -4953,10 +4950,10 @@ readRecoveryCommandFile(void)
                                    tok2)));
            }
            if (rtli)
-               ereport(LOG,
+               ereport(DEBUG2,
                        (errmsg("recovery_target_timeline = %u", rtli)));
            else
-               ereport(LOG,
+               ereport(DEBUG2,
                        (errmsg("recovery_target_timeline = latest")));
        }
        else if (strcmp(tok1, "recovery_target_xid") == 0)
@@ -4967,7 +4964,7 @@ readRecoveryCommandFile(void)
                ereport(FATAL,
                 (errmsg("recovery_target_xid is not a valid number: \"%s\"",
                         tok2)));
-           ereport(LOG,
+           ereport(DEBUG2,
                    (errmsg("recovery_target_xid = %u",
                            recoveryTargetXid)));
            recoveryTarget = true;
@@ -4992,7 +4989,7 @@ readRecoveryCommandFile(void)
                                                        CStringGetDatum(tok2),
                                                ObjectIdGetDatum(InvalidOid),
                                                        Int32GetDatum(-1)));
-           ereport(LOG,
+           ereport(DEBUG2,
                    (errmsg("recovery_target_time = '%s'",
                            timestamptz_to_str(recoveryTargetTime))));
        }
@@ -5005,7 +5002,7 @@ readRecoveryCommandFile(void)
                ereport(ERROR,
                        (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                         errmsg("parameter \"recovery_target_inclusive\" requires a Boolean value")));
-           ereport(LOG,
+           ereport(DEBUG2,
                    (errmsg("recovery_target_inclusive = %s", tok2)));
        }
        else if (strcmp(tok1, "standby_mode") == 0)
@@ -5014,20 +5011,20 @@ readRecoveryCommandFile(void)
                ereport(ERROR,
                        (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                         errmsg("parameter \"standby_mode\" requires a Boolean value")));
-           ereport(LOG,
+           ereport(DEBUG2,
                    (errmsg("standby_mode = '%s'", tok2)));
        }
        else if (strcmp(tok1, "primary_conninfo") == 0)
        {
            PrimaryConnInfo = pstrdup(tok2);
-           ereport(LOG,
+           ereport(DEBUG2,
                    (errmsg("primary_conninfo = '%s'",
                            PrimaryConnInfo)));
        }
        else if (strcmp(tok1, "trigger_file") == 0)
        {
            TriggerFile = pstrdup(tok2);
-           ereport(LOG,
+           ereport(DEBUG2,
                    (errmsg("trigger_file = '%s'",
                            TriggerFile)));
        }
@@ -5649,8 +5646,23 @@ StartupXLOG(void)
         */
        if (InArchiveRecovery)
        {
-           ereport(LOG,
-                   (errmsg("automatic recovery in progress")));
+           if (StandbyMode)
+               ereport(LOG,
+                       (errmsg("entering standby mode")));
+           else if (recoveryTarget)
+           {
+               if (recoveryTargetExact)
+                   ereport(LOG,
+                           (errmsg("starting point-in-time recovery to XID %u",
+                                   recoveryTargetXid)));
+               else
+                   ereport(LOG,
+                           (errmsg("starting point-in-time recovery to %s",
+                                   timestamptz_to_str(recoveryTargetTime))));
+           }
+           else
+               ereport(LOG,
+                       (errmsg("starting archive recovery")));
            ControlFile->state = DB_IN_ARCHIVE_RECOVERY;
        }
        else
@@ -5718,8 +5730,8 @@ StartupXLOG(void)
 
            CheckRequiredParameterValues(checkPoint);
 
-           ereport(LOG,
-               (errmsg("initializing recovery connections")));
+           ereport(DEBUG1,
+                   (errmsg("initializing recovery connections")));
 
            InitRecoveryTransactionEnvironment();