Repository: kudu Updated Branches: refs/heads/master 3f43c03a1 -> 3855328b7
[tools] Add ids to tables and tablets; table name to tablets This adds tablet id, table id, and table name to KsckTabletSummary, and table id to KsckTableSummary. This will be tested in the follow-up JSON formatting patch. Change-Id: I19cd76a4c4c59c28930a44c0593021039903bec1 Reviewed-on: http://gerrit.cloudera.org:8080/10369 Reviewed-by: Alexey Serbin <aser...@cloudera.com> Tested-by: Will Berkeley <wdberke...@gmail.com> Project: http://git-wip-us.apache.org/repos/asf/kudu/repo Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/525943fd Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/525943fd Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/525943fd Branch: refs/heads/master Commit: 525943fd189acc20a3199f84431d62a776dd8f30 Parents: 3f43c03 Author: Will Berkeley <wdberke...@apache.org> Authored: Sun May 6 12:56:41 2018 -0700 Committer: Will Berkeley <wdberke...@gmail.com> Committed: Thu May 10 20:07:41 2018 +0000 ---------------------------------------------------------------------- src/kudu/tools/ksck-test.cc | 5 +++-- src/kudu/tools/ksck.cc | 6 +++++- src/kudu/tools/ksck.h | 12 ++++++++++-- src/kudu/tools/ksck_remote.cc | 3 ++- src/kudu/tools/ksck_results.h | 4 ++++ 5 files changed, 24 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/525943fd/src/kudu/tools/ksck-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/tools/ksck-test.cc b/src/kudu/tools/ksck-test.cc index f4011cc..18d28ef 100644 --- a/src/kudu/tools/ksck-test.cc +++ b/src/kudu/tools/ksck-test.cc @@ -278,8 +278,9 @@ class KsckTest : public KuduTest { table->set_tablets({ tablet }); } - shared_ptr<KsckTable> CreateAndAddTable(const string& name, int num_replicas) { - shared_ptr<KsckTable> table(new KsckTable(name, Schema(), num_replicas)); + shared_ptr<KsckTable> CreateAndAddTable(const string& id_and_name, int num_replicas) { + shared_ptr<KsckTable> table(new KsckTable(id_and_name, id_and_name, + Schema(), num_replicas)); cluster_->tables_.push_back(table); return table; } http://git-wip-us.apache.org/repos/asf/kudu/blob/525943fd/src/kudu/tools/ksck.cc ---------------------------------------------------------------------- diff --git a/src/kudu/tools/ksck.cc b/src/kudu/tools/ksck.cc index 191838b..70a1b64 100644 --- a/src/kudu/tools/ksck.cc +++ b/src/kudu/tools/ksck.cc @@ -716,10 +716,11 @@ bool Ksck::VerifyTable(const shared_ptr<KsckTable>& table) { } KsckTableSummary ts; + ts.id = table->id(); + ts.name = table->name(); ts.replication_factor = table->num_replicas(); VLOG(1) << Substitute("Verifying $0 tablet(s) for table $1 configured with num_replicas = $2", tablets.size(), table->name(), table->num_replicas()); - ts.name = table->name(); for (const auto& tablet : tablets) { auto tablet_result = VerifyTablet(tablet, table->num_replicas()); switch (tablet_result) { @@ -876,6 +877,9 @@ KsckCheckResult Ksck::VerifyTablet(const shared_ptr<KsckTablet>& tablet, } KsckTabletSummary tablet_summary; + tablet_summary.id = tablet->id(); + tablet_summary.table_id = tablet->table()->id(); + tablet_summary.table_name = tablet->table()->name(); tablet_summary.result = result; tablet_summary.status = status; tablet_summary.master_cstate = std::move(master_config); http://git-wip-us.apache.org/repos/asf/kudu/blob/525943fd/src/kudu/tools/ksck.h ---------------------------------------------------------------------- diff --git a/src/kudu/tools/ksck.h b/src/kudu/tools/ksck.h index edae81b..1c596e4 100644 --- a/src/kudu/tools/ksck.h +++ b/src/kudu/tools/ksck.h @@ -138,8 +138,15 @@ class KsckTablet { // Representation of a table. Composed of tablets. class KsckTable { public: - KsckTable(std::string name, const Schema& schema, int num_replicas) - : name_(std::move(name)), schema_(schema), num_replicas_(num_replicas) {} + KsckTable(std::string id, std::string name, const Schema& schema, int num_replicas) + : id_(std::move(id)), + name_(std::move(name)), + schema_(schema), + num_replicas_(num_replicas) {} + + const std::string& id() const { + return id_; + } const std::string& name() const { return name_; @@ -162,6 +169,7 @@ class KsckTable { } private: + const std::string id_; const std::string name_; const Schema schema_; const int num_replicas_; http://git-wip-us.apache.org/repos/asf/kudu/blob/525943fd/src/kudu/tools/ksck_remote.cc ---------------------------------------------------------------------- diff --git a/src/kudu/tools/ksck_remote.cc b/src/kudu/tools/ksck_remote.cc index d24f8c7..017321e 100644 --- a/src/kudu/tools/ksck_remote.cc +++ b/src/kudu/tools/ksck_remote.cc @@ -426,7 +426,8 @@ Status RemoteKsckCluster::RetrieveTablesList() { client::sp::shared_ptr<KuduTable> t; RETURN_NOT_OK(client_->OpenTable(n, &t)); - shared_ptr<KsckTable> table(new KsckTable(n, + shared_ptr<KsckTable> table(new KsckTable(t->id(), + n, *t->schema().schema_, t->num_replicas())); tables_temp.push_back(table); http://git-wip-us.apache.org/repos/asf/kudu/blob/525943fd/src/kudu/tools/ksck_results.h ---------------------------------------------------------------------- diff --git a/src/kudu/tools/ksck_results.h b/src/kudu/tools/ksck_results.h index 1e60be2..55b8920 100644 --- a/src/kudu/tools/ksck_results.h +++ b/src/kudu/tools/ksck_results.h @@ -142,6 +142,7 @@ struct KsckServerHealthSummary { // A summary of the state of a table. struct KsckTableSummary { + std::string id; std::string name; int replication_factor = 0; int healthy_tablets = 0; @@ -201,6 +202,9 @@ struct KsckReplicaSummary { // A summary of the state of a tablet. struct KsckTabletSummary { + std::string id; + std::string table_id; + std::string table_name; KsckCheckResult result; std::string status; KsckConsensusState master_cstate;