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

Commit6c349a5

Browse files
committed
Print the name of the WAL file containing latest REDO ptr in pg_controldata.
This makes it easier to determine how far back you need to keep archived WALfiles, to restore from a backup.Fujii Masao
1 parent8e708e5 commit6c349a5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

‎src/bin/pg_controldata/pg_controldata.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include<fcntl.h>
2525

2626
#include"access/xlog.h"
27+
#include"access/xlog_internal.h"
2728
#include"catalog/pg_control.h"
2829

2930

@@ -95,6 +96,8 @@ main(int argc, char *argv[])
9596
charsysident_str[32];
9697
constchar*strftime_fmt="%c";
9798
constchar*progname;
99+
XLogSegNosegno;
100+
charxlogfilename[MAXFNAMELEN];
98101

99102
set_pglocale_pgservice(argv[0],PG_TEXTDOMAIN("pg_controldata"));
100103

@@ -170,6 +173,13 @@ main(int argc, char *argv[])
170173
strftime(ckpttime_str,sizeof(ckpttime_str),strftime_fmt,
171174
localtime(&time_tmp));
172175

176+
/*
177+
* Calculate name of the WAL file containing the latest checkpoint's REDO
178+
* start point.
179+
*/
180+
XLByteToSeg(ControlFile.checkPointCopy.redo,segno);
181+
XLogFileName(xlogfilename,ControlFile.checkPointCopy.ThisTimeLineID,segno);
182+
173183
/*
174184
* Format system_identifier separately to keep platform-dependent format
175185
* code out of the translatable message string.
@@ -201,6 +211,8 @@ main(int argc, char *argv[])
201211
printf(_("Latest checkpoint's REDO location: %X/%X\n"),
202212
(uint32) (ControlFile.checkPointCopy.redo >>32),
203213
(uint32)ControlFile.checkPointCopy.redo);
214+
printf(_("Latest checkpoint's REDO WAL file: %s\n"),
215+
xlogfilename);
204216
printf(_("Latest checkpoint's TimeLineID: %u\n"),
205217
ControlFile.checkPointCopy.ThisTimeLineID);
206218
printf(_("Latest checkpoint's full_page_writes: %s\n"),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp