"daemon start": initial implementation

This commit is contained in:
Ian Barwick
2019-01-24 18:42:08 +09:00
committed by Ian Barwick
parent cbfef17a1d
commit 32b81e7d49
11 changed files with 270 additions and 30 deletions

View File

@@ -1746,6 +1746,31 @@ repmgrd_get_local_node_id(PGconn *conn)
}
bool
repmgrd_check_local_node_id(PGconn *conn)
{
PGresult *res = NULL;
bool node_id_settable = true;
const char *sqlquery = "SELECT repmgr.get_local_node_id()";
res = PQexec(conn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK)
{
log_db_error(conn, sqlquery, _("repmgrd_get_local_node_id(): unable to execute query"));
}
if (PQgetisnull(res, 0, 0))
{
node_id_settable = false;
}
PQclear(res);
return node_id_settable;
}
/*
* Function that checks if the primary is in exclusive backup mode.
* We'll use this when executing an action can conflict with an exclusive