Index: src/backend/access/transam/xlog.c =================================================================== RCS file: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v retrieving revision 1.348 diff -c -r1.348 xlog.c *** src/backend/access/transam/xlog.c 12 Aug 2009 20:53:30 -0000 1.348 --- src/backend/access/transam/xlog.c 26 Aug 2009 14:40:28 -0000 *************** *** 6445,6450 **** --- 6445,6461 ---- } /* + * 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. * * NB: this is NOT necessarily where the checkpoint record itself will be, *************** *** 6567,6586 **** 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. */ rdata.data = (char *) (&checkPoint); --- 6578,6583 ----