From ce45f93caf876d02df6bb324615ec8900c32dc09 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 29 Feb 2024 15:42:59 +0800 Subject: [PATCH] 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 --- tools/scylla-nodetool.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/scylla-nodetool.cc b/tools/scylla-nodetool.cc index 224fa3e217..ad3f984c2f 100644 --- a/tools/scylla-nodetool.cc +++ b/tools/scylla-nodetool.cc @@ -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"); - } } }