Run pgindent on xlog.c.

To tidy up after some recent refactorings in xlog.c. These would be
fixed by the pgindent run we do at the end of the development cycle,
but I want to clean these up now as I'm about to do some more big
refactorings on xlog.c.
This commit is contained in:
Heikki Linnakangas 2022-02-16 09:22:34 +02:00
parent 27d195a578
commit d231be00cb
1 changed files with 47 additions and 47 deletions

View File

@ -911,7 +911,7 @@ static void checkTimeLineSwitch(XLogRecPtr lsn, TimeLineID newTLI,
TimeLineID prevTLI, TimeLineID replayTLI); TimeLineID prevTLI, TimeLineID replayTLI);
static void VerifyOverwriteContrecord(xl_overwrite_contrecord *xlrec, static void VerifyOverwriteContrecord(xl_overwrite_contrecord *xlrec,
XLogReaderState *state); XLogReaderState *state);
static int LocalSetXLogInsertAllowed(void); static int LocalSetXLogInsertAllowed(void);
static void CreateEndOfRecoveryRecord(void); static void CreateEndOfRecoveryRecord(void);
static XLogRecPtr CreateOverwriteContrecordRecord(XLogRecPtr aborted_lsn); static XLogRecPtr CreateOverwriteContrecordRecord(XLogRecPtr aborted_lsn);
static void CheckPointGuts(XLogRecPtr checkPointRedo, int flags); static void CheckPointGuts(XLogRecPtr checkPointRedo, int flags);
@ -5814,38 +5814,38 @@ CleanupAfterArchiveRecovery(TimeLineID EndOfLogTLI, XLogRecPtr EndOfLog,
* We switched to a new timeline. Clean up segments on the old timeline. * We switched to a new timeline. Clean up segments on the old timeline.
* *
* If there are any higher-numbered segments on the old timeline, remove * If there are any higher-numbered segments on the old timeline, remove
* them. They might contain valid WAL, but they might also be pre-allocated * them. They might contain valid WAL, but they might also be
* files containing garbage. In any case, they are not part of the new * pre-allocated files containing garbage. In any case, they are not part
* timeline's history so we don't need them. * of the new timeline's history so we don't need them.
*/ */
RemoveNonParentXlogFiles(EndOfLog, newTLI); RemoveNonParentXlogFiles(EndOfLog, newTLI);
/* /*
* If the switch happened in the middle of a segment, what to do with the * If the switch happened in the middle of a segment, what to do with the
* last, partial segment on the old timeline? If we don't archive it, and * last, partial segment on the old timeline? If we don't archive it, and
* the server that created the WAL never archives it either (e.g. because it * the server that created the WAL never archives it either (e.g. because
* was hit by a meteor), it will never make it to the archive. That's OK * it was hit by a meteor), it will never make it to the archive. That's
* from our point of view, because the new segment that we created with the * OK from our point of view, because the new segment that we created with
* new TLI contains all the WAL from the old timeline up to the switch * the new TLI contains all the WAL from the old timeline up to the switch
* point. But if you later try to do PITR to the "missing" WAL on the old * point. But if you later try to do PITR to the "missing" WAL on the old
* timeline, recovery won't find it in the archive. It's physically present * timeline, recovery won't find it in the archive. It's physically
* in the new file with new TLI, but recovery won't look there when it's * present in the new file with new TLI, but recovery won't look there
* recovering to the older timeline. On the other hand, if we archive the * when it's recovering to the older timeline. On the other hand, if we
* partial segment, and the original server on that timeline is still * archive the partial segment, and the original server on that timeline
* running and archives the completed version of the same segment later, it * is still running and archives the completed version of the same segment
* will fail. (We used to do that in 9.4 and below, and it caused such * later, it will fail. (We used to do that in 9.4 and below, and it
* problems). * caused such problems).
* *
* As a compromise, we rename the last segment with the .partial suffix, and * As a compromise, we rename the last segment with the .partial suffix,
* archive it. Archive recovery will never try to read .partial segments, so * and archive it. Archive recovery will never try to read .partial
* they will normally go unused. But in the odd PITR case, the administrator * segments, so they will normally go unused. But in the odd PITR case,
* can copy them manually to the pg_wal directory (removing the suffix). * the administrator can copy them manually to the pg_wal directory
* They can be useful in debugging, too. * (removing the suffix). They can be useful in debugging, too.
* *
* If a .done or .ready file already exists for the old timeline, however, * If a .done or .ready file already exists for the old timeline, however,
* we had already determined that the segment is complete, so we can let it * we had already determined that the segment is complete, so we can let
* be archived normally. (In particular, if it was restored from the archive * it be archived normally. (In particular, if it was restored from the
* to begin with, it's expected to have a .done file). * archive to begin with, it's expected to have a .done file).
*/ */
if (XLogSegmentOffset(EndOfLog, wal_segment_size) != 0 && if (XLogSegmentOffset(EndOfLog, wal_segment_size) != 0 &&
XLogArchivingActive()) XLogArchivingActive())
@ -7657,10 +7657,10 @@ StartupXLOG(void)
* Before replaying this record, check if this record causes * Before replaying this record, check if this record causes
* the current timeline to change. The record is already * the current timeline to change. The record is already
* considered to be part of the new timeline, so we update * considered to be part of the new timeline, so we update
* replayTLI before replaying it. That's important so * replayTLI before replaying it. That's important so that
* that replayEndTLI, which is recorded as the minimum * replayEndTLI, which is recorded as the minimum recovery
* recovery point's TLI if recovery stops after this record, * point's TLI if recovery stops after this record, is set
* is set correctly. * correctly.
*/ */
if (record->xl_rmid == RM_XLOG_ID) if (record->xl_rmid == RM_XLOG_ID)
{ {
@ -8166,10 +8166,10 @@ StartupXLOG(void)
* Emit checkpoint or end-of-recovery record in XLOG, if required. * Emit checkpoint or end-of-recovery record in XLOG, if required.
* *
* XLogCtl->lastReplayedEndRecPtr will be a valid LSN if and only if we * XLogCtl->lastReplayedEndRecPtr will be a valid LSN if and only if we
* entered recovery. Even if we ultimately replayed no WAL records, it will * entered recovery. Even if we ultimately replayed no WAL records, it
* have been initialized based on where replay was due to start. We don't * will have been initialized based on where replay was due to start. We
* need a lock to access this, since this can't change any more by the time * don't need a lock to access this, since this can't change any more by
* we reach this code. * the time we reach this code.
*/ */
if (!XLogRecPtrIsInvalid(XLogCtl->lastReplayedEndRecPtr)) if (!XLogRecPtrIsInvalid(XLogCtl->lastReplayedEndRecPtr))
promoted = PerformRecoveryXLogAction(); promoted = PerformRecoveryXLogAction();
@ -8357,15 +8357,15 @@ PerformRecoveryXLogAction(void)
/* /*
* Perform a checkpoint to update all our recovery activity to disk. * Perform a checkpoint to update all our recovery activity to disk.
* *
* Note that we write a shutdown checkpoint rather than an on-line one. This * Note that we write a shutdown checkpoint rather than an on-line one.
* is not particularly critical, but since we may be assigning a new TLI, * This is not particularly critical, but since we may be assigning a new
* using a shutdown checkpoint allows us to have the rule that TLI only * TLI, using a shutdown checkpoint allows us to have the rule that TLI
* changes in shutdown checkpoints, which allows some extra error checking * only changes in shutdown checkpoints, which allows some extra error
* in xlog_redo. * checking in xlog_redo.
* *
* In promotion, only create a lightweight end-of-recovery record instead of * In promotion, only create a lightweight end-of-recovery record instead
* a full checkpoint. A checkpoint is requested later, after we're fully out * of a full checkpoint. A checkpoint is requested later, after we're
* of recovery mode and already accepting queries. * fully out of recovery mode and already accepting queries.
*/ */
if (ArchiveRecoveryRequested && IsUnderPostmaster && if (ArchiveRecoveryRequested && IsUnderPostmaster &&
LocalPromoteIsTriggered) LocalPromoteIsTriggered)
@ -8375,11 +8375,11 @@ PerformRecoveryXLogAction(void)
/* /*
* Insert a special WAL record to mark the end of recovery, since we * Insert a special WAL record to mark the end of recovery, since we
* aren't doing a checkpoint. That means that the checkpointer process * aren't doing a checkpoint. That means that the checkpointer process
* may likely be in the middle of a time-smoothed restartpoint and could * may likely be in the middle of a time-smoothed restartpoint and
* continue to be for minutes after this. That sounds strange, but the * could continue to be for minutes after this. That sounds strange,
* effect is roughly the same and it would be stranger to try to come * but the effect is roughly the same and it would be stranger to try
* out of the restartpoint and then checkpoint. We request a checkpoint * to come out of the restartpoint and then checkpoint. We request a
* later anyway, just for safety. * checkpoint later anyway, just for safety.
*/ */
CreateEndOfRecoveryRecord(); CreateEndOfRecoveryRecord();
} }
@ -8531,7 +8531,7 @@ XLogInsertAllowed(void)
static int static int
LocalSetXLogInsertAllowed(void) LocalSetXLogInsertAllowed(void)
{ {
int oldXLogAllowed = LocalXLogInsertAllowed; int oldXLogAllowed = LocalXLogInsertAllowed;
LocalXLogInsertAllowed = 1; LocalXLogInsertAllowed = 1;
@ -8718,8 +8718,8 @@ GetFlushRecPtr(TimeLineID *insertTLI)
SpinLockRelease(&XLogCtl->info_lck); SpinLockRelease(&XLogCtl->info_lck);
/* /*
* If we're writing and flushing WAL, the time line can't be changing, * If we're writing and flushing WAL, the time line can't be changing, so
* so no lock is required. * no lock is required.
*/ */
if (insertTLI) if (insertTLI)
*insertTLI = XLogCtl->InsertTimeLineID; *insertTLI = XLogCtl->InsertTimeLineID;