"cluster show": fix formatting with multiple digit node IDs

This commit is contained in:
Ian Barwick
2019-02-02 14:04:30 +09:00
parent f24b30327c
commit 59ed86c01a
3 changed files with 15 additions and 1 deletions

View File

@@ -14,6 +14,7 @@
it will actually be possible to stream from the target node (Ian)
repmgr: "standby switchover": improve handling of connection URIs when
executing "node rejoin" on the demotion candidate; GitHub #525 (Ian)
repmgr: fix long node ID display in "cluster show"; (Ian)
repmgrd: check binary and extension major versions match; GitHub #515 (Ian)
repmgrd: on a cascaded standby, don't fail over if "failover=manual";
GitHub #531 (Ian)

View File

@@ -155,11 +155,18 @@ REPMGRD_OPTS="--daemonize=false"</programlisting>
<listitem>
<para>
<application>repmgrd</application>: on a cascaded standby, don't fail over if
<application>repmgrd</application>: on a cascaded standby, don't fail over if
<literal>failover=manual</literal>. GitHub #531.
</para>
</listitem>
<listitem>
<para>
<command><link linkend="repmgr-cluster-show">repmgr cluster show</link></command>:
fix display of node IDs with multiple digits.
</para>
</listitem>
</itemizedlist>
</para>
</sect2>

View File

@@ -137,6 +137,7 @@ do_cluster_show(void)
for (cell = nodes.head; cell; cell = cell->next)
{
PQExpBufferData details;
PQExpBufferData node_id;
cell->node_info->conn = establish_db_connection_quiet(cell->node_info->conninfo);
@@ -352,6 +353,11 @@ do_cluster_show(void)
PQfinish(cell->node_info->conn);
cell->node_info->conn = NULL;
initPQExpBuffer(&node_id);
appendPQExpBuffer(&node_id, "%i", cell->node_info->node_id);
headers_show[SHOW_ID].cur_length = strlen(node_id.data);
termPQExpBuffer(&node_id);
headers_show[SHOW_ROLE].cur_length = strlen(get_node_type_string(cell->node_info->type));
headers_show[SHOW_NAME].cur_length = strlen(cell->node_info->node_name);
headers_show[SHOW_STATUS].cur_length = strlen(cell->node_info->details);