You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by mp...@apache.org on 2017/11/28 00:42:02 UTC

kudu git commit: [tools] added verbose mode for ksck

Repository: kudu
Updated Branches:
  refs/heads/master 0aa4af56c -> 34ca99b62


[tools] added verbose mode for ksck

Introduced verbose mode for the ksck tool ('kudu cluster ksck').
The verbose mode is enabled if specifying --verbose flag.  With the
verbose mode, the ksck outputs detailed information on cluster's
metadata, regardless whether the metadata information is found
consistent or not.

Without this patch, the detailed info was output only if the tool
found inconsistency in the cluster.

Change-Id: Ie6688510c90fff5da9742b1496ee805e93dbd4c0
Reviewed-on: http://gerrit.cloudera.org:8080/8596
Tested-by: Kudu Jenkins
Reviewed-by: Mike Percy <mp...@apache.org>


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

Branch: refs/heads/master
Commit: 34ca99b62af38d1b98d419e4f7b32b8f7e7fc565
Parents: 0aa4af5
Author: Alexey Serbin <as...@cloudera.com>
Authored: Sun Nov 19 15:46:05 2017 -0800
Committer: Mike Percy <mp...@apache.org>
Committed: Tue Nov 28 00:41:48 2017 +0000

----------------------------------------------------------------------
 src/kudu/tools/ksck.cc                | 11 +++++++----
 src/kudu/tools/tool_action_cluster.cc |  4 +++-
 2 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/34ca99b6/src/kudu/tools/ksck.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/ksck.cc b/src/kudu/tools/ksck.cc
index 9913175..cf36516 100644
--- a/src/kudu/tools/ksck.cc
+++ b/src/kudu/tools/ksck.cc
@@ -63,6 +63,8 @@ DEFINE_int32(fetch_replica_info_concurrency, 20,
 
 DEFINE_bool(consensus, true,
             "Whether to check the consensus state from each tablet against the master.");
+DEFINE_bool(verbose, false,
+            "Output detailed information even if no inconsistency is found.");
 
 namespace kudu {
 namespace tools {
@@ -808,8 +810,8 @@ Ksck::CheckResult Ksck::VerifyTablet(const shared_ptr<KsckTablet>& tablet, int t
   }
 
   // In the case that we found something wrong, dump info on all the replicas
-  // to make it easy to debug.
-  if (result != CheckResult::OK) {
+  // to make it easy to debug. Also, do that if verbose output is requested.
+  if (result != CheckResult::OK || FLAGS_verbose) {
     for (const ReplicaInfo& r : replica_infos) {
       string ts_str = r.ts ? r.ts->ToString() : r.replica->ts_uuid();
       const char* leader_str = r.replica->is_leader() ? " [LEADER]" : "";
@@ -841,8 +843,9 @@ Ksck::CheckResult Ksck::VerifyTablet(const shared_ptr<KsckTablet>& tablet, int t
     Out() << endl;
   }
 
-  // If there are consensus conflicts, dump the consensus info too.
-  if (conflicting_states > 0) {
+  // If there are consensus conflicts, dump the consensus info too. Do that also
+  // if the verbose output is requested.
+  if (conflicting_states > 0 || FLAGS_verbose) {
     if (result != CheckResult::CONSENSUS_MISMATCH) {
       Out() << Substitute("$0 replicas' active configs differ from the master's.",
                           conflicting_states)

http://git-wip-us.apache.org/repos/asf/kudu/blob/34ca99b6/src/kudu/tools/tool_action_cluster.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/tool_action_cluster.cc b/src/kudu/tools/tool_action_cluster.cc
index e813575..ef52ef2 100644
--- a/src/kudu/tools/tool_action_cluster.cc
+++ b/src/kudu/tools/tool_action_cluster.cc
@@ -127,7 +127,8 @@ unique_ptr<Mode> BuildClusterMode() {
       "'checksum' flag to check that tablet data is consistent (also see the "
       "'tables' and 'tablets' flags). Use the 'checksum_snapshot' along with "
       "'checksum' if the table or tablets are actively receiving inserts or "
-      "updates.";
+      "updates. Use the 'verbose' flag to output detailed information on "
+      "cluster status even if no inconsistency is found in metadata.";
   unique_ptr<Action> ksck =
       ActionBuilder("ksck", &RunKsck)
       .Description(desc)
@@ -142,6 +143,7 @@ unique_ptr<Mode> BuildClusterMode() {
       .AddOptionalParameter("consensus")
       .AddOptionalParameter("tables")
       .AddOptionalParameter("tablets")
+      .AddOptionalParameter("verbose")
       .Build();
 
   return ModeBuilder("cluster")