static Oid set_oid = 0;
static MultiXactId set_mxid = 0;
static MultiXactOffset set_mxoff = (MultiXactOffset) -1;
-static uint32 minXlogTli = 0;
+static TimeLineID minXlogTli = 0;
static XLogSegNo minXlogSegNo = 0;
static int WalSegSz;
static int set_wal_segsize;
{
DIR *xldir;
struct dirent *xlde;
- uint64 segs_per_xlogid;
uint64 xlogbytepos;
/*
* old pg_control. Note that for the moment we are working with segment
* numbering according to the old xlog seg size.
*/
- segs_per_xlogid = (UINT64CONST(0x0000000100000000) / ControlFile.xlog_seg_size);
- newXlogSegNo = ControlFile.checkPointCopy.redo / ControlFile.xlog_seg_size;
+ XLByteToSeg(ControlFile.checkPointCopy.redo, newXlogSegNo,
+ ControlFile.xlog_seg_size);
/*
* Scan the pg_wal directory to find existing WAL segment files. We assume
if (IsXLogFileName(xlde->d_name) ||
IsPartialXLogFileName(xlde->d_name))
{
- unsigned int tli,
- log,
- seg;
+ TimeLineID tli;
XLogSegNo segno;
- /*
- * Note: We don't use XLogFromFileName here, because we want to
- * use the segment size from the control file, not the size the
- * pg_resetwal binary was compiled with
- */
- sscanf(xlde->d_name, "%08X%08X%08X", &tli, &log, &seg);
- segno = ((uint64) log) * segs_per_xlogid + seg;
+ /* Use the segment size from the control file */
+ XLogFromFileName(xlde->d_name, &tli, &segno,
+ ControlFile.xlog_seg_size);
/*
* Note: we take the max of all files found, regardless of their