diff options
author | Neil Conway <neilc@samurai.com> | 2004-01-06 17:26:23 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2004-01-06 17:26:23 +0000 |
commit | bc028beb166b704d3c3028961dd6905772bf3a2d (patch) | |
tree | 1820130965e4fa7e38bca860ec776bd0e1bab743 /src/backend | |
parent | b0c4a50bbbbd62c444cb3806a97c1e51e2249cfd (diff) | |
download | postgresql-bc028beb166b704d3c3028961dd6905772bf3a2d.tar.gz postgresql-bc028beb166b704d3c3028961dd6905772bf3a2d.zip |
Make the 'wal_debug' GUC variable a boolean (rather than an integer), and
hide it behind #ifdef WAL_DEBUG blocks.
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/access/transam/xlog.c | 18 | ||||
-rw-r--r-- | src/backend/utils/misc/guc.c | 33 |
2 files changed, 34 insertions, 17 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 1f8eb50795a..f630fca7d7e 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.129 2003/12/20 17:31:20 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.130 2004/01/06 17:26:23 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -86,12 +86,15 @@ /* User-settable parameters */ int CheckPointSegments = 3; int XLOGbuffers = 8; -int XLOG_DEBUG = 0; char *XLOG_sync_method = NULL; const char XLOG_sync_method_default[] = DEFAULT_SYNC_METHOD_STR; char XLOG_archive_dir[MAXPGPATH]; /* null string means * delete 'em */ +#ifdef WAL_DEBUG +bool XLOG_DEBUG = false; +#endif + /* * XLOGfileslop is used in the code as the allowed "fuzz" in the number of * preallocated XLOG segments --- we try to have at least XLOGfiles advance @@ -766,6 +769,7 @@ begin:; MyProc->logRec = RecPtr; } +#ifdef WAL_DEBUG if (XLOG_DEBUG) { char buf[8192]; @@ -779,6 +783,7 @@ begin:; } elog(LOG, "%s", buf); } +#endif /* Record begin of record in appropriate places */ if (!no_tran) @@ -1074,8 +1079,10 @@ XLogWrite(XLogwrtRqst WriteRqst) openLogSeg >= (RedoRecPtr.xrecoff / XLogSegSize) + (uint32) CheckPointSegments)) { +#ifdef WAL_DEBUG if (XLOG_DEBUG) elog(LOG, "time for a checkpoint, signaling postmaster"); +#endif SendPostmasterSignal(PMSIGNAL_DO_CHECKPOINT); } } @@ -1214,11 +1221,13 @@ XLogFlush(XLogRecPtr record) if (XLByteLE(record, LogwrtResult.Flush)) return; +#ifdef WAL_DEBUG if (XLOG_DEBUG) elog(LOG, "xlog flush request %X/%X; write %X/%X; flush %X/%X", record.xlogid, record.xrecoff, LogwrtResult.Write.xlogid, LogwrtResult.Write.xrecoff, LogwrtResult.Flush.xlogid, LogwrtResult.Flush.xrecoff); +#endif START_CRIT_SECTION(); @@ -2613,9 +2622,11 @@ StartupXLOG(void) /* This is just to allow attaching to startup process with a debugger */ #ifdef XLOG_REPLAY_DELAY +#ifdef WAL_DEBUG if (XLOG_DEBUG && ControlFile->state != DB_SHUTDOWNED) sleep(60); #endif +#endif /* * Get the last valid checkpoint record. If the latest one according @@ -2742,6 +2753,8 @@ StartupXLOG(void) ShmemVariableCache->nextXid = record->xl_xid; TransactionIdAdvance(ShmemVariableCache->nextXid); } + +#ifdef WAL_DEBUG if (XLOG_DEBUG) { char buf[8192]; @@ -2755,6 +2768,7 @@ StartupXLOG(void) record->xl_info, XLogRecGetData(record)); elog(LOG, "%s", buf); } +#endif if (record->xl_info & XLR_BKP_BLOCK_MASK) RestoreBkpBlocks(record, EndRecPtr); diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 705dd166e4a..f0a0a88dd60 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -10,7 +10,7 @@ * Written by Peter Eisentraut <peter_e@gmx.net>. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.175 2003/12/03 18:52:00 joe Exp $ + * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.176 2004/01/06 17:26:23 neilc Exp $ * *-------------------------------------------------------------------- */ @@ -336,17 +336,18 @@ const char *const config_type_names[] = * TO ADD AN OPTION: * * 1. Declare a global variable of type bool, int, double, or char* - * and make use of it. + * and make use of it. * * 2. Decide at what times it's safe to set the option. See guc.h for - * details. + * details. * * 3. Decide on a name, a default value, upper and lower bounds (if - * applicable), etc. + * applicable), etc. * * 4. Add a record below. * - * 5. Add it to src/backend/utils/misc/postgresql.conf.sample. + * 5. Add it to src/backend/utils/misc/postgresql.conf.sample, if + * appropriate * * 6. Add it to src/bin/psql/tab-complete.c, if it's a USERSET option. * @@ -862,6 +863,18 @@ static struct config_bool ConfigureNamesBool[] = #endif }, +#ifdef WAL_DEBUG + { + {"wal_debug", PGC_SUSET, DEVELOPER_OPTIONS, + gettext_noop("Emit WAL-related debugging output."), + NULL, + GUC_NOT_IN_SAMPLE + }, + &XLOG_DEBUG, + false, NULL, NULL + }, +#endif + /* End-of-list marker */ { {NULL, 0, 0, NULL, NULL}, NULL, false, NULL, NULL @@ -1172,16 +1185,6 @@ static struct config_int ConfigureNamesInt[] = }, { - {"wal_debug", PGC_SUSET, DEVELOPER_OPTIONS, - gettext_noop("If nonzero, WAL-related debugging output is logged."), - NULL, - GUC_NOT_IN_SAMPLE - }, - &XLOG_DEBUG, - 0, 0, 16, NULL, NULL - }, - - { {"commit_delay", PGC_USERSET, WAL_CHECKPOINTS, gettext_noop("Sets the delay in microseconds between transaction commit and " "flushing WAL to disk."), |