You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by ka...@apache.org on 2020/06/03 02:10:40 UTC

[incubator-doris] branch master updated: Add a link to Tablet Meta URL (#3745)

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

kangkaisen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 3194aa1  Add a link to Tablet Meta URL (#3745)
3194aa1 is described below

commit 3194aa129d886908012ca08ef813e99ae19b2459
Author: yangzhg <78...@qq.com>
AuthorDate: Wed Jun 3 10:10:32 2020 +0800

    Add a link to Tablet Meta URL (#3745)
---
 .../operation/tablet-repair-and-balance.md          | 16 ++++++++--------
 .../operation/tablet-repair-and-balance.md          | 14 +++++++-------
 .../apache/doris/common/proc/TabletsProcDir.java    | 21 +++++++++++++++++++--
 .../org/apache/doris/http/action/SystemAction.java  |  6 ++++++
 4 files changed, 40 insertions(+), 17 deletions(-)

diff --git a/docs/en/administrator-guide/operation/tablet-repair-and-balance.md b/docs/en/administrator-guide/operation/tablet-repair-and-balance.md
index 802228b..2ea3767 100644
--- a/docs/en/administrator-guide/operation/tablet-repair-and-balance.md
+++ b/docs/en/administrator-guide/operation/tablet-repair-and-balance.md
@@ -303,14 +303,14 @@ Duplicate status view mainly looks at the status of the duplicate, as well as th
 	`SHOW TABLET FROM tbl1;`
 
     ```
-	+----------+-----------+-----------+---------+-------------+-------------------+-----------------------+------------------+----------------------+---------------+----------+----------+--------+-------------------------+--------------+-----------------	-+--------------+----------------------+
-	| TabletId | ReplicaId | BackendId | Version | VersionHash | LstSuccessVersion | LstSuccessVersionHash | LstFailedVersion | LstFailedVersionHash | LstFailedTime | DataSize | RowCount | State  | LstConsistencyCheckTime | CheckVersion | 	CheckVersionHash | VersionCount | PathHash             |
-	+----------+-----------+-----------+---------+-------------+-------------------+-----------------------+------------------+----------------------+---------------+----------+----------+--------+-------------------------+--------------+-----------------	-+--------------+----------------------+
-	| 29502429 | 29502432  | 10006     | 2       | 0           | 2                 | 0                     | -1               | 0                    | N/A           | 784      | 0        | NORMAL | N/A                     | -1           | 	-1               | 2            | -5822326203532286804 |
-	| 29502429 | 36885996  | 10002     | 2       | 0           | -1                | 0                     | -1               | 0                    | N/A           | 784      | 0        | NORMAL | N/A                     | -1           | 	-1               | 2            | -1441285706148429853 |
-	| 29502429 | 48100551  | 10007     | 2       | 0           | -1                | 0                     | -1               | 0                    | N/A           | 784      | 0        | NORMAL | N/A                     | -1           | 	-1               | 2            | -4784691547051455525 |
-	+----------+-----------+-----------+---------+-------------+-------------------+-----------------------+------------------+----------------------+---------------+----------+----------+--------+-------------------------+--------------+-----------------	-+--------------+----------------------+  
-    ```
+	+----------+-----------+-----------+------------+---------+-------------+-------------------+-----------------------+------------------+----------------------+---------------+----------+----------+--------+-------------------------+--------------+----------------------+--------------+----------------------+----------------------+----------------------+
+	| TabletId | ReplicaId | BackendId | SchemaHash | Version | VersionHash | LstSuccessVersion | LstSuccessVersionHash | LstFailedVersion | LstFailedVersionHash | LstFailedTime | DataSize | RowCount | State  | LstConsistencyCheckTime | CheckVersion | 	CheckVersionHash | VersionCount | PathHash             | MetaUrl              | CompactionStatus     |
+	+----------+-----------+-----------+------------+---------+-------------+-------------------+-----------------------+------------------+----------------------+---------------+----------+----------+--------+-------------------------+--------------+----------------------+--------------+----------------------+----------------------+----------------------+
+	| 29502429 | 29502432  | 10006     | 1421156361 | 2       | 0           | 2                 | 0                     | -1               | 0                    | N/A           | 784      | 0        | NORMAL | N/A                     | -1           | 	-1               | 2            | -5822326203532286804 | url                  | url                  |
+	| 29502429 | 36885996  | 10002     | 1421156361 | 2       | 0           | -1                | 0                     | -1               | 0                    | N/A           | 784      | 0        | NORMAL | N/A                     | -1           | 	-1               | 2            | -1441285706148429853 | url                  | url                  |
+	| 29502429 | 48100551  | 10007     | 1421156361 | 2       | 0           | -1                | 0                     | -1               | 0                    | N/A           | 784      | 0        | NORMAL | N/A                     | -1           | 	-1               | 2            | -4784691547051455525 | url                  | url                  |
+	+----------+-----------+-----------+------------+---------+-------------+-------------------+-----------------------+------------------+----------------------+---------------+----------+----------+--------+-------------------------+--------------+----------------------+--------------+----------------------+----------------------+----------------------+  
+     ```
     
 	The figure above shows some additional information, including copy size, number of rows, number of versions, where the data path is located.
 
diff --git a/docs/zh-CN/administrator-guide/operation/tablet-repair-and-balance.md b/docs/zh-CN/administrator-guide/operation/tablet-repair-and-balance.md
index 87b3ddc..c991bb0 100644
--- a/docs/zh-CN/administrator-guide/operation/tablet-repair-and-balance.md
+++ b/docs/zh-CN/administrator-guide/operation/tablet-repair-and-balance.md
@@ -304,13 +304,13 @@ TabletScheduler 在每轮调度时,都会通过 LoadBalancer 来选择一定
     `SHOW TABLET FROM tbl1;`
     
     ```
-	+----------+-----------+-----------+---------+-------------+-------------------+-----------------------+------------------+----------------------+---------------+----------+----------+--------+-------------------------+--------------+-----------------	-+--------------+----------------------+
-	| TabletId | ReplicaId | BackendId | Version | VersionHash | LstSuccessVersion | LstSuccessVersionHash | LstFailedVersion | LstFailedVersionHash | LstFailedTime | DataSize | RowCount | State  | LstConsistencyCheckTime | CheckVersion | 	CheckVersionHash | VersionCount | PathHash             |
-	+----------+-----------+-----------+---------+-------------+-------------------+-----------------------+------------------+----------------------+---------------+----------+----------+--------+-------------------------+--------------+-----------------	-+--------------+----------------------+
-	| 29502429 | 29502432  | 10006     | 2       | 0           | 2                 | 0                     | -1               | 0                    | N/A           | 784      | 0        | NORMAL | N/A                     | -1           | 	-1               | 2            | -5822326203532286804 |
-	| 29502429 | 36885996  | 10002     | 2       | 0           | -1                | 0                     | -1               | 0                    | N/A           | 784      | 0        | NORMAL | N/A                     | -1           | 	-1               | 2            | -1441285706148429853 |
-	| 29502429 | 48100551  | 10007     | 2       | 0           | -1                | 0                     | -1               | 0                    | N/A           | 784      | 0        | NORMAL | N/A                     | -1           | 	-1               | 2            | -4784691547051455525 |
-	+----------+-----------+-----------+---------+-------------+-------------------+-----------------------+------------------+----------------------+---------------+----------+----------+--------+-------------------------+--------------+-----------------	-+--------------+----------------------+  
+	+----------+-----------+-----------+------------+---------+-------------+-------------------+-----------------------+------------------+----------------------+---------------+----------+----------+--------+-------------------------+--------------+----------------------+--------------+----------------------+----------------------+----------------------+
+	| TabletId | ReplicaId | BackendId | SchemaHash | Version | VersionHash | LstSuccessVersion | LstSuccessVersionHash | LstFailedVersion | LstFailedVersionHash | LstFailedTime | DataSize | RowCount | State  | LstConsistencyCheckTime | CheckVersion | 	CheckVersionHash | VersionCount | PathHash             | MetaUrl              | CompactionStatus     |
+	+----------+-----------+-----------+------------+---------+-------------+-------------------+-----------------------+------------------+----------------------+---------------+----------+----------+--------+-------------------------+--------------+----------------------+--------------+----------------------+----------------------+----------------------+
+	| 29502429 | 29502432  | 10006     | 1421156361 | 2       | 0           | 2                 | 0                     | -1               | 0                    | N/A           | 784      | 0        | NORMAL | N/A                     | -1           | 	-1               | 2            | -5822326203532286804 | url                  | url                  |
+	| 29502429 | 36885996  | 10002     | 1421156361 | 2       | 0           | -1                | 0                     | -1               | 0                    | N/A           | 784      | 0        | NORMAL | N/A                     | -1           | 	-1               | 2            | -1441285706148429853 | url                  | url                  |
+	| 29502429 | 48100551  | 10007     | 1421156361 | 2       | 0           | -1                | 0                     | -1               | 0                    | N/A           | 784      | 0        | NORMAL | N/A                     | -1           | 	-1               | 2            | -4784691547051455525 | url                  | url                  |
+	+----------+-----------+-----------+------------+---------+-------------+-------------------+-----------------------+------------------+----------------------+---------------+----------+----------+--------+-------------------------+--------------+----------------------+--------------+----------------------+----------------------+----------------------+  
     ```
     
     上图展示了包括副本大小、行数、版本数量、所在数据路径等一些额外的信息。
diff --git a/fe/src/main/java/org/apache/doris/common/proc/TabletsProcDir.java b/fe/src/main/java/org/apache/doris/common/proc/TabletsProcDir.java
index a19a498..3c4bd74 100644
--- a/fe/src/main/java/org/apache/doris/common/proc/TabletsProcDir.java
+++ b/fe/src/main/java/org/apache/doris/common/proc/TabletsProcDir.java
@@ -26,9 +26,11 @@ import org.apache.doris.catalog.TabletInvertedIndex;
 import org.apache.doris.common.AnalysisException;
 import org.apache.doris.common.util.ListComparator;
 import org.apache.doris.common.util.TimeUtils;
+import org.apache.doris.system.Backend;
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -45,7 +47,7 @@ public class TabletsProcDir implements ProcDirInterface {
             .add("LstFailedVersion").add("LstFailedVersionHash").add("LstFailedTime")
             .add("DataSize").add("RowCount").add("State")
             .add("LstConsistencyCheckTime").add("CheckVersion").add("CheckVersionHash")
-            .add("VersionCount").add("PathHash")
+            .add("VersionCount").add("PathHash").add("MetaUrl").add("CompactionStatus")
             .build();
 
     private Database db;
@@ -59,6 +61,7 @@ public class TabletsProcDir implements ProcDirInterface {
     public List<List<Comparable>> fetchComparableResult(long version, long backendId, Replica.ReplicaState state) {
         Preconditions.checkNotNull(db);
         Preconditions.checkNotNull(index);
+        ImmutableMap<Long, Backend> backendMap = Catalog.getCurrentSystemInfo().getIdToBackend();
 
         List<List<Comparable>> tabletInfos = new ArrayList<List<Comparable>>();
         db.readLock();
@@ -88,6 +91,8 @@ public class TabletsProcDir implements ProcDirInterface {
                     tabletInfo.add(-1); // check version hash
                     tabletInfo.add(-1); // version count
                     tabletInfo.add(-1); // path hash
+                    tabletInfo.add("N/A"); // meta url
+                    tabletInfo.add("N/A"); // compaction status
 
                     tabletInfos.add(tabletInfo);
                 } else {
@@ -119,7 +124,19 @@ public class TabletsProcDir implements ProcDirInterface {
                         tabletInfo.add(tablet.getCheckedVersionHash());
                         tabletInfo.add(replica.getVersionCount());
                         tabletInfo.add(replica.getPathHash());
-
+                        String metaUrl = String.format("http://%s:%d/api/meta/header/%d/%d",
+                                backendMap.get(replica.getBackendId()).getHost(),
+                                backendMap.get(replica.getBackendId()).getHttpPort(),
+                                tabletId,
+                                replica.getSchemaHash());
+                        tabletInfo.add(metaUrl);
+                        String compactionUrl = String.format(
+                                "http://%s:%d/api/compaction/show?tablet_id=%d&schema_hash=%d",
+                                backendMap.get(replica.getBackendId()).getHost(),
+                                backendMap.get(replica.getBackendId()).getHttpPort(),
+                                tabletId,
+                                replica.getSchemaHash());
+                        tabletInfo.add(compactionUrl);
                         tabletInfos.add(tabletInfo);
                     }
                 }
diff --git a/fe/src/main/java/org/apache/doris/http/action/SystemAction.java b/fe/src/main/java/org/apache/doris/http/action/SystemAction.java
index 5a18667..bfa403f 100644
--- a/fe/src/main/java/org/apache/doris/http/action/SystemAction.java
+++ b/fe/src/main/java/org/apache/doris/http/action/SystemAction.java
@@ -17,6 +17,7 @@
 
 package org.apache.doris.http.action;
 
+import org.apache.commons.validator.routines.UrlValidator;
 import org.apache.doris.analysis.RedirectStatus;
 import org.apache.doris.catalog.Catalog;
 import org.apache.doris.common.AnalysisException;
@@ -132,6 +133,7 @@ public class SystemAction extends WebBaseAction {
     }
 
     private void appendSystemTableBody(StringBuilder buffer, List<List<String>> rows, boolean isDir, String path) {
+        UrlValidator validator = new UrlValidator();
         for ( List<String> strList : rows) {
             buffer.append("<tr>");
             int columnIndex = 1;
@@ -142,6 +144,10 @@ public class SystemAction extends WebBaseAction {
                     buffer.append("<a href=\"?path=" + path + "/" + escapeStr + "\">");
                     buffer.append(str);
                     buffer.append("</a>");
+                } else if (validator.isValid(str)) {
+                    buffer.append("<a href=\"" + str + "\">");
+                    buffer.append("URL");
+                    buffer.append("</a>");
                 } else {
                     buffer.append(str.replaceAll("\\n", "<br/>"));
                 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org