mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 08:36:30 +00:00
When registering a BDR node, sync repmgr.nodes from another node
If a BDR node is added via bdr_group_join(), repmgr.nodes will start off empty, so we'll need to sync it ourselves before adding it to the repmgr replication set.
This commit is contained in:
27
dbutils.c
27
dbutils.c
@@ -1436,6 +1436,30 @@ void _populate_node_records(PGresult *res, NodeInfoList *node_list)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
get_all_node_records(PGconn *conn, NodeInfoList *node_list)
|
||||
{
|
||||
PQExpBufferData query;
|
||||
PGresult *res;
|
||||
|
||||
initPQExpBuffer(&query);
|
||||
|
||||
appendPQExpBuffer(&query,
|
||||
" SELECT node_id, type, upstream_node_id, node_name, conninfo, repluser, slot_name, location, priority, active"
|
||||
" FROM repmgr.nodes "
|
||||
"ORDER BY node_id ");
|
||||
|
||||
log_verbose(LOG_DEBUG, "get_all_node_records():\n%s", query.data);
|
||||
|
||||
res = PQexec(conn, query.data);
|
||||
|
||||
termPQExpBuffer(&query);
|
||||
|
||||
_populate_node_records(res, node_list);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
get_downstream_node_records(PGconn *conn, int node_id, NodeInfoList *node_list)
|
||||
{
|
||||
@@ -2996,7 +3020,8 @@ get_bdr_init_node_record(PGconn *conn, t_bdr_node_info *node_info)
|
||||
|
||||
if (!res || PQresultStatus(res) != PGRES_TUPLES_OK)
|
||||
{
|
||||
//
|
||||
PQclear(res);
|
||||
return RECORD_NOT_FOUND;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user