From e199afd4cf3d29f7e273697aa24a65bf146831da Mon Sep 17 00:00:00 2001 From: Bharath Rupireddy Date: Thu, 3 Feb 2022 12:42:42 +0000 Subject: [PATCH v1] sample patch --- src/bin/pg_controldata/pg_controldata.c | 9 ++++++--- src/bin/pg_resetwal/pg_resetwal.c | 3 ++- src/bin/pg_upgrade/controldata.c | 3 ++- src/include/catalog/pg_control.h | 4 ++++ 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c index f911f98d94..091669eb33 100644 --- a/src/bin/pg_controldata/pg_controldata.c +++ b/src/bin/pg_controldata/pg_controldata.c @@ -237,11 +237,14 @@ main(int argc, char *argv[]) pgctime_str); printf(_("Latest checkpoint location: %X/%X\n"), LSN_FORMAT_ARGS(ControlFile->checkPoint)); - printf(_("Latest checkpoint's REDO location: %X/%X\n"), + printf(_("%s %X/%X\n"), + PG_CONTROL_FIELD_CHECKPOINT_REDO_LOC, LSN_FORMAT_ARGS(ControlFile->checkPointCopy.redo)); - printf(_("Latest checkpoint's REDO WAL file: %s\n"), + printf(_("%s %s\n"), + PG_CONTROL_FIELD_CHECKPOINT_REDO_WAL_FILE, xlogfilename); - printf(_("Latest checkpoint's TimeLineID: %u\n"), + printf(_("%s %u\n"), + PG_CONTROL_FIELD_CHECKPOINT_TLI, ControlFile->checkPointCopy.ThisTimeLineID); printf(_("Latest checkpoint's PrevTimeLineID: %u\n"), ControlFile->checkPointCopy.PrevTimeLineID); diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c index 1eb4509fca..e829bf100e 100644 --- a/src/bin/pg_resetwal/pg_resetwal.c +++ b/src/bin/pg_resetwal/pg_resetwal.c @@ -768,7 +768,8 @@ PrintControlValues(bool guessed) ControlFile.catalog_version_no); printf(_("Database system identifier: %llu\n"), (unsigned long long) ControlFile.system_identifier); - printf(_("Latest checkpoint's TimeLineID: %u\n"), + printf(_("%s %u\n"), + PG_CONTROL_FIELD_CHECKPOINT_TLI, ControlFile.checkPointCopy.ThisTimeLineID); printf(_("Latest checkpoint's full_page_writes: %s\n"), ControlFile.checkPointCopy.fullPageWrites ? _("on") : _("off")); diff --git a/src/bin/pg_upgrade/controldata.c b/src/bin/pg_upgrade/controldata.c index 41b8f69b8c..9417829b16 100644 --- a/src/bin/pg_upgrade/controldata.c +++ b/src/bin/pg_upgrade/controldata.c @@ -11,6 +11,7 @@ #include +#include "catalog/pg_control.h" #include "pg_upgrade.h" /* @@ -228,7 +229,7 @@ get_control_data(ClusterInfo *cluster, bool live_check) p++; /* remove ':' char */ cluster->controldata.cat_ver = str2uint(p); } - else if ((p = strstr(bufin, "Latest checkpoint's TimeLineID:")) != NULL) + else if ((p = strstr(bufin, PG_CONTROL_FIELD_CHECKPOINT_TLI)) != NULL) { p = strchr(p, ':'); diff --git a/src/include/catalog/pg_control.h b/src/include/catalog/pg_control.h index 1f3dc24ac1..377c7637d0 100644 --- a/src/include/catalog/pg_control.h +++ b/src/include/catalog/pg_control.h @@ -27,6 +27,10 @@ /* Nonce key length, see below */ #define MOCK_AUTH_NONCE_LEN 32 +#define PG_CONTROL_FIELD_CHECKPOINT_REDO_LOC "Latest checkpoint's REDO location:" +#define PG_CONTROL_FIELD_CHECKPOINT_REDO_WAL_FILE "Latest checkpoint's REDO WAL file:" +#define PG_CONTROL_FIELD_CHECKPOINT_TLI "Latest checkpoint's TimeLineID:" + /* * Body of CheckPoint XLOG records. This is declared here because we keep * a copy of the latest one in pg_control for possible disaster recovery. -- 2.25.1