#define RECOVERY_COMMAND_FILE "recovery.conf"
#define RECOVERY_COMMAND_DONE "recovery.done"
+/* timeline ID to be used when bootstrapping */
+#define BootstrapTimeLineID 1
+
/* User-settable parameters */
int max_wal_size_mb = 1024; /* 1 GB */
int min_wal_size_mb = 80; /* 80 MB */
*/
CheckpointStatsData CheckpointStats;
-/*
- * ThisTimeLineID will be same in all backends --- it identifies current
- * WAL timeline for the database system.
- */
-static TimeLineID ThisTimeLineID = 0;
-
static XLogRecPtr LastRec;
/* Local copy of WalRcv->flushedUpto */
sysidentifier |= ((uint64) tv.tv_usec) << 12;
sysidentifier |= getpid() & 0xFFF;
- /* First timeline ID is always 1 */
- ThisTimeLineID = 1;
-
/* page buffer must be aligned suitably for O_DIRECT */
buffer = (char *) palloc(XLOG_BLCKSZ + XLOG_BLCKSZ);
page = (XLogPageHeader) TYPEALIGN(XLOG_BLCKSZ, buffer);
* used, so that we can use 0/0 to mean "before any valid WAL segment".
*/
checkPoint.redo = wal_segment_size + SizeOfXLogLongPHD;
- checkPoint.ThisTimeLineID = ThisTimeLineID;
- checkPoint.PrevTimeLineID = ThisTimeLineID;
+ checkPoint.ThisTimeLineID = BootstrapTimeLineID;
+ checkPoint.PrevTimeLineID = BootstrapTimeLineID;
checkPoint.fullPageWrites = fullPageWrites;
checkPoint.nextXid =
FullTransactionIdFromEpochAndXid(0, FirstNormalTransactionId);
/* Set up the XLOG page header */
page->xlp_magic = XLOG_PAGE_MAGIC;
page->xlp_info = XLP_LONG_HEADER;
- page->xlp_tli = ThisTimeLineID;
+ page->xlp_tli = BootstrapTimeLineID;
page->xlp_pageaddr = wal_segment_size;
longpage = (XLogLongPageHeader) page;
longpage->xlp_sysid = sysidentifier;
record->xl_crc = crc;
/* Create first XLOG segment file */
- openLogTLI = ThisTimeLineID;
- openLogFile = XLogFileInit(1, ThisTimeLineID);
+ openLogTLI = BootstrapTimeLineID;
+ openLogFile = XLogFileInit(1, BootstrapTimeLineID);
/*
* We needn't bother with Reserve/ReleaseExternalFD here, since we'll
checkPointLoc,
EndOfLog;
TimeLineID EndOfLogTLI;
- TimeLineID PrevTimeLineID;
+ TimeLineID ThisTimeLineID,
+ PrevTimeLineID;
XLogRecord *record;
TransactionId oldestActiveXID;
bool backupEndRequired = false;
/*
* This must be called in a backend process before creating WAL records
* (except in a standalone backend, which does StartupXLOG instead). We need
- * to initialize the local copies of ThisTimeLineID and RedoRecPtr.
- *
- * Note: before Postgres 8.0, we went to some effort to keep the postmaster
- * process's copies of ThisTimeLineID and RedoRecPtr valid too. This was
- * unnecessary however, since the postmaster itself never touches XLOG anyway.
+ * to initialize the local copy of RedoRecPtr.
*/
void
InitXLOGAccess(void)
{
XLogCtlInsert *Insert = &XLogCtl->Insert;
- /* ThisTimeLineID doesn't change so we need no lock to copy it */
- ThisTimeLineID = XLogCtl->ThisTimeLineID;
- Assert(ThisTimeLineID != 0 || IsBootstrapProcessingMode());
-
/* set wal_segment_size */
wal_segment_size = ControlFile->xlog_seg_size;