diff options
author | Bruce Momjian <bruce@momjian.us> | 2006-10-04 00:30:14 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2006-10-04 00:30:14 +0000 |
commit | f99a569a2ee3763b4ae174e81250c95ca0fdcbb6 (patch) | |
tree | 76e6371fe8b347c73d7020c0bc54b9fba519dc10 /src/backend/access/transam | |
parent | 451e419e9852cdf9d7e7cefc09d5355abb3405e9 (diff) | |
download | postgresql-f99a569a2ee3763b4ae174e81250c95ca0fdcbb6.tar.gz postgresql-f99a569a2ee3763b4ae174e81250c95ca0fdcbb6.zip |
pgindent run for 8.2.
Diffstat (limited to 'src/backend/access/transam')
-rw-r--r-- | src/backend/access/transam/clog.c | 4 | ||||
-rw-r--r-- | src/backend/access/transam/multixact.c | 12 | ||||
-rw-r--r-- | src/backend/access/transam/slru.c | 38 | ||||
-rw-r--r-- | src/backend/access/transam/twophase.c | 6 | ||||
-rw-r--r-- | src/backend/access/transam/varsup.c | 14 | ||||
-rw-r--r-- | src/backend/access/transam/xact.c | 32 | ||||
-rw-r--r-- | src/backend/access/transam/xlog.c | 244 | ||||
-rw-r--r-- | src/backend/access/transam/xlogutils.c | 8 |
8 files changed, 179 insertions, 179 deletions
diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c index 0621d3bc604..f57bdefa3a0 100644 --- a/src/backend/access/transam/clog.c +++ b/src/backend/access/transam/clog.c @@ -24,7 +24,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/access/transam/clog.c,v 1.39 2006/07/13 16:49:12 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/clog.c,v 1.40 2006/10/04 00:29:49 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -414,7 +414,7 @@ clog_redo(XLogRecPtr lsn, XLogRecord *record) void clog_desc(StringInfo buf, uint8 xl_info, char *rec) { - uint8 info = xl_info & ~XLR_INFO_MASK; + uint8 info = xl_info & ~XLR_INFO_MASK; if (info == CLOG_ZEROPAGE) { diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c index ae5272286a2..167d65fd2d7 100644 --- a/src/backend/access/transam/multixact.c +++ b/src/backend/access/transam/multixact.c @@ -42,7 +42,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/access/transam/multixact.c,v 1.20 2006/07/20 00:46:42 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/multixact.c,v 1.21 2006/10/04 00:29:49 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -1493,10 +1493,10 @@ CheckPointMultiXact(void) /* * Truncate the SLRU files. This could be done at any time, but - * checkpoint seems a reasonable place for it. There is one exception: - * if we are called during xlog recovery, then shared->latest_page_number - * isn't valid (because StartupMultiXact hasn't been called yet) and - * so SimpleLruTruncate would get confused. It seems best not to risk + * checkpoint seems a reasonable place for it. There is one exception: if + * we are called during xlog recovery, then shared->latest_page_number + * isn't valid (because StartupMultiXact hasn't been called yet) and so + * SimpleLruTruncate would get confused. It seems best not to risk * removing any data during recovery anyway, so don't truncate. */ if (!InRecovery) @@ -1917,7 +1917,7 @@ multixact_desc(StringInfo buf, uint8 xl_info, char *rec) int i; appendStringInfo(buf, "create multixact %u offset %u:", - xlrec->mid, xlrec->moff); + xlrec->mid, xlrec->moff); for (i = 0; i < xlrec->nxids; i++) appendStringInfo(buf, " %u", xlrec->xids[i]); } diff --git a/src/backend/access/transam/slru.c b/src/backend/access/transam/slru.c index 7c3884628be..08bb3598ac9 100644 --- a/src/backend/access/transam/slru.c +++ b/src/backend/access/transam/slru.c @@ -41,7 +41,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/access/transam/slru.c,v 1.38 2006/07/14 14:52:17 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/slru.c,v 1.39 2006/10/04 00:29:49 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -92,8 +92,8 @@ typedef struct SlruFlushData { - int num_files; /* # files actually open */ - int fd[MAX_FLUSH_BUFFERS]; /* their FD's */ + int num_files; /* # files actually open */ + int fd[MAX_FLUSH_BUFFERS]; /* their FD's */ int segno[MAX_FLUSH_BUFFERS]; /* their log seg#s */ } SlruFlushData; @@ -113,7 +113,7 @@ typedef struct SlruFlushData * page_lru_count entries to be "reset" to lower values than they should have, * in case a process is delayed while it executes this macro. With care in * SlruSelectLRUPage(), this does little harm, and in any case the absolute - * worst possible consequence is a nonoptimal choice of page to evict. The + * worst possible consequence is a nonoptimal choice of page to evict. The * gain from allowing concurrent reads of SLRU pages seems worth it. */ #define SlruRecentlyUsed(shared, slotno) \ @@ -158,13 +158,13 @@ SimpleLruShmemSize(int nslots) /* we assume nslots isn't so large as to risk overflow */ sz = MAXALIGN(sizeof(SlruSharedData)); - sz += MAXALIGN(nslots * sizeof(char *)); /* page_buffer[] */ + sz += MAXALIGN(nslots * sizeof(char *)); /* page_buffer[] */ sz += MAXALIGN(nslots * sizeof(SlruPageStatus)); /* page_status[] */ - sz += MAXALIGN(nslots * sizeof(bool)); /* page_dirty[] */ - sz += MAXALIGN(nslots * sizeof(int)); /* page_number[] */ - sz += MAXALIGN(nslots * sizeof(int)); /* page_lru_count[] */ - sz += MAXALIGN(nslots * sizeof(LWLockId)); /* buffer_locks[] */ - + sz += MAXALIGN(nslots * sizeof(bool)); /* page_dirty[] */ + sz += MAXALIGN(nslots * sizeof(int)); /* page_number[] */ + sz += MAXALIGN(nslots * sizeof(int)); /* page_lru_count[] */ + sz += MAXALIGN(nslots * sizeof(LWLockId)); /* buffer_locks[] */ + return BUFFERALIGN(sz) + BLCKSZ * nslots; } @@ -653,9 +653,9 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata) * Easiest way to deal with that is to accept references to * nonexistent files here and in SlruPhysicalReadPage.) * - * Note: it is possible for more than one backend to be executing - * this code simultaneously for different pages of the same file. - * Hence, don't use O_EXCL or O_TRUNC or anything like that. + * Note: it is possible for more than one backend to be executing this + * code simultaneously for different pages of the same file. Hence, + * don't use O_EXCL or O_TRUNC or anything like that. */ SlruFileName(ctl, path, segno); fd = BasicOpenFile(path, O_RDWR | O_CREAT | PG_BINARY, @@ -759,22 +759,22 @@ SlruReportIOError(SlruCtl ctl, int pageno, TransactionId xid) ereport(ERROR, (errcode_for_file_access(), errmsg("could not access status of transaction %u", xid), - errdetail("Could not seek in file \"%s\" to offset %u: %m.", - path, offset))); + errdetail("Could not seek in file \"%s\" to offset %u: %m.", + path, offset))); break; case SLRU_READ_FAILED: ereport(ERROR, (errcode_for_file_access(), errmsg("could not access status of transaction %u", xid), - errdetail("Could not read from file \"%s\" at offset %u: %m.", - path, offset))); + errdetail("Could not read from file \"%s\" at offset %u: %m.", + path, offset))); break; case SLRU_WRITE_FAILED: ereport(ERROR, (errcode_for_file_access(), errmsg("could not access status of transaction %u", xid), - errdetail("Could not write to file \"%s\" at offset %u: %m.", - path, offset))); + errdetail("Could not write to file \"%s\" at offset %u: %m.", + path, offset))); break; case SLRU_FSYNC_FAILED: ereport(ERROR, diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c index 6c37d097fc2..bd0b9b131e6 100644 --- a/src/backend/access/transam/twophase.c +++ b/src/backend/access/transam/twophase.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.23 2006/10/03 21:21:35 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.24 2006/10/04 00:29:49 momjian Exp $ * * NOTES * Each global transaction is associated with a global transaction @@ -1250,8 +1250,8 @@ RemoveTwoPhaseFile(TransactionId xid, bool giveWarning) if (errno != ENOENT || giveWarning) ereport(WARNING, (errcode_for_file_access(), - errmsg("could not remove twophase state file \"%s\": %m", - path))); + errmsg("could not remove twophase state file \"%s\": %m", + path))); } /* diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c index 101f065489f..04e9840cb5d 100644 --- a/src/backend/access/transam/varsup.c +++ b/src/backend/access/transam/varsup.c @@ -6,7 +6,7 @@ * Copyright (c) 2000-2006, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/transam/varsup.c,v 1.74 2006/09/26 17:21:39 alvherre Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/varsup.c,v 1.75 2006/10/04 00:29:49 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -133,10 +133,10 @@ GetNewTransactionId(bool isSubXact) { /* * Use volatile pointer to prevent code rearrangement; other backends - * could be examining my subxids info concurrently, and we don't - * want them to see an invalid intermediate state, such as - * incrementing nxids before filling the array entry. Note we are - * assuming that TransactionId and int fetch/store are atomic. + * could be examining my subxids info concurrently, and we don't want + * them to see an invalid intermediate state, such as incrementing + * nxids before filling the array entry. Note we are assuming that + * TransactionId and int fetch/store are atomic. */ volatile PGPROC *myproc = MyProc; @@ -144,7 +144,7 @@ GetNewTransactionId(bool isSubXact) myproc->xid = xid; else { - int nxids = myproc->subxids.nxids; + int nxids = myproc->subxids.nxids; if (nxids < PGPROC_MAX_CACHED_SUBXIDS) { @@ -196,7 +196,7 @@ SetTransactionIdLimit(TransactionId oldest_datminxid, * The place where we actually get into deep trouble is halfway around * from the oldest existing XID. (This calculation is probably off by one * or two counts, because the special XIDs reduce the size of the loop a - * little bit. But we throw in plenty of slop below, so it doesn't + * little bit. But we throw in plenty of slop below, so it doesn't * matter.) */ xidWrapLimit = oldest_datminxid + (MaxTransactionId >> 1); diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 6fda0ce1f97..8e1724989cb 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.226 2006/08/27 19:11:46 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.227 2006/10/04 00:29:49 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -1376,12 +1376,12 @@ StartTransaction(void) XactLockTableInsert(s->transactionId); - PG_TRACE1 (transaction__start, s->transactionId); + PG_TRACE1(transaction__start, s->transactionId); /* - * set transaction_timestamp() (a/k/a now()). We want this to be the - * same as the first command's statement_timestamp(), so don't do a - * fresh GetCurrentTimestamp() call (which'd be expensive anyway). + * set transaction_timestamp() (a/k/a now()). We want this to be the same + * as the first command's statement_timestamp(), so don't do a fresh + * GetCurrentTimestamp() call (which'd be expensive anyway). */ xactStartTimestamp = stmtStartTimestamp; @@ -1521,7 +1521,7 @@ CommitTransaction(void) LWLockAcquire(ProcArrayLock, LW_EXCLUSIVE); MyProc->xid = InvalidTransactionId; MyProc->xmin = InvalidTransactionId; - MyProc->inVacuum = false; /* must be cleared with xid/xmin */ + MyProc->inVacuum = false; /* must be cleared with xid/xmin */ /* Clear the subtransaction-XID cache too while holding the lock */ MyProc->subxids.nxids = 0; @@ -1530,7 +1530,7 @@ CommitTransaction(void) LWLockRelease(ProcArrayLock); } - PG_TRACE1 (transaction__commit, s->transactionId); + PG_TRACE1(transaction__commit, s->transactionId); /* * This is all post-commit cleanup. Note that if an error is raised here, @@ -1921,7 +1921,7 @@ AbortTransaction(void) LWLockAcquire(ProcArrayLock, LW_EXCLUSIVE); MyProc->xid = InvalidTransactionId; MyProc->xmin = InvalidTransactionId; - MyProc->inVacuum = false; /* must be cleared with xid/xmin */ + MyProc->inVacuum = false; /* must be cleared with xid/xmin */ /* Clear the subtransaction-XID cache too while holding the lock */ MyProc->subxids.nxids = 0; @@ -1930,7 +1930,7 @@ AbortTransaction(void) LWLockRelease(ProcArrayLock); } - PG_TRACE1 (transaction__abort, s->transactionId); + PG_TRACE1(transaction__abort, s->transactionId); /* * Post-abort cleanup. See notes in CommitTransaction() concerning @@ -4206,8 +4206,8 @@ xact_desc_commit(StringInfo buf, xl_xact_commit *xlrec) int i; appendStringInfo(buf, "%04u-%02u-%02u %02u:%02u:%02u", - tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, - tm->tm_hour, tm->tm_min, tm->tm_sec); + tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec); if (xlrec->nrels > 0) { appendStringInfo(buf, "; rels:"); @@ -4216,7 +4216,7 @@ xact_desc_commit(StringInfo buf, xl_xact_commit *xlrec) RelFileNode rnode = xlrec->xnodes[i]; appendStringInfo(buf, " %u/%u/%u", - rnode.spcNode, rnode.dbNode, rnode.relNode); + rnode.spcNode, rnode.dbNode, rnode.relNode); } } if (xlrec->nsubxacts > 0) @@ -4237,8 +4237,8 @@ xact_desc_abort(StringInfo buf, xl_xact_abort *xlrec) int i; appendStringInfo(buf, "%04u-%02u-%02u %02u:%02u:%02u", - tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, - tm->tm_hour, tm->tm_min, tm->tm_sec); + tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec); if (xlrec->nrels > 0) { appendStringInfo(buf, "; rels:"); @@ -4247,7 +4247,7 @@ xact_desc_abort(StringInfo buf, xl_xact_abort *xlrec) RelFileNode rnode = xlrec->xnodes[i]; appendStringInfo(buf, " %u/%u/%u", - rnode.spcNode, rnode.dbNode, rnode.relNode); + rnode.spcNode, rnode.dbNode, rnode.relNode); } } if (xlrec->nsubxacts > 0) @@ -4264,7 +4264,7 @@ xact_desc_abort(StringInfo buf, xl_xact_abort *xlrec) void xact_desc(StringInfo buf, uint8 xl_info, char *rec) { - uint8 info = xl_info & ~XLR_INFO_MASK; + uint8 info = xl_info & ~XLR_INFO_MASK; if (info == XLOG_XACT_COMMIT) { diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 16fb6b5e5e8..7b5780b66da 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.249 2006/08/21 16:16:31 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.250 2006/10/04 00:29:49 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -349,9 +349,9 @@ typedef struct XLogCtlInsert */ typedef struct XLogCtlWrite { - XLogwrtResult LogwrtResult; /* current value of LogwrtResult */ - int curridx; /* cache index of next block to write */ - time_t lastSegSwitchTime; /* time of last xlog segment switch */ + XLogwrtResult LogwrtResult; /* current value of LogwrtResult */ + int curridx; /* cache index of next block to write */ + time_t lastSegSwitchTime; /* time of last xlog segment switch */ } XLogCtlWrite; /* @@ -481,7 +481,7 @@ static bool InstallXLogFileSegment(uint32 *log, uint32 *seg, char *tmppath, bool use_lock); static int XLogFileOpen(uint32 log, uint32 seg); static int XLogFileRead(uint32 log, uint32 seg, int emode); -static void XLogFileClose(void); +static void XLogFileClose(void); static bool RestoreArchivedFile(char *path, const char *xlogfname, const char *recovername, off_t expectedSize); static int PreallocXlogFiles(XLogRecPtr endptr); @@ -506,7 +506,7 @@ static void issue_xlog_fsync(void); static void xlog_outrec(StringInfo buf, XLogRecord *record); #endif static bool read_backup_label(XLogRecPtr *checkPointLoc, - XLogRecPtr *minRecoveryLoc); + XLogRecPtr *minRecoveryLoc); static void rm_redo_error_callback(void *arg); @@ -697,9 +697,9 @@ begin:; /* * NOTE: We disallow len == 0 because it provides a useful bit of extra * error checking in ReadRecord. This means that all callers of - * XLogInsert must supply at least some not-in-a-buffer data. However, - * we make an exception for XLOG SWITCH records because we don't want - * them to ever cross a segment boundary. + * XLogInsert must supply at least some not-in-a-buffer data. However, we + * make an exception for XLOG SWITCH records because we don't want them to + * ever cross a segment boundary. */ if (len == 0 && !isLogSwitch) elog(PANIC, "invalid xlog record length %u", len); @@ -752,8 +752,8 @@ begin:; * checkpoint, so it's better to be slow in this case and fast otherwise. * * If we aren't doing full-page writes then RedoRecPtr doesn't actually - * affect the contents of the XLOG record, so we'll update our local - * copy but not force a recomputation. + * affect the contents of the XLOG record, so we'll update our local copy + * but not force a recomputation. */ if (!XLByteEQ(RedoRecPtr, Insert->RedoRecPtr)) { @@ -782,10 +782,10 @@ begin:; } /* - * Also check to see if forcePageWrites was just turned on; if we - * weren't already doing full-page writes then go back and recompute. - * (If it was just turned off, we could recompute the record without - * full pages, but we choose not to bother.) + * Also check to see if forcePageWrites was just turned on; if we weren't + * already doing full-page writes then go back and recompute. (If it was + * just turned off, we could recompute the record without full pages, but + * we choose not to bother.) */ if (Insert->forcePageWrites && !doPageWrites) { @@ -870,11 +870,11 @@ begin:; INSERT_RECPTR(RecPtr, Insert, curridx); /* - * If the record is an XLOG_SWITCH, and we are exactly at the start - * of a segment, we need not insert it (and don't want to because - * we'd like consecutive switch requests to be no-ops). Instead, - * make sure everything is written and flushed through the end of - * the prior segment, and return the prior segment's end address. + * If the record is an XLOG_SWITCH, and we are exactly at the start of a + * segment, we need not insert it (and don't want to because we'd like + * consecutive switch requests to be no-ops). Instead, make sure + * everything is written and flushed through the end of the prior segment, + * and return the prior segment's end address. */ if (isLogSwitch && (RecPtr.xrecoff % XLogSegSize) == SizeOfXLogLongPHD) @@ -926,7 +926,7 @@ begin:; #ifdef WAL_DEBUG if (XLOG_DEBUG) { - StringInfoData buf; + StringInfoData buf; initStringInfo(&buf); appendStringInfo(&buf, "INSERT @ %X/%X: ", @@ -1019,8 +1019,8 @@ begin:; LWLockAcquire(WALWriteLock, LW_EXCLUSIVE); /* - * Flush through the end of the page containing XLOG_SWITCH, - * and perform end-of-segment actions (eg, notifying archiver). + * Flush through the end of the page containing XLOG_SWITCH, and + * perform end-of-segment actions (eg, notifying archiver). */ WriteRqst = XLogCtl->xlblocks[curridx]; FlushRqst.Write = WriteRqst; @@ -1667,8 +1667,8 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible, bool xlog_switch) * switch. * * This is also the right place to notify the Archiver that the - * segment is ready to copy to archival storage, and to update - * the timer for archive_timeout. + * segment is ready to copy to archival storage, and to update the + * timer for archive_timeout. */ if (finishing_seg || (xlog_switch && last_iteration)) { @@ -2300,36 +2300,35 @@ XLogFileClose(void) Assert(openLogFile >= 0); /* - * posix_fadvise is problematic on many platforms: on older x86 Linux - * it just dumps core, and there are reports of problems on PPC platforms - * as well. The following is therefore disabled for the time being. - * We could consider some kind of configure test to see if it's safe to - * use, but since we lack hard evidence that there's any useful performance - * gain to be had, spending time on that seems unprofitable for now. + * posix_fadvise is problematic on many platforms: on older x86 Linux it + * just dumps core, and there are reports of problems on PPC platforms as + * well. The following is therefore disabled for the time being. We could + * consider some kind of configure test to see if it's safe to use, but + * since we lack hard evidence that there's any useful performance gain to + * be had, spending time on that seems unprofitable for now. */ #ifdef NOT_USED /* * WAL segment files will not be re-read in normal operation, so we advise - * OS to release any cached pages. But do not do so if WAL archiving is + * OS to release any cached pages. But do not do so if WAL archiving is * active, because archiver process could use the cache to read the WAL * segment. * - * While O_DIRECT works for O_SYNC, posix_fadvise() works for fsync() - * and O_SYNC, and some platforms only have posix_fadvise(). + * While O_DIRECT works for O_SYNC, posix_fadvise() works for fsync() and + * O_SYNC, and some platforms only have posix_fadvise(). */ #if defined(HAVE_DECL_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED) if (!XLogArchivingActive()) posix_fadvise(openLogFile, 0, 0, POSIX_FADV_DONTNEED); #endif - -#endif /* NOT_USED */ +#endif /* NOT_USED */ if (close(openLogFile)) ereport(PANIC, - (errcode_for_file_access(), - errmsg("could not close log file %u, segment %u: %m", - openLogId, openLogSeg))); + (errcode_for_file_access(), + errmsg("could not close log file %u, segment %u: %m", + openLogId, openLogSeg))); openLogFile = -1; } @@ -2978,8 +2977,8 @@ ReadRecord(XLogRecPtr *RecPtr, int emode) got_record:; /* - * xl_len == 0 is bad data for everything except XLOG SWITCH, where - * it is required. + * xl_len == 0 is bad data for everything except XLOG SWITCH, where it is + * required. */ if (record->xl_rmid == RM_XLOG_ID && record->xl_info == XLOG_SWITCH) { @@ -3168,6 +3167,7 @@ got_record:; EndRecPtr.xrecoff = RecPtr->xrecoff + MAXALIGN(total_len); ReadRecPtr = *RecPtr; memcpy(buffer, record, total_len); + /* * Special processing if it's an XLOG SWITCH record */ @@ -3177,10 +3177,11 @@ got_record:; EndRecPtr.xrecoff += XLogSegSize - 1; EndRecPtr.xrecoff -= EndRecPtr.xrecoff % XLogSegSize; nextRecord = NULL; /* definitely not on same page */ + /* - * Pretend that readBuf contains the last page of the segment. - * This is just to avoid Assert failure in StartupXLOG if XLOG - * ends with this segment. + * Pretend that readBuf contains the last page of the segment. This is + * just to avoid Assert failure in StartupXLOG if XLOG ends with this + * segment. */ readOff = XLogSegSize - XLOG_BLCKSZ; } @@ -3661,7 +3662,7 @@ static void WriteControlFile(void) { int fd; - char buffer[PG_CONTROL_SIZE]; /* need not be aligned */ + char buffer[PG_CONTROL_SIZE]; /* need not be aligned */ char *localeptr; /* @@ -3846,9 +3847,9 @@ ReadControlFile(void) if (ControlFile->xlog_blcksz != XLOG_BLCKSZ) ereport(FATAL, (errmsg("database files are incompatible with server"), - errdetail("The database cluster was initialized with XLOG_BLCKSZ %d," - " but the server was compiled with XLOG_BLCKSZ %d.", - ControlFile->xlog_blcksz, XLOG_BLCKSZ), + errdetail("The database cluster was initialized with XLOG_BLCKSZ %d," + " but the server was compiled with XLOG_BLCKSZ %d.", + ControlFile->xlog_blcksz, XLOG_BLCKSZ), errhint("It looks like you need to recompile or initdb."))); if (ControlFile->xlog_seg_size != XLOG_SEG_SIZE) ereport(FATAL, @@ -4027,7 +4028,7 @@ XLOGShmemInit(void) * Do basic initialization of XLogCtl shared data. (StartupXLOG will fill * in additional info.) */ - XLogCtl->XLogCacheByte = (Size) XLOG_BLCKSZ * XLOGbuffers; + XLogCtl->XLogCacheByte = (Size) XLOG_BLCKSZ *XLOGbuffers; XLogCtl->XLogCacheBlck = XLOGbuffers - 1; XLogCtl->Insert.currpage = (XLogPageHeader) (XLogCtl->pages); @@ -4649,10 +4650,10 @@ StartupXLOG(void) " you will have to use the last backup for recovery."))); else if (ControlFile->state == DB_IN_ARCHIVE_RECOVERY) ereport(LOG, - (errmsg("database system was interrupted while in recovery at log time %s", - str_time(ControlFile->checkPointCopy.time)), - errhint("If this has occurred more than once some data may be corrupted" - " and you may need to choose an earlier recovery target."))); + (errmsg("database system was interrupted while in recovery at log time %s", + str_time(ControlFile->checkPointCopy.time)), + errhint("If this has occurred more than once some data may be corrupted" + " and you may need to choose an earlier recovery target."))); else if (ControlFile->state == DB_IN_PRODUCTION) ereport(LOG, (errmsg("database system was interrupted at %s", @@ -4812,10 +4813,10 @@ StartupXLOG(void) int rmid; /* - * Update pg_control to show that we are recovering and to show - * the selected checkpoint as the place we are starting from. - * We also mark pg_control with any minimum recovery stop point - * obtained from a backup history file. + * Update pg_control to show that we are recovering and to show the + * selected checkpoint as the place we are starting from. We also mark + * pg_control with any minimum recovery stop point obtained from a + * backup history file. */ if (InArchiveRecovery) { @@ -4839,12 +4840,12 @@ StartupXLOG(void) UpdateControlFile(); /* - * If there was a backup label file, it's done its job and the - * info has now been propagated into pg_control. We must get rid of - * the label file so that if we crash during recovery, we'll pick up - * at the latest recovery restartpoint instead of going all the way - * back to the backup start point. It seems prudent though to just - * rename the file out of the way rather than delete it completely. + * If there was a backup label file, it's done its job and the info + * has now been propagated into pg_control. We must get rid of the + * label file so that if we crash during recovery, we'll pick up at + * the latest recovery restartpoint instead of going all the way back + * to the backup start point. It seems prudent though to just rename + * the file out of the way rather than delete it completely. */ if (haveBackupLabel) { @@ -4884,7 +4885,7 @@ StartupXLOG(void) { bool recoveryContinue = true; bool recoveryApply = true; - ErrorContextCallback errcontext; + ErrorContextCallback errcontext; InRedo = true; ereport(LOG, @@ -4899,17 +4900,17 @@ StartupXLOG(void) #ifdef WAL_DEBUG if (XLOG_DEBUG) { - StringInfoData buf; + StringInfoData buf; initStringInfo(&buf); appendStringInfo(&buf, "REDO @ %X/%X; LSN %X/%X: ", - ReadRecPtr.xlogid, ReadRecPtr.xrecoff, - EndRecPtr.xlogid, EndRecPtr.xrecoff); + ReadRecPtr.xlogid, ReadRecPtr.xrecoff, + EndRecPtr.xlogid, EndRecPtr.xrecoff); xlog_outrec(&buf, record); appendStringInfo(&buf, " - "); RmgrTable[record->xl_rmid].rm_desc(&buf, record->xl_info, - XLogRecGetData(record)); + XLogRecGetData(record)); elog(LOG, "%s", buf.data); pfree(buf.data); } @@ -5383,9 +5384,9 @@ GetRecentNextXid(void) void GetNextXidAndEpoch(TransactionId *xid, uint32 *epoch) { - uint32 ckptXidEpoch; - TransactionId ckptXid; - TransactionId nextXid; + uint32 ckptXidEpoch; + TransactionId ckptXid; + TransactionId nextXid; /* Must read checkpoint info first, else have race condition */ { @@ -5718,7 +5719,7 @@ CheckPointGuts(XLogRecPtr checkPointRedo) CheckPointCLOG(); CheckPointSUBTRANS(); CheckPointMultiXact(); - FlushBufferPool(); /* performs all required fsyncs */ + FlushBufferPool(); /* performs all required fsyncs */ /* We deliberately delay 2PC checkpointing as long as possible */ CheckPointTwoPhase(checkPointRedo); } @@ -5735,12 +5736,12 @@ CheckPointGuts(XLogRecPtr checkPointRedo) static void RecoveryRestartPoint(const CheckPoint *checkPoint) { - int elapsed_secs; - int rmid; + int elapsed_secs; + int rmid; /* - * Do nothing if the elapsed time since the last restartpoint is less - * than half of checkpoint_timeout. (We use a value less than + * Do nothing if the elapsed time since the last restartpoint is less than + * half of checkpoint_timeout. (We use a value less than * checkpoint_timeout so that variations in the timing of checkpoints on * the master, or speed of transmission of WAL segments to a slave, won't * make the slave skip a restartpoint once it's synced with the master.) @@ -5770,9 +5771,9 @@ RecoveryRestartPoint(const CheckPoint *checkPoint) CheckPointGuts(checkPoint->redo); /* - * Update pg_control so that any subsequent crash will restart from - * this checkpoint. Note: ReadRecPtr gives the XLOG address of the - * checkpoint record itself. + * Update pg_control so that any subsequent crash will restart from this + * checkpoint. Note: ReadRecPtr gives the XLOG address of the checkpoint + * record itself. */ ControlFile->prevCheckPoint = ControlFile->checkPoint; ControlFile->checkPoint = ReadRecPtr; @@ -5926,7 +5927,7 @@ xlog_redo(XLogRecPtr lsn, XLogRecord *record) void xlog_desc(StringInfo buf, uint8 xl_info, char *rec) { - uint8 info = xl_info & ~XLR_INFO_MASK; + uint8 info = xl_info & ~XLR_INFO_MASK; if (info == XLOG_CHECKPOINT_SHUTDOWN || info == XLOG_CHECKPOINT_ONLINE) @@ -5934,15 +5935,15 @@ xlog_desc(StringInfo buf, uint8 xl_info, char *rec) CheckPoint *checkpoint = (CheckPoint *) rec; appendStringInfo(buf, "checkpoint: redo %X/%X; undo %X/%X; " - "tli %u; xid %u/%u; oid %u; multi %u; offset %u; %s", - checkpoint->redo.xlogid, checkpoint->redo.xrecoff, - checkpoint->undo.xlogid, checkpoint->undo.xrecoff, - checkpoint->ThisTimeLineID, - checkpoint->nextXidEpoch, checkpoint->nextXid, - checkpoint->nextOid, - checkpoint->nextMulti, - checkpoint->nextMultiOffset, - (info == XLOG_CHECKPOINT_SHUTDOWN) ? "shutdown" : "online"); + "tli %u; xid %u/%u; oid %u; multi %u; offset %u; %s", + checkpoint->redo.xlogid, checkpoint->redo.xrecoff, + checkpoint->undo.xlogid, checkpoint->undo.xrecoff, + checkpoint->ThisTimeLineID, + checkpoint->nextXidEpoch, checkpoint->nextXid, + checkpoint->nextOid, + checkpoint->nextMulti, + checkpoint->nextMultiOffset, + (info == XLOG_CHECKPOINT_SHUTDOWN) ? "shutdown" : "online"); } else if (info == XLOG_NEXTOID) { @@ -5973,7 +5974,7 @@ xlog_outrec(StringInfo buf, XLogRecord *record) for (i = 0; i < XLR_MAX_BKP_BLOCKS; i++) { if (record->xl_info & XLR_SET_BKP_BLOCK(i)) - appendStringInfo(buf, "; bkpb%d", i+1); + appendStringInfo(buf, "; bkpb%d", i + 1); } appendStringInfo(buf, ": %s", RmgrTable[record->xl_rmid].rm_name); @@ -6142,18 +6143,18 @@ pg_start_backup(PG_FUNCTION_ARGS) * Mark backup active in shared memory. We must do full-page WAL writes * during an on-line backup even if not doing so at other times, because * it's quite possible for the backup dump to obtain a "torn" (partially - * written) copy of a database page if it reads the page concurrently - * with our write to the same page. This can be fixed as long as the - * first write to the page in the WAL sequence is a full-page write. - * Hence, we turn on forcePageWrites and then force a CHECKPOINT, to - * ensure there are no dirty pages in shared memory that might get - * dumped while the backup is in progress without having a corresponding - * WAL record. (Once the backup is complete, we need not force full-page - * writes anymore, since we expect that any pages not modified during - * the backup interval must have been correctly captured by the backup.) + * written) copy of a database page if it reads the page concurrently with + * our write to the same page. This can be fixed as long as the first + * write to the page in the WAL sequence is a full-page write. Hence, we + * turn on forcePageWrites and then force a CHECKPOINT, to ensure there + * are no dirty pages in shared memory that might get dumped while the + * backup is in progress without having a corresponding WAL record. (Once + * the backup is complete, we need not force full-page writes anymore, + * since we expect that any pages not modified during the backup interval + * must have been correctly captured by the backup.) * - * We must hold WALInsertLock to change the value of forcePageWrites, - * to ensure adequate interlocking against XLogInsert(). + * We must hold WALInsertLock to change the value of forcePageWrites, to + * ensure adequate interlocking against XLogInsert(). */ LWLockAcquire(WALInsertLock, LW_EXCLUSIVE); if (XLogCtl->Insert.forcePageWrites) @@ -6171,7 +6172,7 @@ pg_start_backup(PG_FUNCTION_ARGS) PG_TRY(); { /* - * Force a CHECKPOINT. Aside from being necessary to prevent torn + * Force a CHECKPOINT. Aside from being necessary to prevent torn * page problems, this guarantees that two successive backup runs will * have different checkpoint positions and hence different history * file names, even if nothing happened in between. @@ -6303,10 +6304,9 @@ pg_stop_backup(PG_FUNCTION_ARGS) LWLockRelease(WALInsertLock); /* - * Force a switch to a new xlog segment file, so that the backup - * is valid as soon as archiver moves out the current segment file. - * We'll report the end address of the XLOG SWITCH record as the backup - * stopping point. + * Force a switch to a new xlog segment file, so that the backup is valid + * as soon as archiver moves out the current segment file. We'll report + * the end address of the XLOG SWITCH record as the backup stopping point. */ stoppoint = RequestXLogSwitch(); @@ -6392,9 +6392,9 @@ pg_stop_backup(PG_FUNCTION_ARGS) BACKUP_LABEL_FILE))); /* - * Clean out any no-longer-needed history files. As a side effect, - * this will post a .ready file for the newly created history file, - * notifying the archiver that history file may be archived immediately. + * Clean out any no-longer-needed history files. As a side effect, this + * will post a .ready file for the newly created history file, notifying + * the archiver that history file may be archived immediately. */ CleanupBackupHistory(); @@ -6415,7 +6415,7 @@ Datum pg_switch_xlog(PG_FUNCTION_ARGS) { text *result; - XLogRecPtr switchpoint; + XLogRecPtr switchpoint; char location[MAXFNAMELEN]; if (!superuser()) @@ -6514,17 +6514,17 @@ pg_xlogfile_name_offset(PG_FUNCTION_ARGS) uint32 xrecoff; XLogRecPtr locationpoint; char xlogfilename[MAXFNAMELEN]; - Datum values[2]; - bool isnull[2]; - TupleDesc resultTupleDesc; - HeapTuple resultHeapTuple; - Datum result; + Datum values[2]; + bool isnull[2]; + TupleDesc resultTupleDesc; + HeapTuple resultHeapTuple; + Datum result; /* * Read input and parse */ locationstr = DatumGetCString(DirectFunctionCall1(textout, - PointerGetDatum(location))); + PointerGetDatum(location))); if (sscanf(locationstr, "%X/%X", &uxlogid, &uxrecoff) != 2) ereport(ERROR, @@ -6536,8 +6536,8 @@ pg_xlogfile_name_offset(PG_FUNCTION_ARGS) locationpoint.xrecoff = uxrecoff; /* - * Construct a tuple descriptor for the result row. This must match - * this function's pg_proc entry! + * Construct a tuple descriptor for the result row. This must match this + * function's pg_proc entry! */ resultTupleDesc = CreateTemplateTupleDesc(2, false); TupleDescInitEntry(resultTupleDesc, (AttrNumber) 1, "file_name", @@ -6593,7 +6593,7 @@ pg_xlogfile_name(PG_FUNCTION_ARGS) char xlogfilename[MAXFNAMELEN]; locationstr = DatumGetCString(DirectFunctionCall1(textout, - PointerGetDatum(location))); + PointerGetDatum(location))); if (sscanf(locationstr, "%X/%X", &uxlogid, &uxrecoff) != 2) ereport(ERROR, @@ -6608,7 +6608,7 @@ pg_xlogfile_name(PG_FUNCTION_ARGS) XLogFileName(xlogfilename, ThisTimeLineID, xlogid, xlogseg); result = DatumGetTextP(DirectFunctionCall1(textin, - CStringGetDatum(xlogfilename))); + CStringGetDatum(xlogfilename))); PG_RETURN_TEXT_P(result); } @@ -6734,8 +6734,8 @@ read_backup_label(XLogRecPtr *checkPointLoc, XLogRecPtr *minRecoveryLoc) static void rm_redo_error_callback(void *arg) { - XLogRecord *record = (XLogRecord *) arg; - StringInfoData buf; + XLogRecord *record = (XLogRecord *) arg; + StringInfoData buf; initStringInfo(&buf); RmgrTable[record->xl_rmid].rm_desc(&buf, diff --git a/src/backend/access/transam/xlogutils.c b/src/backend/access/transam/xlogutils.c index d7fb9359dec..e1d3b700011 100644 --- a/src/backend/access/transam/xlogutils.c +++ b/src/backend/access/transam/xlogutils.c @@ -11,7 +11,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/access/transam/xlogutils.c,v 1.47 2006/07/14 14:52:17 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/xlogutils.c,v 1.48 2006/10/04 00:29:49 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -172,8 +172,8 @@ XLogCheckInvalidPages(void) hash_seq_init(&status, invalid_page_tab); /* - * Our strategy is to emit WARNING messages for all remaining entries - * and only PANIC after we've dumped all the available info. + * Our strategy is to emit WARNING messages for all remaining entries and + * only PANIC after we've dumped all the available info. */ while ((hentry = (xl_invalid_page *) hash_seq_search(&status)) != NULL) { @@ -255,7 +255,7 @@ XLogReadBuffer(Relation reln, BlockNumber blkno, bool init) if (!init) { /* check that page has been initialized */ - Page page = (Page) BufferGetPage(buffer); + Page page = (Page) BufferGetPage(buffer); if (PageIsNew((PageHeader) page)) { |