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 WAL files, to restore from a backup. Fujii Masao
This commit is contained in:
parent
8e708e5e36
commit
6c349a565a
@ -24,6 +24,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include "access/xlog.h"
|
#include "access/xlog.h"
|
||||||
|
#include "access/xlog_internal.h"
|
||||||
#include "catalog/pg_control.h"
|
#include "catalog/pg_control.h"
|
||||||
|
|
||||||
|
|
||||||
@ -95,6 +96,8 @@ main(int argc, char *argv[])
|
|||||||
char sysident_str[32];
|
char sysident_str[32];
|
||||||
const char *strftime_fmt = "%c";
|
const char *strftime_fmt = "%c";
|
||||||
const char *progname;
|
const char *progname;
|
||||||
|
XLogSegNo segno;
|
||||||
|
char xlogfilename[MAXFNAMELEN];
|
||||||
|
|
||||||
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_controldata"));
|
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_controldata"));
|
||||||
|
|
||||||
@ -170,6 +173,13 @@ main(int argc, char *argv[])
|
|||||||
strftime(ckpttime_str, sizeof(ckpttime_str), strftime_fmt,
|
strftime(ckpttime_str, sizeof(ckpttime_str), strftime_fmt,
|
||||||
localtime(&time_tmp));
|
localtime(&time_tmp));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Calculate name of the WAL file containing the latest checkpoint's REDO
|
||||||
|
* start point.
|
||||||
|
*/
|
||||||
|
XLByteToSeg(ControlFile.checkPointCopy.redo, segno);
|
||||||
|
XLogFileName(xlogfilename, ControlFile.checkPointCopy.ThisTimeLineID, segno);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Format system_identifier separately to keep platform-dependent format
|
* Format system_identifier separately to keep platform-dependent format
|
||||||
* code out of the translatable message string.
|
* code out of the translatable message string.
|
||||||
@ -201,6 +211,8 @@ main(int argc, char *argv[])
|
|||||||
printf(_("Latest checkpoint's REDO location: %X/%X\n"),
|
printf(_("Latest checkpoint's REDO location: %X/%X\n"),
|
||||||
(uint32) (ControlFile.checkPointCopy.redo >> 32),
|
(uint32) (ControlFile.checkPointCopy.redo >> 32),
|
||||||
(uint32) ControlFile.checkPointCopy.redo);
|
(uint32) ControlFile.checkPointCopy.redo);
|
||||||
|
printf(_("Latest checkpoint's REDO WAL file: %s\n"),
|
||||||
|
xlogfilename);
|
||||||
printf(_("Latest checkpoint's TimeLineID: %u\n"),
|
printf(_("Latest checkpoint's TimeLineID: %u\n"),
|
||||||
ControlFile.checkPointCopy.ThisTimeLineID);
|
ControlFile.checkPointCopy.ThisTimeLineID);
|
||||||
printf(_("Latest checkpoint's full_page_writes: %s\n"),
|
printf(_("Latest checkpoint's full_page_writes: %s\n"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user