Fixes for 9.3 support

This commit is contained in:
Ian Barwick
2017-09-15 17:13:17 +09:00
parent 192f968d29
commit 31c7cb4e9a
2 changed files with 17 additions and 4 deletions

View File

@@ -3619,10 +3619,6 @@ request_vote(PGconn *conn, t_node_info *this_node, t_node_info *other_node, int
"SELECT repmgr.request_vote(%i, %i)", "SELECT repmgr.request_vote(%i, %i)",
this_node->node_id, this_node->node_id,
electoral_term); electoral_term);
/* "SELECT repmgr.request_vote(%i, '%X/%X'::pg_lsn)",
this_node->node_id,
(uint32) (last_wal_receive_lsn >> 32),
(uint32) last_wal_receive_lsn);*/
res = PQexec(conn, query.data); res = PQexec(conn, query.data);
termPQExpBuffer(&query); termPQExpBuffer(&query);

View File

@@ -333,7 +333,12 @@ request_vote(PG_FUNCTION_ARGS)
{ {
SPI_finish(); SPI_finish();
elog(WARNING, "unable to retrieve last received LSN"); elog(WARNING, "unable to retrieve last received LSN");
#if (PG_VERSION_NUM >= 90400)
PG_RETURN_LSN(InvalidOid); PG_RETURN_LSN(InvalidOid);
#else
PG_RETURN_TEXT_P(cstring_to_text("0/0"));
#endif
} }
our_lsn = DatumGetLSN(SPI_getbinval(SPI_tuptable->vals[0], our_lsn = DatumGetLSN(SPI_getbinval(SPI_tuptable->vals[0],
@@ -354,7 +359,19 @@ request_vote(PG_FUNCTION_ARGS)
/* should we free "query" here? */ /* should we free "query" here? */
SPI_finish(); SPI_finish();
#if (PG_VERSION_NUM >= 90400)
PG_RETURN_LSN(our_lsn); PG_RETURN_LSN(our_lsn);
#else
{
char lsn_text[64] = "";
snprintf(lsn_text, 64,
"%X/%X",
(uint32) (our_lsn >> 32),
(uint32) our_lsn);
PG_RETURN_TEXT_P(cstring_to_text(lsn_text));
}
#endif
#else #else
PG_RETURN(InvalidOid); PG_RETURN(InvalidOid);
#endif #endif