From 0a21f244a417e2b77f5ec01c844b091a30ae052c Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Wed, 28 Jan 2009 22:51:44 +0200 Subject: [PATCH] Remove log_restartpoints, use log_checkpoints instead. Refactor "restartpoint/checkpoint starting" messages a bit, so that the flags are printed for restartpoints too. --- src/backend/access/transam/xlog.c | 55 +++++++++++++------------------ 1 file changed, 22 insertions(+), 33 deletions(-) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index d9972e8fab..302cfb6f4f 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -150,10 +150,6 @@ static bool recoveryTargetInclusive = true; static TransactionId recoveryTargetXid; static TimestampTz recoveryTargetTime; static TimestampTz recoveryLastXTime = 0; -/* - * log_restartpoints is stored in shared memory because it needs to be - * accessed by bgwriter when it performs restartpoints - */ /* if recoveryStopsHere returns true, it saves actual stop xid/time here */ static TransactionId recoveryStopXid; @@ -349,9 +345,6 @@ typedef struct XLogCtlData XLogRecPtr lastCheckPointRecPtr; CheckPoint lastCheckPoint; - /* Should restartpoints be logged? Taken from recovery.conf */ - bool recoveryLogRestartpoints; - slock_t info_lck; /* locks shared variables shown above */ } XLogCtlData; @@ -4659,18 +4652,6 @@ readRecoveryCommandFile(void) ereport(LOG, (errmsg("recovery_target_inclusive = %s", tok2))); } - else if (strcmp(tok1, "log_restartpoints") == 0) - { - /* - * does nothing if a recovery_target is not also set - */ - if (!parse_bool(tok2, &XLogCtl->recoveryLogRestartpoints)) - ereport(ERROR, - (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("parameter \"log_restartpoints\" requires a Boolean value"))); - ereport(LOG, - (errmsg("log_restartpoints = %s", tok2))); - } else ereport(FATAL, (errmsg("unrecognized recovery parameter \"%s\"", @@ -5852,18 +5833,26 @@ ShutdownXLOG(int code, Datum arg) static void LogCheckpointStart(int flags, bool restartpoint) { + char *msg; + + /* + * XXX: This is hopelessly untranslatable. We could call gettext_noop + * for the main message, but what about all the flags? + */ + if (restartpoint) - elog(LOG, "restartpoint starting:%s", - (flags & CHECKPOINT_IMMEDIATE) ? " immediate" : ""); + msg = "restartpoint starting:%s%s%s%s%s%s%s"; else - elog(LOG, "checkpoint starting:%s%s%s%s%s%s%s", - (flags & CHECKPOINT_IS_SHUTDOWN) ? " shutdown" : "", - (flags & CHECKPOINT_STARTUP) ? " startup" : "", - (flags & CHECKPOINT_IMMEDIATE) ? " immediate" : "", - (flags & CHECKPOINT_FORCE) ? " force" : "", - (flags & CHECKPOINT_WAIT) ? " wait" : "", - (flags & CHECKPOINT_CAUSE_XLOG) ? " xlog" : "", - (flags & CHECKPOINT_CAUSE_TIME) ? " time" : ""); + msg = "checkpoint starting:%s%s%s%s%s%s%s"; + + elog(LOG, msg, + (flags & CHECKPOINT_IS_SHUTDOWN) ? " shutdown" : "", + (flags & CHECKPOINT_STARTUP) ? " startup" : "", + (flags & CHECKPOINT_IMMEDIATE) ? " immediate" : "", + (flags & CHECKPOINT_FORCE) ? " force" : "", + (flags & CHECKPOINT_WAIT) ? " wait" : "", + (flags & CHECKPOINT_CAUSE_XLOG) ? " xlog" : "", + (flags & CHECKPOINT_CAUSE_TIME) ? " time" : ""); } /* @@ -6369,7 +6358,7 @@ CreateRestartPoint(int flags) return; } - if (XLogCtl->recoveryLogRestartpoints) + if (log_checkpoints) { /* * Prepare to accumulate statistics. @@ -6400,15 +6389,15 @@ CreateRestartPoint(int flags) */ /* All real work is done, but log before releasing lock. */ - if (XLogCtl->recoveryLogRestartpoints) + if (log_checkpoints) LogCheckpointEnd(flags, true); - ereport((XLogCtl->recoveryLogRestartpoints ? LOG : DEBUG2), + ereport((log_checkpoints ? LOG : DEBUG2), (errmsg("recovery restart point at %X/%X", lastCheckPoint.redo.xlogid, lastCheckPoint.redo.xrecoff))); if (recoveryLastXTime) - ereport((XLogCtl->recoveryLogRestartpoints ? LOG : DEBUG2), + ereport((log_checkpoints ? LOG : DEBUG2), (errmsg("last completed transaction was at log time %s", timestamptz_to_str(recoveryLastXTime)))); -- 2.39.5