tools/scylla-nodetool: print separator between samplings

instead of printing it out after samplings, we should print it
in between them. as toppartitions_test.py in dtest splits the
samplings using "\n\n". without this change, dtest would consider
the empty line as another sampling and then fail the test. as
the empty sampling does not match with the expected regular expressions.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
This commit is contained in:
Kefu Chai
2024-02-29 15:42:59 +08:00
parent a53457f740
commit ce45f93caf

View File

@@ -1995,6 +1995,9 @@ void toppartitions_operation(scylla_rest_client& client, const bpo::variables_ma
bool first = true;
for (const auto& operation : operations) {
// add a separator
if (!std::exchange(first, false)) {
fmt::print("\n");
}
auto cardinality = toppartitions[fmt::format("{}_cardinality", operation)].GetInt64();
fmt::print("{}S Sampler:\n", boost::to_upper_copy(operation));
fmt::print(" Cardinality: ~{} ({} capacity)\n", cardinality, capacity);
@@ -2028,9 +2031,6 @@ void toppartitions_operation(scylla_rest_client& client, const bpo::variables_ma
fmt::print("\t{:<{}}{:>10}{:>10}\n", record.partition, width, record.count, record.error);
}
}
if (std::exchange(first, false)) {
fmt::print("\n");
}
}
}