@@ -565,7 +565,7 @@ RestoreControlValues(int mode)
565565{
566566struct timeval tv ;
567567char * localeptr ;
568- bool successed = true;
568+ bool successed = true;
569569
570570/*
571571 * Set up a completely default set of pg_control values.
@@ -579,27 +579,30 @@ RestoreControlValues(int mode)
579579 * update the checkpoint value in control file,by searching
580580 * xlog segment file, or just guessing it.
581581 */
582- if (mode == WAL )
583- {
582+ if (mode == WAL )
583+ {
584584int result = SearchLastCheckpoint ();
585- if (result > 0 )/* The last checkpoint had been found. */
585+
586+ if (result > 0 )/* The last checkpoint had been found. */
586587{
587588ControlFile .checkPointCopy = lastcheckpoint ;
589+ ControlFile .checkPointCopy .ThisTimeLineID = LastXLogFile -> tli ;
588590ControlFile .checkPoint = lastchkp ;
589591ControlFile .prevCheckPoint = prevchkp ;
592+
590593ControlFile .logId = LastXLogFile -> logid ;
591594ControlFile .logSeg = LastXLogFile -> seg + 1 ;
592- ControlFile .checkPointCopy .ThisTimeLineID = LastXLogFile -> tli ;
593595ControlFile .state = state ;
594- }else successed = false;
596+ }
597+ else
598+ successed = false;
595599
596600/* Clean up the list. */
597601CleanUpList (xlogfilelist );
598-
599- }
600-
601- if (mode == GUESS )
602+ }
603+ else /* GUESS */
602604{
605+ ControlFile .checkPointCopy .ThisTimeLineID = 2 ;
603606ControlFile .checkPointCopy .redo .xlogid = 0 ;
604607ControlFile .checkPointCopy .redo .xrecoff = SizeOfXLogLongPHD ;
605608ControlFile .checkPointCopy .undo = ControlFile .checkPointCopy .redo ;
@@ -609,6 +612,7 @@ RestoreControlValues(int mode)
609612ControlFile .checkPointCopy .nextMultiOffset = 0 ;
610613ControlFile .checkPointCopy .time = time (NULL );
611614ControlFile .checkPoint = ControlFile .checkPointCopy .redo ;
615+
612616/*
613617 * Create a new unique installation identifier, since we can no longer
614618 * use any old XLOG records. See notes in xlog.c about the algorithm.
@@ -644,6 +648,7 @@ RestoreControlValues(int mode)
644648exit (1 );
645649}
646650StrNCpy (ControlFile .lc_collate ,localeptr ,LOCALE_NAME_BUFLEN );
651+
647652localeptr = setlocale (LC_CTYPE ,"" );
648653if (!localeptr )
649654{