mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 00:26:30 +00:00
repmgrd: check shared library is loaded
If this isn't the case, "repmgrd" will appear to run but not handle failover correctly. Address GitHub #337.
This commit is contained in:
22
dbutils.c
22
dbutils.c
@@ -1554,7 +1554,7 @@ repmgrd_set_local_node_id(PGconn *conn, int local_node_id)
|
||||
initPQExpBuffer(&query);
|
||||
|
||||
appendPQExpBuffer(&query,
|
||||
" SELECT repmgr.set_local_node_id(%i)",
|
||||
"SELECT repmgr.set_local_node_id(%i)",
|
||||
local_node_id);
|
||||
|
||||
res = PQexec(conn, query.data);
|
||||
@@ -1572,6 +1572,26 @@ repmgrd_set_local_node_id(PGconn *conn, int local_node_id)
|
||||
|
||||
|
||||
|
||||
int
|
||||
repmgrd_get_local_node_id(PGconn *conn)
|
||||
{
|
||||
PGresult *res = NULL;
|
||||
int local_node_id = UNKNOWN_NODE_ID;
|
||||
|
||||
res = PQexec(conn, "SELECT repmgr.get_local_node_id()");
|
||||
|
||||
if (!PQgetisnull(res, 0, 0))
|
||||
{
|
||||
local_node_id = atoi(PQgetvalue(res, 0, 0));
|
||||
}
|
||||
|
||||
PQclear(res);
|
||||
|
||||
return local_node_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ================ */
|
||||
/* result functions */
|
||||
/* ================ */
|
||||
|
||||
Reference in New Issue
Block a user