Skip to content

Commit

Permalink
[#1525] [YSQL] Show table UUIDs in tablet server web UI
Browse files Browse the repository at this point in the history
Summary:
Change TabletStatusPB to contain table UUID (whereas before it just contained table name)
and display that UUID in the tablet server web interface on port 9000. This is a follow-up to D6745.

Test Plan: Go to <http://localhost:9000/tablets> and ensure that UUIDs are shown correctly. Something like <https://phabricator.dev.yugabyte.com/F12300> should appear.

Reviewers: mihnea, bogdan, neha

Reviewed By: bogdan, neha

Subscribers: yql

Differential Revision: https://phabricator.dev.yugabyte.com/D6748
  • Loading branch information
georgeklees authored and jenkins committed Jun 13, 2019
1 parent 67b4a5b commit 9b80af5
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/yb/tablet/tablet.proto
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import "yb/tablet/metadata.proto";
message TabletStatusPB {
required string tablet_id = 1;
required string table_name = 2;
required string table_id = 10;
optional RaftGroupStatePB state = 3 [ default = UNKNOWN ];
optional tablet.TabletDataState tablet_data_state = 8 [ default = TABLET_DATA_UNKNOWN ];
required string last_status = 4;
Expand Down
4 changes: 4 additions & 0 deletions src/yb/tablet/tablet_bootstrap_if.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ const string TabletStatusListener::table_name() const {
return meta_->table_name();
}

const string TabletStatusListener::table_id() const {
return meta_->table_id();
}

const Partition& TabletStatusListener::partition() const {
return meta_->partition();
}
Expand Down
2 changes: 2 additions & 0 deletions src/yb/tablet/tablet_bootstrap_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ class TabletStatusListener {

const std::string table_name() const;

const std::string table_id() const;

const Partition& partition() const;

const Schema& schema() const;
Expand Down
1 change: 1 addition & 0 deletions src/yb/tablet/tablet_peer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ void TabletPeer::GetTabletStatusPB(TabletStatusPB* status_pb_out) const {
DCHECK(status_listener_.get() != nullptr);
status_pb_out->set_tablet_id(status_listener_->tablet_id());
status_pb_out->set_table_name(status_listener_->table_name());
status_pb_out->set_table_id(status_listener_->table_id());
status_pb_out->set_last_status(status_listener_->last_status());
status_listener_->partition().ToPB(status_pb_out->mutable_partition());
status_pb_out->set_state(state_);
Expand Down
20 changes: 11 additions & 9 deletions src/yb/tserver/tserver-path-handlers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,15 @@ void TabletServerPathHandlers::HandleTabletsPage(const Webserver::WebRequest& re

*output << "<h1>Tablets</h1>\n";
*output << "<table class='table table-striped'>\n";
*output << " <tr><th>Table name</th><th>Tablet ID</th>"
*output << " <tr><th>Table name</th><th>Table UUID</th><th>Tablet ID</th>"
"<th>Partition</th>"
"<th>State</th><th>On-disk size</th><th>RaftConfig</th><th>Last status</th></tr>\n";
for (const std::shared_ptr<TabletPeer>& peer : peers) {
TabletStatusPB status;
peer->GetTabletStatusPB(&status);
string id = status.tablet_id();
string table_name = status.table_name();
string table_id = status.table_id();
string tablet_id_or_link;
if (peer->tablet() != nullptr) {
tablet_id_or_link = TabletLink(id);
Expand All @@ -225,17 +226,18 @@ void TabletServerPathHandlers::HandleTabletsPage(const Webserver::WebRequest& re
// TODO: would be nice to include some other stuff like memory usage
shared_ptr<consensus::Consensus> consensus = peer->shared_consensus();
(*output) << Substitute(
// Table name, tablet id, partition
"<tr><td>$0</td><td>$1</td><td>$2</td>"
// Table name, UUID of table, tablet id, partition
"<tr><td>$0</td><td>$1</td><td>$2</td><td>$3</td>"
// State, on-disk size, consensus configuration, last status
"<td>$3</td><td>$4</td><td>$5</td><td>$6</td></tr>\n",
"<td>$4</td><td>$5</td><td>$6</td><td>$7</td></tr>\n",
EscapeForHtmlToString(table_name), // $0
tablet_id_or_link, // $1
EscapeForHtmlToString(partition), // $2
EscapeForHtmlToString(peer->HumanReadableState()), n_bytes, // $3, $4
EscapeForHtmlToString(table_id), // $1
tablet_id_or_link, // $2
EscapeForHtmlToString(partition), // $3
EscapeForHtmlToString(peer->HumanReadableState()), n_bytes, // $4, $5
consensus ? ConsensusStatePBToHtml(consensus->ConsensusState(CONSENSUS_CONFIG_COMMITTED))
: "", // $5
EscapeForHtmlToString(status.last_status())); // $6
: "", // $6
EscapeForHtmlToString(status.last_status())); // $7
}
*output << "</table>\n";
}
Expand Down

0 comments on commit 9b80af5

Please sign in to comment.