|
23 | 23 | * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
|
24 | 24 | * Portions Copyright (c) 1994, Regents of the University of California
|
25 | 25 | *
|
26 |
| - * $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.26 2004/12/14 01:59:41 neilc Exp $ |
| 26 | + * $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.27 2004/12/20 01:42:11 tgl Exp $ |
27 | 27 | *
|
28 | 28 | *-------------------------------------------------------------------------
|
29 | 29 | */
|
@@ -77,10 +77,12 @@ main(int argc, char *argv[])
|
77 | 77 | boolnoupdate= false;
|
78 | 78 | TransactionIdset_xid=0;
|
79 | 79 | Oidset_oid=0;
|
80 |
| -uint32minXlogId=0, |
| 80 | +uint32minXlogTli=0, |
| 81 | +minXlogId=0, |
81 | 82 | minXlogSeg=0;
|
82 | 83 | char*endptr;
|
83 | 84 | char*endptr2;
|
| 85 | +char*endptr3; |
84 | 86 | char*DataDir;
|
85 | 87 | intfd;
|
86 | 88 | charpath[MAXPGPATH];
|
@@ -147,15 +149,22 @@ main(int argc, char *argv[])
|
147 | 149 | break;
|
148 | 150 |
|
149 | 151 | case'l':
|
150 |
| -minXlogId=strtoul(optarg,&endptr,0); |
| 152 | +minXlogTli=strtoul(optarg,&endptr,0); |
151 | 153 | if (endptr==optarg||*endptr!=',')
|
152 | 154 | {
|
153 | 155 | fprintf(stderr,_("%s: invalid argument for option -l\n"),progname);
|
154 | 156 | fprintf(stderr,_("Try \"%s --help\" for more information.\n"),progname);
|
155 | 157 | exit(1);
|
156 | 158 | }
|
157 |
| -minXlogSeg=strtoul(endptr+1,&endptr2,0); |
158 |
| -if (endptr2==endptr+1||*endptr2!='\0') |
| 159 | +minXlogId=strtoul(endptr+1,&endptr2,0); |
| 160 | +if (endptr2==endptr+1||*endptr2!=',') |
| 161 | +{ |
| 162 | +fprintf(stderr,_("%s: invalid argument for option -l\n"),progname); |
| 163 | +fprintf(stderr,_("Try \"%s --help\" for more information.\n"),progname); |
| 164 | +exit(1); |
| 165 | +} |
| 166 | +minXlogSeg=strtoul(endptr2+1,&endptr3,0); |
| 167 | +if (endptr3==endptr2+1||*endptr3!='\0') |
159 | 168 | {
|
160 | 169 | fprintf(stderr,_("%s: invalid argument for option -l\n"),progname);
|
161 | 170 | fprintf(stderr,_("Try \"%s --help\" for more information.\n"),progname);
|
@@ -238,6 +247,9 @@ main(int argc, char *argv[])
|
238 | 247 | if (set_oid!=0)
|
239 | 248 | ControlFile.checkPointCopy.nextOid=set_oid;
|
240 | 249 |
|
| 250 | +if (minXlogTli>ControlFile.checkPointCopy.ThisTimeLineID) |
| 251 | +ControlFile.checkPointCopy.ThisTimeLineID=minXlogTli; |
| 252 | + |
241 | 253 | if (minXlogId>ControlFile.logId||
|
242 | 254 | (minXlogId==ControlFile.logId&&
|
243 | 255 | minXlogSeg>ControlFile.logSeg))
|
@@ -597,8 +609,8 @@ KillExistingXLOG(void)
|
597 | 609 | errno=0;
|
598 | 610 | while ((xlde=readdir(xldir))!=NULL)
|
599 | 611 | {
|
600 |
| -if (strlen(xlde->d_name)==16&& |
601 |
| -strspn(xlde->d_name,"0123456789ABCDEF")==16) |
| 612 | +if (strlen(xlde->d_name)==24&& |
| 613 | +strspn(xlde->d_name,"0123456789ABCDEF")==24) |
602 | 614 | {
|
603 | 615 | snprintf(path,MAXPGPATH,"%s/%s",XLogDir,xlde->d_name);
|
604 | 616 | if (unlink(path)<0)
|
@@ -739,7 +751,7 @@ usage(void)
|
739 | 751 | printf(_("Usage:\n %s [OPTION]... DATADIR\n\n"),progname);
|
740 | 752 | printf(_("Options:\n"));
|
741 | 753 | printf(_(" -f force update to be done\n"));
|
742 |
| -printf(_(" -lFILEID,SEG force minimum WAL starting location for new transaction log\n")); |
| 754 | +printf(_(" -lTLI,FILE,SEG force minimum WAL starting location for new transaction log\n")); |
743 | 755 | printf(_(" -n no update, just show extracted control values (for testing)\n"));
|
744 | 756 | printf(_(" -o OID set next OID\n"));
|
745 | 757 | printf(_(" -x XID set next transaction ID\n"));
|
|