Repository: kudu
Updated Branches:
  refs/heads/master 61cd9510f -> eb81a04db


[tools] Fix and simplify tablet summary spacing

ee0a75c5a2 attempted to fix spacing of tablet summaries but
messed up the case when a tablet is healthy, causing ksck to
print an empty line for every healthy tablet. This fixes that
and simplifies how the spacing is done.

I tested manually that this produces well-spaced output in the
three cases:
1. No tablets.
2. All healthy tablets in PLAIN_CONCISE mode (so no tablet info printed).
3. Some unhealthy tablets.

Change-Id: Ia1a9acfc27733e9c1df15cfe5cfc7822b0ca7304
Reviewed-on: http://gerrit.cloudera.org:8080/10416
Tested-by: Kudu Jenkins
Reviewed-by: Alexey Serbin <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/93caf447
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/93caf447
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/93caf447

Branch: refs/heads/master
Commit: 93caf4473f2fb22fbb4cdc42d5f3b24f5d26f475
Parents: 61cd951
Author: Will Berkeley <[email protected]>
Authored: Tue May 15 13:53:09 2018 -0700
Committer: Alexey Serbin <[email protected]>
Committed: Tue May 15 22:30:34 2018 +0000

----------------------------------------------------------------------
 src/kudu/tools/ksck_results.cc | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/93caf447/src/kudu/tools/ksck_results.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/ksck_results.cc b/src/kudu/tools/ksck_results.cc
index 29776a6..adcbfd7 100644
--- a/src/kudu/tools/ksck_results.cc
+++ b/src/kudu/tools/ksck_results.cc
@@ -204,9 +204,6 @@ Status KsckResults::PrintTo(PrintMode mode, ostream& out) {
 
   // Then, on each tablet.
   RETURN_NOT_OK(PrintTabletSummaries(tablet_summaries, mode, out));
-  if (!tablet_summaries.empty()) {
-    out << endl;
-  }
 
   // Then, summarize the tablets by table.
   // Sort the tables so unhealthy tables are easy to see at the bottom.
@@ -328,16 +325,10 @@ Status PrintTabletSummaries(const 
vector<KsckTabletSummary>& tablet_summaries,
                             PrintMode mode,
                             ostream& out) {
   if (tablet_summaries.empty()) {
-    out << "The cluster doesn't have any matching tablets" << endl;
+    out << "The cluster doesn't have any matching tablets" << endl << endl;
     return Status::OK();
   }
-  bool first = true;
   for (const auto& tablet_summary : tablet_summaries) {
-    if (first) {
-      first = false;
-    } else {
-      out << endl;
-    }
     if (mode != PrintMode::PLAIN_FULL &&
         tablet_summary.result == KsckCheckResult::HEALTHY) {
       continue;
@@ -387,6 +378,7 @@ Status PrintTabletSummaries(const 
vector<KsckTabletSummary>& tablet_summaries,
       }
     }
     RETURN_NOT_OK(PrintConsensusMatrix(ts_uuids, master_cstate, 
consensus_state_map, out));
+    out << endl;
   }
   return Status::OK();
 }

Reply via email to