"repmgr cluster crosscheck": add --csv output

As advertised.
This commit is contained in:
Ian Barwick
2017-09-20 12:37:30 +09:00
parent e8c5886092
commit e8b74ea897

View File

@@ -623,7 +623,33 @@ do_cluster_crosscheck(void)
t_node_status_cube **cube; t_node_status_cube **cube;
n = build_cluster_crosscheck(&cube, &name_length); n = build_cluster_crosscheck(&cube, &name_length);
if (runtime_options.output_mode == OM_CSV)
{
for (i = 0; i < n; i++)
{
int j;
for (j = 0; j < n; j++)
{
int max_node_status = -2;
int node_ix = 0;
for (node_ix = 0; node_ix < n; node_ix++)
{
int node_status = cube[node_ix]->matrix_list_rec[i]->node_status_list[j]->node_status;
if (node_status > max_node_status)
max_node_status = node_status;
}
printf("%i,%i,%i\n",
cube[i]->node_id,
cube[j]->node_id,
max_node_status);
}
}
}
else
{
printf("%*s | Id ", name_length, node_header); printf("%*s | Id ", name_length, node_header);
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
printf("| %2d ", cube[i]->node_id); printf("| %2d ", cube[i]->node_id);
@@ -691,6 +717,7 @@ do_cluster_crosscheck(void)
printf("\n"); printf("\n");
} }
}
/* clean up allocated cube array */ /* clean up allocated cube array */
{ {