Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita6427f1

Browse files
committed
Unbreak pg_resetxlog -l.
Fujii Masao
1 parent2dfa87b commita6427f1

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

‎src/bin/pg_resetxlog/pg_resetxlog.c

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,13 @@ main(int argc, char *argv[])
8686
Oidset_oid=0;
8787
MultiXactIdset_mxid=0;
8888
MultiXactOffsetset_mxoff= (MultiXactOffset)-1;
89-
uint32minXlogTli=0;
89+
uint32minXlogTli=0,
90+
minXlogId=0,
91+
minXlogSeg=0;
9092
XLogSegNominXlogSegNo=0;
9193
char*endptr;
94+
char*endptr2;
95+
char*endptr3;
9296
char*DataDir;
9397
intfd;
9498
charpath[MAXPGPATH];
@@ -200,13 +204,28 @@ main(int argc, char *argv[])
200204
break;
201205

202206
case'l':
203-
if (strspn(optarg,"01234567890ABCDEFabcdef")!=24)
207+
minXlogTli=strtoul(optarg,&endptr,0);
208+
if (endptr==optarg||*endptr!=',')
204209
{
205210
fprintf(stderr,_("%s: invalid argument for option -l\n"),progname);
206211
fprintf(stderr,_("Try \"%s --help\" for more information.\n"),progname);
207212
exit(1);
208213
}
209-
XLogFromFileName(optarg,&minXlogTli,&minXlogSegNo);
214+
minXlogId=strtoul(endptr+1,&endptr2,0);
215+
if (endptr2==endptr+1||*endptr2!=',')
216+
{
217+
fprintf(stderr,_("%s: invalid argument for option -l\n"),progname);
218+
fprintf(stderr,_("Try \"%s --help\" for more information.\n"),progname);
219+
exit(1);
220+
}
221+
minXlogSeg=strtoul(endptr2+1,&endptr3,0);
222+
if (endptr3==endptr2+1||*endptr3!='\0')
223+
{
224+
fprintf(stderr,_("%s: invalid argument for option -l\n"),progname);
225+
fprintf(stderr,_("Try \"%s --help\" for more information.\n"),progname);
226+
exit(1);
227+
}
228+
minXlogSegNo= (uint64)minXlogId*XLogSegmentsPerXLogId+minXlogSeg;
210229
break;
211230

212231
default:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp