You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by gr...@apache.org on 2019/11/25 03:09:13 UTC

[kudu] 01/02: www: Add tablet On-Disk Size info to /table

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

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

commit a5e58406ae9195e66f4fbc91c56d49bbaca5dd98
Author: zhangyifan27 <ch...@163.com>
AuthorDate: Thu Nov 21 16:22:46 2019 +0800

    www: Add tablet On-Disk Size info to /table
    
    This patch added 'On-Disk Size' info for each tablet of a table
    on master webui /table page, and supported sorting on tablets by
    on_disk_size, so that we could easily find the data skew of the table.
    
    Screenshot: http://ww1.sinaimg.cn/large/9b7ebaddly1g96lqe35qgj21eg0q87au.jpg
    
    Change-Id: I8cd84420968383d11658df45719a5b2070505291
    Reviewed-on: http://gerrit.cloudera.org:8080/14771
    Reviewed-by: Adar Dembo <ad...@cloudera.com>
    Tested-by: Kudu Jenkins
---
 src/kudu/master/master_path_handlers.cc | 3 +++
 www/table.mustache                      | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/kudu/master/master_path_handlers.cc b/src/kudu/master/master_path_handlers.cc
index a80a76b..790fe34 100644
--- a/src/kudu/master/master_path_handlers.cc
+++ b/src/kudu/master/master_path_handlers.cc
@@ -61,6 +61,7 @@
 #include "kudu/master/ts_manager.h"
 #include "kudu/server/monitored_task.h"
 #include "kudu/server/webui_util.h"
+#include "kudu/tablet/metadata.pb.h"
 #include "kudu/util/cow_object.h"
 #include "kudu/util/easy_json.h"
 #include "kudu/util/jsonwriter.h"
@@ -481,6 +482,8 @@ void MasterPathHandlers::HandleTablePage(const Webserver::WebRequest& req,
     Capitalize(&state);
     tablet_detail_json["state"] = state;
     tablet_detail_json["state_msg"] = l.data().pb.state_msg();
+    tablet_detail_json["on_disk_size"] =
+        HumanReadableNumBytes::ToString(tablet->GetStats().on_disk_size());
     EasyJson peers_json = tablet_detail_json.Set("peers", EasyJson::kArray);
     for (const auto& e : sorted_replicas) {
       EasyJson peer_json = peers_json.PushBack(EasyJson::kObject);
diff --git a/www/table.mustache b/www/table.mustache
index b96f6e3..af1a6de 100644
--- a/www/table.mustache
+++ b/www/table.mustache
@@ -96,12 +96,13 @@ under the License.
   <h4>Detail</h4>
   <a href='#detail' data-toggle='collapse'>(toggle)</a>
   <div id='detail' class='collapse'>
-    <table class='table table-striped table-hover'>
+    <table data-toggle="table" class='table table-striped table-hover'>
       <thead><tr>
         <th>Tablet ID</th>
         {{{detail_partition_schema_header}}}
         <th>State</th>
         <th>Message</th>
+        <th data-sorter="bytesSorter" data-sortable="true">On-Disk Size (leaders only)</th>
         <th>Peers</th>
       </tr></thead>
       <tbody>
@@ -111,6 +112,7 @@ under the License.
           {{{partition_cols}}}
           <td>{{state}}</td>
           <td>{{state_msg}}</td>
+          <td>{{on_disk_size}}</td>
           <td>
             <ul>
               {{#peers}}