Return system identification information with appropriate data types

This commit is contained in:
Ian Barwick
2017-08-14 08:50:54 +09:00
parent 50b82f785e
commit b95b3e50e3
3 changed files with 5 additions and 4 deletions

View File

@@ -1455,7 +1455,7 @@ identify_system(PGconn *replconn, t_system_identification *identification)
return false; 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->timeline = atoi(PQgetvalue(res, 0, 1));
identification->xlogpos = parse_lsn(PQgetvalue(res, 0, 2)); identification->xlogpos = parse_lsn(PQgetvalue(res, 0, 2));

View File

@@ -266,13 +266,13 @@ typedef struct
typedef struct typedef struct
{ {
char systemid[MAXLEN]; uint64 system_identifier;
int timeline; TimeLineID timeline;
XLogRecPtr xlogpos; XLogRecPtr xlogpos;
} t_system_identification; } t_system_identification;
#define T_SYSTEM_IDENTIFICATION_INITIALIZER { \ #define T_SYSTEM_IDENTIFICATION_INITIALIZER { \
"", \ UNKNOWN_SYSTEM_IDENTIFIER, \
UNKNOWN_TIMELINE_ID, \ UNKNOWN_TIMELINE_ID, \
InvalidXLogRecPtr \ InvalidXLogRecPtr \
} }

View File

@@ -34,6 +34,7 @@
#define UNKNOWN_SERVER_VERSION_NUM -1 #define UNKNOWN_SERVER_VERSION_NUM -1
#define UNKNOWN_TIMELINE_ID -1 #define UNKNOWN_TIMELINE_ID -1
#define UNKNOWN_SYSTEM_IDENTIFIER -1
#define NODE_NOT_FOUND -1 #define NODE_NOT_FOUND -1
#define NO_UPSTREAM_NODE -1 #define NO_UPSTREAM_NODE -1