From b95b3e50e3278bc6ab6f45761686f0c8e30e7d76 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Mon, 14 Aug 2017 08:50:54 +0900 Subject: [PATCH] Return system identification information with appropriate data types --- dbutils.c | 2 +- dbutils.h | 6 +++--- repmgr.h | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/dbutils.c b/dbutils.c index 849f4d23..468058e1 100644 --- a/dbutils.c +++ b/dbutils.c @@ -1455,7 +1455,7 @@ identify_system(PGconn *replconn, t_system_identification *identification) return false; } - strncpy(identification->systemid, PQgetvalue(res, 0, 0), MAXLEN); + identification->system_identifier = atol(PQgetvalue(res, 0, 0)); identification->timeline = atoi(PQgetvalue(res, 0, 1)); identification->xlogpos = parse_lsn(PQgetvalue(res, 0, 2)); diff --git a/dbutils.h b/dbutils.h index 006426f2..d014d959 100644 --- a/dbutils.h +++ b/dbutils.h @@ -266,13 +266,13 @@ typedef struct typedef struct { - char systemid[MAXLEN]; - int timeline; + uint64 system_identifier; + TimeLineID timeline; XLogRecPtr xlogpos; } t_system_identification; #define T_SYSTEM_IDENTIFICATION_INITIALIZER { \ - "", \ + UNKNOWN_SYSTEM_IDENTIFIER, \ UNKNOWN_TIMELINE_ID, \ InvalidXLogRecPtr \ } diff --git a/repmgr.h b/repmgr.h index 3fa783c0..ce7d76f3 100644 --- a/repmgr.h +++ b/repmgr.h @@ -34,6 +34,7 @@ #define UNKNOWN_SERVER_VERSION_NUM -1 #define UNKNOWN_TIMELINE_ID -1 +#define UNKNOWN_SYSTEM_IDENTIFIER -1 #define NODE_NOT_FOUND -1 #define NO_UPSTREAM_NODE -1