mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 16:46:28 +00:00
repmgr: don't count witness node as a standby when running "node status"
Addresses GitHub #451.
This commit is contained in:
@@ -2179,7 +2179,8 @@ get_downstream_nodes_with_missing_slot(PGconn *conn, int this_node_id, NodeInfoL
|
|||||||
" ON rs.slot_name = n.slot_name "
|
" ON rs.slot_name = n.slot_name "
|
||||||
" WHERE n.slot_name IS NOT NULL"
|
" WHERE n.slot_name IS NOT NULL"
|
||||||
" AND rs.slot_name IS NULL "
|
" AND rs.slot_name IS NULL "
|
||||||
" AND n.upstream_node_id = %i ",
|
" AND n.upstream_node_id = %i "
|
||||||
|
" AND n.type = 'standby'",
|
||||||
this_node_id);
|
this_node_id);
|
||||||
|
|
||||||
log_verbose(LOG_DEBUG, "get_all_node_records_with_missing_slot():\n%s", query.data);
|
log_verbose(LOG_DEBUG, "get_all_node_records_with_missing_slot():\n%s", query.data);
|
||||||
|
|||||||
@@ -256,42 +256,16 @@ do_node_status(void)
|
|||||||
"Replication slots",
|
"Replication slots",
|
||||||
"not available");
|
"not available");
|
||||||
}
|
}
|
||||||
else if (node_info.max_replication_slots > 0)
|
|
||||||
{
|
|
||||||
PQExpBufferData slotinfo;
|
|
||||||
|
|
||||||
initPQExpBuffer(&slotinfo);
|
|
||||||
|
|
||||||
appendPQExpBuffer(&slotinfo,
|
|
||||||
"%i (of maximal %i)",
|
|
||||||
node_info.active_replication_slots + node_info.inactive_replication_slots,
|
|
||||||
node_info.max_replication_slots);
|
|
||||||
|
|
||||||
|
|
||||||
if (node_info.inactive_replication_slots > 0)
|
|
||||||
{
|
|
||||||
appendPQExpBuffer(&slotinfo,
|
|
||||||
"; %i inactive",
|
|
||||||
node_info.inactive_replication_slots);
|
|
||||||
|
|
||||||
item_list_append_format(&warnings,
|
|
||||||
_("- node has %i inactive replication slots"),
|
|
||||||
node_info.inactive_replication_slots);
|
|
||||||
}
|
|
||||||
|
|
||||||
key_value_list_set(&node_status,
|
|
||||||
"Replication slots",
|
|
||||||
slotinfo.data);
|
|
||||||
|
|
||||||
termPQExpBuffer(&slotinfo);
|
|
||||||
}
|
|
||||||
else if (node_info.max_replication_slots == 0)
|
else if (node_info.max_replication_slots == 0)
|
||||||
{
|
{
|
||||||
key_value_list_set(&node_status,
|
key_value_list_set(&node_status,
|
||||||
"Replication slots",
|
"Replication slots",
|
||||||
"disabled");
|
"disabled");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PQExpBufferData slotinfo;
|
||||||
|
NodeInfoList missing_slots = T_NODE_INFO_LIST_INITIALIZER;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* check for missing replication slots - we do this regardless of
|
* check for missing replication slots - we do this regardless of
|
||||||
@@ -299,9 +273,6 @@ do_node_status(void)
|
|||||||
* node was configured with "use_replication_slots=true" and is
|
* node was configured with "use_replication_slots=true" and is
|
||||||
* expecting a replication slot to be available
|
* expecting a replication slot to be available
|
||||||
*/
|
*/
|
||||||
|
|
||||||
{
|
|
||||||
NodeInfoList missing_slots = T_NODE_INFO_LIST_INITIALIZER;
|
|
||||||
get_downstream_nodes_with_missing_slot(conn,
|
get_downstream_nodes_with_missing_slot(conn,
|
||||||
config_file_options.node_id,
|
config_file_options.node_id,
|
||||||
&missing_slots);
|
&missing_slots);
|
||||||
@@ -323,6 +294,31 @@ do_node_status(void)
|
|||||||
missing_slot_cell->node_info->slot_name);
|
missing_slot_cell->node_info->slot_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initPQExpBuffer(&slotinfo);
|
||||||
|
|
||||||
|
appendPQExpBuffer(&slotinfo,
|
||||||
|
"%i (of maximal %i; %i missing)",
|
||||||
|
node_info.active_replication_slots + node_info.inactive_replication_slots,
|
||||||
|
node_info.max_replication_slots,
|
||||||
|
missing_slots.node_count);
|
||||||
|
|
||||||
|
if (node_info.inactive_replication_slots > 0)
|
||||||
|
{
|
||||||
|
appendPQExpBuffer(&slotinfo,
|
||||||
|
"; %i inactive",
|
||||||
|
node_info.inactive_replication_slots);
|
||||||
|
|
||||||
|
item_list_append_format(&warnings,
|
||||||
|
_("- node has %i inactive replication slots"),
|
||||||
|
node_info.inactive_replication_slots);
|
||||||
|
}
|
||||||
|
|
||||||
|
key_value_list_set(&node_status,
|
||||||
|
"Replication slots",
|
||||||
|
slotinfo.data);
|
||||||
|
|
||||||
|
termPQExpBuffer(&slotinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user