You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by ad...@apache.org on 2019/11/12 21:22:35 UTC

[kudu] branch master updated: www: add tablet_count and on_disk_size on /tables

This is an automated email from the ASF dual-hosted git repository.

adar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new 0b99f37  www: add tablet_count and on_disk_size on /tables
0b99f37 is described below

commit 0b99f37ea4d97a4a671c20a0a5db7488fc27ed39
Author: zhangyifan27 <ch...@163.com>
AuthorDate: Tue Nov 12 15:53:43 2019 +0800

    www: add tablet_count and on_disk_size on /tables
    
    Add tablet_count and on_disk_size on /tables so that
    we could easily find oversize tables when there are
    many tables in a cluster.
    
    Screenshot: http://ww1.sinaimg.cn/large/9b7ebaddly1g8vfrqxmpgj21eq0aodi6.jpg
    
    Change-Id: Ic4937826eda0d095a36208fa34fa9c992570e71e
    Reviewed-on: http://gerrit.cloudera.org:8080/14694
    Tested-by: Kudu Jenkins
    Reviewed-by: Adar Dembo <ad...@cloudera.com>
---
 src/kudu/master/master_path_handlers.cc | 10 ++++++++--
 www/tables.mustache                     |  8 ++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/kudu/master/master_path_handlers.cc b/src/kudu/master/master_path_handlers.cc
index bcb5d6b..a80a76b 100644
--- a/src/kudu/master/master_path_handlers.cc
+++ b/src/kudu/master/master_path_handlers.cc
@@ -263,16 +263,22 @@ void MasterPathHandlers::HandleCatalogManager(const Webserver::WebRequest& req,
     table_json["id"] = EscapeForHtmlToString(table->id());
     table_json["state"] = state;
     table_json["message"] = EscapeForHtmlToString(l.data().pb.state_msg());
+    table_json["tablet_count"] = HumanReadableInt::ToString(table->num_tablets());
+    const TableMetrics* table_metrics = table->GetMetrics();
+    if (table_metrics) {
+      table_json["on_disk_size"] =
+          HumanReadableNumBytes::ToString(table_metrics->on_disk_size->value());
+    }
     std::string str_create_time;
     if (l.data().pb.has_create_timestamp()) {
       str_create_time = TimestampAsString(l.data().pb.create_timestamp());
     }
-    table_json["create time"] = EscapeForHtmlToString(str_create_time);
+    table_json["create_time"] = EscapeForHtmlToString(str_create_time);
     std::string str_alter_time;
     if (l.data().pb.has_alter_timestamp()) {
       str_alter_time = TimestampAsString(l.data().pb.alter_timestamp());
     }
-    table_json["alter time"] = EscapeForHtmlToString(str_alter_time);
+    table_json["alter_time"] = EscapeForHtmlToString(str_alter_time);
   }
   (*output).Set<int64_t>("num_tables", num_running_tables);
 }
diff --git a/www/tables.mustache b/www/tables.mustache
index 44c8d21..6689206 100644
--- a/www/tables.mustache
+++ b/www/tables.mustache
@@ -34,6 +34,8 @@ There are {{num_tables}} tables.
     <th>Table Id</th>
     <th>State</th>
     <th>State Message</th>
+    <th data-sorter="numericStringsSorter" data-sortable="true">Tablet Count</th>
+    <th data-sorter="bytesSorter" data-sortable="true">On-Disk Size (pre-replication)</th>
     <th data-sorter="timesSorter" data-sortable="true">Create Time</th>
     <th data-sorter="timesSorter" data-sortable="true">Last Alter Time</th>
   </tr></thead>
@@ -44,8 +46,10 @@ There are {{num_tables}} tables.
       <td><a href="{{base_url}}/table?id={{id}}">{{id}}</a></td>
       <td>{{state}}</td>
       <td>{{message}}</td>
-      <td>{{create time}}</td>
-      <td>{{alter time}}</td>
+      <td>{{tablet_count}}</td>
+      <td>{{on_disk_size}}</td>
+      <td>{{create_time}}</td>
+      <td>{{alter_time}}</td>
     </tr>
    {{/tables}}
   </tbody>