}
}
+ /*
+ * An end-of-recovery checkpoint is created before anyone is allowed to
+ * write WAL. To allow us to write the checkpoint record, temporarily
+ * enable XLogInsertAllowed. (This also ensures ThisTimeLineID is
+ * initialized, which we need here and in AdvanceXLInsertBuffer.)
+ */
+ if (flags & CHECKPOINT_END_OF_RECOVERY)
+ LocalSetXLogInsertAllowed();
+
+ checkPoint.ThisTimeLineID = ThisTimeLineID;
+
/*
* Compute new REDO record ptr = location of next XLOG record.
*
START_CRIT_SECTION();
- /*
- * An end-of-recovery checkpoint is created before anyone is allowed to
- * write WAL. To allow us to write the checkpoint record, temporarily
- * enable XLogInsertAllowed.
- */
- if (flags & CHECKPOINT_END_OF_RECOVERY)
- LocalSetXLogInsertAllowed();
-
- /*
- * This needs to be done after LocalSetXLogInsertAllowed(), else
- * ThisTimeLineID might still be uninitialized.
- */
- checkPoint.ThisTimeLineID = ThisTimeLineID;
-
/*
* Now insert the checkpoint record into XLOG.
*/