"repmgr node ...": update comments and formatting

This commit is contained in:
Ian Barwick
2018-06-21 12:12:07 +09:00
parent b0ed87832b
commit 269e3242c8

View File

@@ -90,7 +90,7 @@ do_node_status(void)
server_version_num = get_server_version(conn, NULL); server_version_num = get_server_version(conn, NULL);
/* Check node exists and is really a standby */ /* check node exists */
if (get_node_record_with_upstream(conn, config_file_options.node_id, &node_info) != RECORD_FOUND) if (get_node_record_with_upstream(conn, config_file_options.node_id, &node_info) != RECORD_FOUND)
{ {
@@ -108,18 +108,15 @@ do_node_status(void)
get_node_replication_stats(conn, server_version_num, &node_info); get_node_replication_stats(conn, server_version_num, &node_info);
key_value_list_set( key_value_list_set(&node_status,
&node_status,
"PostgreSQL version", "PostgreSQL version",
server_version); server_version);
key_value_list_set( key_value_list_set(&node_status,
&node_status,
"Total data size", "Total data size",
cluster_size); cluster_size);
key_value_list_set( key_value_list_set(&node_status,
&node_status,
"Conninfo", "Conninfo",
node_info.conninfo); node_info.conninfo);
@@ -129,14 +126,12 @@ do_node_status(void)
local_system_identifier = get_system_identifier(config_file_options.data_directory); local_system_identifier = get_system_identifier(config_file_options.data_directory);
key_value_list_set_format( key_value_list_set_format(&node_status,
&node_status,
"System identifier", "System identifier",
"%lu", local_system_identifier); "%lu", local_system_identifier);
} }
key_value_list_set( key_value_list_set(&node_status,
&node_status,
"Role", "Role",
get_node_type_string(node_info.type)); get_node_type_string(node_info.type));
@@ -145,16 +140,14 @@ do_node_status(void)
case PRIMARY: case PRIMARY:
if (recovery_type == RECTYPE_STANDBY) if (recovery_type == RECTYPE_STANDBY)
{ {
item_list_append( item_list_append(&warnings,
&warnings,
_("- node is registered as primary but running as standby")); _("- node is registered as primary but running as standby"));
} }
break; break;
case STANDBY: case STANDBY:
if (recovery_type == RECTYPE_PRIMARY) if (recovery_type == RECTYPE_PRIMARY)
{ {
item_list_append( item_list_append(&warnings,
&warnings,
_("- node is registered as standby but running as primary")); _("- node is registered as standby but running as primary"));
} }
break; break;
@@ -165,13 +158,11 @@ do_node_status(void)
if (guc_set(conn, "archive_mode", "=", "off")) if (guc_set(conn, "archive_mode", "=", "off"))
{ {
key_value_list_set( key_value_list_set(&node_status,
&node_status,
"WAL archiving", "WAL archiving",
"off"); "off");
key_value_list_set( key_value_list_set(&node_status,
&node_status,
"Archive command", "Archive command",
"(none)"); "(none)");
} }
@@ -202,8 +193,7 @@ do_node_status(void)
appendPQExpBuffer(&archiving_status, " (on standbys \"archive_mode\" must be set to \"always\" to be effective)"); appendPQExpBuffer(&archiving_status, " (on standbys \"archive_mode\" must be set to \"always\" to be effective)");
} }
key_value_list_set( key_value_list_set(&node_status,
&node_status,
"WAL archiving", "WAL archiving",
archiving_status.data); archiving_status.data);
@@ -211,8 +201,7 @@ do_node_status(void)
get_pg_setting(conn, "archive_command", archive_command); get_pg_setting(conn, "archive_command", archive_command);
key_value_list_set( key_value_list_set(&node_status,
&node_status,
"Archive command", "Archive command",
archive_command); archive_command);
} }
@@ -224,16 +213,14 @@ do_node_status(void)
if (runtime_options.output_mode == OM_CSV) if (runtime_options.output_mode == OM_CSV)
{ {
key_value_list_set_format( key_value_list_set_format(&node_status,
&node_status,
"WALs pending archiving", "WALs pending archiving",
"%i", "%i",
ready_files); ready_files);
} }
else else
{ {
key_value_list_set_format( key_value_list_set_format(&node_status,
&node_status,
"WALs pending archiving", "WALs pending archiving",
"%i pending files", "%i pending files",
ready_files); ready_files);
@@ -1384,12 +1371,10 @@ do_node_check_downstream(PGconn *conn, OutputMode mode, CheckStatusList *list_ou
if (missing_nodes_count == 0) if (missing_nodes_count == 0)
{ {
if (expected_nodes_count == 0) if (expected_nodes_count == 0)
appendPQExpBuffer( appendPQExpBuffer(&details,
&details,
"this node has no downstream nodes"); "this node has no downstream nodes");
else else
appendPQExpBuffer( appendPQExpBuffer(&details,
&details,
"%i of %i downstream nodes attached", "%i of %i downstream nodes attached",
expected_nodes_count - missing_nodes_count, expected_nodes_count - missing_nodes_count,
expected_nodes_count); expected_nodes_count);