index 318dae29611fc12a77eb3bd1a0638479f686708d..d1060023f9e1d68dc852f81ce1905efe625fe653 100644 (file)
{
struct timeval tv;
char *localeptr;
- bool successed=true;
+ bool successed = true;
/*
* Set up a completely default set of pg_control values.
* update the checkpoint value in control file,by searching
* xlog segment file, or just guessing it.
*/
- if (mode == WAL)
- {
+ if (mode == WAL)
+ {
int result = SearchLastCheckpoint();
- if ( result > 0 ) /* The last checkpoint had been found. */
+
+ if (result > 0) /* The last checkpoint had been found. */
{
ControlFile.checkPointCopy = lastcheckpoint;
+ ControlFile.checkPointCopy.ThisTimeLineID = LastXLogFile->tli;
ControlFile.checkPoint = lastchkp;
ControlFile.prevCheckPoint = prevchkp;
+
ControlFile.logId = LastXLogFile->logid;
ControlFile.logSeg = LastXLogFile->seg + 1;
- ControlFile.checkPointCopy.ThisTimeLineID = LastXLogFile->tli;
ControlFile.state = state;
- } else successed = false;
+ }
+ else
+ successed = false;
/* Clean up the list. */
CleanUpList(xlogfilelist);
-
- }
-
- if (mode == GUESS)
+ }
+ else /* GUESS */
{
+ ControlFile.checkPointCopy.ThisTimeLineID = 2;
ControlFile.checkPointCopy.redo.xlogid = 0;
ControlFile.checkPointCopy.redo.xrecoff = SizeOfXLogLongPHD;
ControlFile.checkPointCopy.undo = ControlFile.checkPointCopy.redo;
ControlFile.checkPointCopy.nextMultiOffset = 0;
ControlFile.checkPointCopy.time = time(NULL);
ControlFile.checkPoint = ControlFile.checkPointCopy.redo;
+
/*
* Create a new unique installation identifier, since we can no longer
* use any old XLOG records. See notes in xlog.c about the algorithm.
exit(1);
}
StrNCpy(ControlFile.lc_collate, localeptr, LOCALE_NAME_BUFLEN);
+
localeptr = setlocale(LC_CTYPE, "");
if (!localeptr)
{