mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
Improve BDR3 node query
We can get everything we need from bdr.node_summary
This commit is contained in:
11
dbutils.c
11
dbutils.c
@@ -4851,9 +4851,7 @@ get_all_bdr_node_records(PGconn *conn, BdrNodeInfoList *node_list)
|
||||
{
|
||||
appendPQExpBuffer(&query,
|
||||
" SELECT " BDR3_NODES_COLUMNS
|
||||
" FROM bdr.node bn "
|
||||
" INNER JOIN pglogical.node_interface pni "
|
||||
" ON bn.pglogical_node_id = pni.if_nodeid "
|
||||
" FROM bdr.node_summary ns "
|
||||
" ORDER BY node_name");
|
||||
}
|
||||
|
||||
@@ -4888,10 +4886,8 @@ get_bdr_node_record_by_name(PGconn *conn, const char *node_name, t_bdr_node_info
|
||||
{
|
||||
appendPQExpBuffer(&query,
|
||||
" SELECT " BDR3_NODES_COLUMNS
|
||||
" FROM bdr.node bn "
|
||||
" INNER JOIN pglogical.node_interface pni "
|
||||
" ON bn.pglogical_node_id = pni.if_nodeid "
|
||||
" WHERE bn.node_name = '%s'",
|
||||
" FROM bdr.node_summary ns "
|
||||
" WHERE ns.node_name = '%s'",
|
||||
node_name);
|
||||
}
|
||||
|
||||
@@ -4968,6 +4964,7 @@ _populate_bdr_node_record(PGresult *res, t_bdr_node_info *node_info, int row)
|
||||
node_info->node_dboid = atoi(PQgetvalue(res, row, 2));
|
||||
strncpy(node_info->node_name, PQgetvalue(res, row, 3), MAXLEN);
|
||||
strncpy(node_info->node_local_dsn, PQgetvalue(res, row, 4), MAXLEN);
|
||||
strncpy(node_info->peer_state_name, PQgetvalue(res, row, 5), MAXLEN);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
#include "voting.h"
|
||||
|
||||
#define REPMGR_NODES_COLUMNS "n.node_id, n.type, n.upstream_node_id, n.node_name, n.conninfo, n.repluser, n.slot_name, n.location, n.priority, n.active, n.config_file, '' AS upstream_node_name "
|
||||
#define BDR2_NODES_COLUMNS "node_sysid, node_timeline, node_dboid, node_name, node_local_dsn"
|
||||
#define BDR3_NODES_COLUMNS "bn.pglogical_node_id, 0, 0, pni.if_name AS node_name, pni.if_dsn AS node_init_from_dsn"
|
||||
#define BDR2_NODES_COLUMNS "node_sysid, node_timeline, node_dboid, node_name, node_local_dsn, ''"
|
||||
#define BDR3_NODES_COLUMNS "ns.node_id, 0, 0, ns.node_name, ns.interface_connstr, ns.peer_state_name"
|
||||
|
||||
|
||||
#define ERRBUFF_SIZE 512
|
||||
@@ -241,11 +241,12 @@ typedef struct s_bdr_node_info
|
||||
uint32 node_dboid;
|
||||
char node_name[MAXLEN];
|
||||
char node_local_dsn[MAXLEN];
|
||||
char peer_state_name[MAXLEN];
|
||||
} t_bdr_node_info;
|
||||
|
||||
#define T_BDR_NODE_INFO_INITIALIZER { \
|
||||
"", InvalidOid, InvalidOid, \
|
||||
"", "", \
|
||||
"", "", "" \
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ do_bdr_register(void)
|
||||
/* BDR 2 implementation is for 2 nodes only */
|
||||
if (get_bdr_version_num() < 3 && bdr_nodes.node_count > 2)
|
||||
{
|
||||
log_error(_("repmgr can only support BDR clusters with 2 nodes"));
|
||||
log_error(_("repmgr can only support BDR 2.x clusters with 2 nodes"));
|
||||
log_detail(_("this BDR cluster has %i nodes"), bdr_nodes.node_count);
|
||||
PQfinish(conn);
|
||||
pfree(dbname);
|
||||
|
||||
@@ -1503,6 +1503,7 @@ check_cli_parameters(const int action)
|
||||
case STANDBY_CLONE:
|
||||
case STANDBY_REGISTER:
|
||||
case STANDBY_FOLLOW:
|
||||
case BDR_REGISTER:
|
||||
break;
|
||||
default:
|
||||
item_list_append_format(&cli_warnings,
|
||||
|
||||
Reference in New Issue
Block a user