Per Tom, do full reset on -x flag.

This commit is contained in:
Bruce Momjian 2002-01-10 18:08:29 +00:00
parent f6e603cffa
commit 872aad61ff

View File

@ -23,7 +23,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Header: /cvsroot/pgsql/contrib/pg_resetxlog/Attic/pg_resetxlog.c,v 1.11 2002/01/10 17:51:52 momjian Exp $ * $Header: /cvsroot/pgsql/contrib/pg_resetxlog/Attic/pg_resetxlog.c,v 1.12 2002/01/10 18:08:29 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -714,8 +714,6 @@ RewriteControlFile(TransactionId set_xid)
int fd; int fd;
char buffer[BLCKSZ]; /* need not be aligned */ char buffer[BLCKSZ]; /* need not be aligned */
if (set_xid == 0)
{
/* /*
* Adjust fields as needed to force an empty XLOG starting at the next * Adjust fields as needed to force an empty XLOG starting at the next
* available segment. * available segment.
@ -738,8 +736,8 @@ RewriteControlFile(TransactionId set_xid)
ControlFile.checkPoint = ControlFile.checkPointCopy.redo; ControlFile.checkPoint = ControlFile.checkPointCopy.redo;
ControlFile.prevCheckPoint.xlogid = 0; ControlFile.prevCheckPoint.xlogid = 0;
ControlFile.prevCheckPoint.xrecoff = 0; ControlFile.prevCheckPoint.xrecoff = 0;
}
else if (set_xid != 0)
ControlFile.checkPointCopy.nextXid = set_xid; ControlFile.checkPointCopy.nextXid = set_xid;
/* Contents are protected with a CRC */ /* Contents are protected with a CRC */
@ -1011,20 +1009,6 @@ main(int argc, char **argv)
if (!ReadControlFile()) if (!ReadControlFile())
GuessControlValues(); GuessControlValues();
/*
* Set XID in pg_control and exit
*/
if (set_xid)
{
if (guessed)
{
printf("\npg_control appears corrupt. Can not update XID.\n");
exit(1);
}
RewriteControlFile(set_xid);
exit(0);
}
/* /*
* If we had to guess anything, and -f was not given, just print the * If we had to guess anything, and -f was not given, just print the
* guessed values and exit. Also print if -n is given. * guessed values and exit. Also print if -n is given.
@ -1051,7 +1035,7 @@ main(int argc, char **argv)
/* /*
* Else, do the dirty deed. * Else, do the dirty deed.
*/ */
RewriteControlFile(0); RewriteControlFile(set_xid);
KillExistingXLOG(); KillExistingXLOG();
WriteEmptyXLOG(); WriteEmptyXLOG();