Index: src/bin/pg_resetxlog/pg_resetxlog.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v
retrieving revision 1.44
diff -c -c -r1.44 pg_resetxlog.c
*** src/bin/pg_resetxlog/pg_resetxlog.c	26 Apr 2006 02:17:15 -0000	1.44
--- src/bin/pg_resetxlog/pg_resetxlog.c	26 Apr 2006 18:55:03 -0000
***************
*** 565,571 ****
  {
  	struct timeval tv;
  	char	   *localeptr;
! 	bool	successed=true;
  
  	/*
  	 * Set up a completely default set of pg_control values.
--- 565,571 ----
  {
  	struct timeval tv;
  	char	   *localeptr;
! 	bool	successed = true;
  
  	/*
  	 * Set up a completely default set of pg_control values.
***************
*** 579,605 ****
  	 * update the checkpoint value in control file,by searching 
  	 * xlog segment file, or just guessing it.
  	 */
! 	 if (mode == WAL)
! 	 {
  		int result = SearchLastCheckpoint();
! 		if ( result > 0 ) /* The last checkpoint had been found. */
  		{
  			ControlFile.checkPointCopy = lastcheckpoint;
  			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;
  		
  		/* Clean up the list. */
  		CleanUpList(xlogfilelist);		
! 		
! 	 } 	
! 	
! 	if (mode == GUESS)
  	{
  		ControlFile.checkPointCopy.redo.xlogid = 0;
  		ControlFile.checkPointCopy.redo.xrecoff = SizeOfXLogLongPHD;
  		ControlFile.checkPointCopy.undo = ControlFile.checkPointCopy.redo;
--- 579,608 ----
  	 * update the checkpoint value in control file,by searching 
  	 * xlog segment file, or just guessing it.
  	 */
! 	if (mode == WAL)
! 	{
  		int result = SearchLastCheckpoint();
! 
! 		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.state = state;
! 		}
! 		else
! 			successed = false;
  		
  		/* Clean up the list. */
  		CleanUpList(xlogfilelist);		
! 	}
! 	else	/* GUESS */
  	{
+ 		ControlFile.checkPointCopy.ThisTimeLineID = 2;
  		ControlFile.checkPointCopy.redo.xlogid = 0;
  		ControlFile.checkPointCopy.redo.xrecoff = SizeOfXLogLongPHD;
  		ControlFile.checkPointCopy.undo = ControlFile.checkPointCopy.redo;
***************
*** 609,614 ****
--- 612,618 ----
  		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.
***************
*** 644,649 ****
--- 648,654 ----
  		exit(1);
  	}
  	StrNCpy(ControlFile.lc_collate, localeptr, LOCALE_NAME_BUFLEN);
+ 
  	localeptr = setlocale(LC_CTYPE, "");
  	if (!localeptr)
  	{
