You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by jd...@apache.org on 2016/07/22 22:02:25 UTC
[5/9] incubator-kudu git commit: ksck: also print info about the good
replicas for a bad tablet
ksck: also print info about the good replicas for a bad tablet
In the case that one or more replicas is bad in a tablet, it
can be useful to know where the _good_ replicas are in order to
start debugging why they aren't doing their job of replacing or
repairing the bad one. This patch prints out an INFO message for
those good replicas.
Example output:
WARNING: Detected problems with Tablet 3bf432551c5d4c529616f8e7ce829424 of table 'usertable'
------------------------------------------------------------
WARNING: Bad state on TS c189483a372947f192fc338e612ef70f (e1516.halxg.cloudera.com:7050): NOT_STARTED
Last status: RemoteBootstrap: Downloading block 369288934977914585 (450/31161)
Data state: TABLET_DATA_COPYING
INFO: OK state on TS dff78a5acdbb4a47ba2c7a62d1bcc5ee (e1407.halxg.cloudera.com:7050): RUNNING
INFO: OK state on TS ea948da3787648c2b26049e953afb3ea (e1301.halxg.cloudera.com:7050): RUNNING
Change-Id: Ic0dcefe5a7b00c77a116cc40601cce13cf8a0112
Reviewed-on: http://gerrit.cloudera.org:8080/3706
Tested-by: Kudu Jenkins
Reviewed-by: Jean-Daniel Cryans <jd...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kudu/commit/2e04bf54
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kudu/tree/2e04bf54
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kudu/diff/2e04bf54
Branch: refs/heads/master
Commit: 2e04bf54c562d1d75f5ad50760affc0aeb5ed7c2
Parents: 9cc2e04
Author: Todd Lipcon <to...@apache.org>
Authored: Wed Jul 20 14:53:15 2016 -0700
Committer: Jean-Daniel Cryans <jd...@apache.org>
Committed: Fri Jul 22 20:28:45 2016 +0000
----------------------------------------------------------------------
src/kudu/tools/ksck-test.cc | 12 +++++++++---
src/kudu/tools/ksck.cc | 9 ++++++++-
2 files changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/2e04bf54/src/kudu/tools/ksck-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/ksck-test.cc b/src/kudu/tools/ksck-test.cc
index 44fcf69..70c4dd0 100644
--- a/src/kudu/tools/ksck-test.cc
+++ b/src/kudu/tools/ksck-test.cc
@@ -290,17 +290,23 @@ TEST_F(KsckTest, TestBadTabletServer) {
err_stream_.str(),
"WARNING: Detected problems with Tablet tablet-id-0 of table 'test'\n"
"------------------------------------------------------------\n"
- "WARNING: Should have a replica on TS ts-id-1 (<mock>), but TS is unavailable\n\n");
+ "WARNING: Should have a replica on TS ts-id-1 (<mock>), but TS is unavailable\n"
+ "INFO: OK state on TS ts-id-0 (<mock>): RUNNING\n"
+ "INFO: OK state on TS ts-id-2 (<mock>): RUNNING\n");
ASSERT_STR_CONTAINS(
err_stream_.str(),
"WARNING: Detected problems with Tablet tablet-id-1 of table 'test'\n"
"------------------------------------------------------------\n"
- "WARNING: Should have a replica on TS ts-id-1 (<mock>), but TS is unavailable\n\n");
+ "WARNING: Should have a replica on TS ts-id-1 (<mock>), but TS is unavailable\n"
+ "INFO: OK state on TS ts-id-0 (<mock>): RUNNING\n"
+ "INFO: OK state on TS ts-id-2 (<mock>): RUNNING\n");
ASSERT_STR_CONTAINS(
err_stream_.str(),
"WARNING: Detected problems with Tablet tablet-id-2 of table 'test'\n"
"------------------------------------------------------------\n"
- "WARNING: Should have a replica on TS ts-id-1 (<mock>), but TS is unavailable\n\n");
+ "WARNING: Should have a replica on TS ts-id-1 (<mock>), but TS is unavailable\n"
+ "INFO: OK state on TS ts-id-0 (<mock>): RUNNING\n"
+ "INFO: OK state on TS ts-id-2 (<mock>): RUNNING\n");
}
TEST_F(KsckTest, TestZeroTabletReplicasCheck) {
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/2e04bf54/src/kudu/tools/ksck.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/ksck.cc b/src/kudu/tools/ksck.cc
index 67f9ff2..c46095b 100644
--- a/src/kudu/tools/ksck.cc
+++ b/src/kudu/tools/ksck.cc
@@ -500,7 +500,7 @@ bool Ksck::VerifyTablet(const shared_ptr<KsckTablet>& tablet, int table_num_repl
string tablet_str = Substitute("Tablet $0 of table '$1'",
tablet->id(), tablet->table()->name());
vector<shared_ptr<KsckTabletReplica> > replicas = tablet->replicas();
- vector<string> warnings, errors;
+ vector<string> warnings, errors, infos;
if (check_replica_count_ && replicas.size() != table_num_replicas) {
warnings.push_back(Substitute("$0 has $1 instead of $2 replicas",
tablet_str, replicas.size(), table_num_replicas));
@@ -528,6 +528,8 @@ bool Ksck::VerifyTablet(const shared_ptr<KsckTablet>& tablet, int table_num_repl
VLOG(1) << Substitute("Tablet replica for $0 on TS $1 is RUNNING",
tablet_str, ts->ToString());
running_count++;
+ infos.push_back(Substitute("OK state on TS $0: $1",
+ ts->ToString(), tablet::TabletStatePB_Name(state)));
break;
case tablet::UNKNOWN:
@@ -584,6 +586,11 @@ bool Ksck::VerifyTablet(const shared_ptr<KsckTablet>& tablet, int table_num_repl
for (const auto& s : errors) {
Error() << s << endl;
}
+ // We only print the 'INFO' messages on tablets that have some issues.
+ // Otherwise, it's a bit verbose.
+ for (const auto& s : infos) {
+ Info() << s << endl;
+ }
Out() << endl;
}