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

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


The following commit(s) were added to refs/heads/master by this push:
     new 8141a1f0c5 [feature](cooldown)get tablet return cooldown conf (#17074)
8141a1f0c5 is described below

commit 8141a1f0c5c9dfa4521dfa9b53c2f9bd43642244
Author: pengxiangyu <diablo...@163.com>
AuthorDate: Tue Feb 28 11:14:11 2023 +0800

    [feature](cooldown)get tablet return cooldown conf (#17074)
    
    * get tablet return cooldown conf
    
    * get tablet return cooldown conf
---
 .../apache/doris/common/proc/ReplicasProcNode.java | 30 ++++++++++++++++++++--
 .../apache/doris/common/proc/TabletsProcDir.java   | 12 +++++++--
 2 files changed, 38 insertions(+), 4 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/common/proc/ReplicasProcNode.java 
b/fe/fe-core/src/main/java/org/apache/doris/common/proc/ReplicasProcNode.java
index 03dacfa58f..ccdc775314 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/common/proc/ReplicasProcNode.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/common/proc/ReplicasProcNode.java
@@ -18,7 +18,10 @@
 package org.apache.doris.common.proc;
 
 import org.apache.doris.catalog.Env;
+import org.apache.doris.catalog.OlapTable;
 import org.apache.doris.catalog.Replica;
+import org.apache.doris.catalog.Tablet;
+import org.apache.doris.catalog.TabletMeta;
 import org.apache.doris.common.util.NetUtils;
 import org.apache.doris.common.util.TimeUtils;
 import org.apache.doris.system.Backend;
@@ -37,7 +40,8 @@ public class ReplicasProcNode implements ProcNodeInterface {
     public static final ImmutableList<String> TITLE_NAMES = new 
ImmutableList.Builder<String>().add("ReplicaId")
             
.add("BackendId").add("Version").add("LstSuccessVersion").add("LstFailedVersion").add("LstFailedTime")
             
.add("SchemaHash").add("LocalDataSize").add("RemoteDataSize").add("RowCount").add("State").add("IsBad")
-            
.add("VersionCount").add("PathHash").add("MetaUrl").add("CompactionStatus").build();
+            
.add("VersionCount").add("PathHash").add("MetaUrl").add("CompactionStatus").add("CooldownReplicaId")
+            .add("CooldownMetaId").build();
 
     private long tabletId;
     private List<Replica> replicas;
@@ -53,6 +57,22 @@ public class ReplicasProcNode implements ProcNodeInterface {
 
         BaseProcResult result = new BaseProcResult();
         result.setNames(TITLE_NAMES);
+        TabletMeta tabletMeta = 
Env.getCurrentInvertedIndex().getTabletMeta(tabletId);
+        Tablet tablet = null;
+        try {
+            OlapTable table = (OlapTable) 
Env.getCurrentInternalCatalog().getDbNullable(tabletMeta.getDbId())
+                    .getTableNullable(tabletMeta.getTableId());
+            table.readLock();
+            try {
+                tablet = 
table.getPartition(tabletMeta.getPartitionId()).getIndex(tabletMeta.getIndexId())
+                        .getTablet(tabletId);
+            } finally {
+                table.readUnlock();
+            }
+        } catch (Exception e) {
+            return result;
+        }
+
         for (Replica replica : replicas) {
             Backend be = backendMap.get(replica.getBackendId());
             String host = (be == null ? Backend.DUMMY_IP : be.getIp());
@@ -67,6 +87,10 @@ public class ReplicasProcNode implements ProcNodeInterface {
                     tabletId,
                     replica.getSchemaHash());
 
+            String cooldownMetaId = "";
+            if (replica.getCooldownMetaId() != null) {
+                cooldownMetaId = replica.getCooldownMetaId().toString();
+            }
             result.addRow(Arrays.asList(String.valueOf(replica.getId()),
                                         String.valueOf(replica.getBackendId()),
                                         String.valueOf(replica.getVersion()),
@@ -82,7 +106,9 @@ public class ReplicasProcNode implements ProcNodeInterface {
                                         
String.valueOf(replica.getVersionCount()),
                                         String.valueOf(replica.getPathHash()),
                                         metaUrl,
-                                        compactionUrl));
+                                        compactionUrl,
+                                        
String.valueOf(tablet.getCooldownConf().first),
+                                        cooldownMetaId));
         }
         return result;
     }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/common/proc/TabletsProcDir.java 
b/fe/fe-core/src/main/java/org/apache/doris/common/proc/TabletsProcDir.java
index e8c4ab5b33..0d1e322db3 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/proc/TabletsProcDir.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/proc/TabletsProcDir.java
@@ -48,8 +48,8 @@ public class TabletsProcDir implements ProcDirInterface {
             
.add("LstSuccessVersion").add("LstFailedVersion").add("LstFailedTime")
             
.add("LocalDataSize").add("RemoteDataSize").add("RowCount").add("State")
             .add("LstConsistencyCheckTime").add("CheckVersion")
-            
.add("VersionCount").add("PathHash").add("MetaUrl").add("CompactionStatus")
-            .build();
+            
.add("VersionCount").add("PathHash").add("MetaUrl").add("CompactionStatus").add("CooldownReplicaId")
+            .add("CooldownMetaId").build();
 
     private Table table;
     private MaterializedIndex index;
@@ -95,6 +95,8 @@ public class TabletsProcDir implements ProcDirInterface {
                     tabletInfo.add(-1); // path hash
                     tabletInfo.add(FeConstants.null_string); // meta url
                     tabletInfo.add(FeConstants.null_string); // compaction 
status
+                    tabletInfo.add(-1); // cooldown replica id
+                    tabletInfo.add(""); // cooldown meta id
 
                     tabletInfos.add(tabletInfo);
                 } else {
@@ -136,6 +138,12 @@ public class TabletsProcDir implements ProcDirInterface {
                                 tabletId,
                                 replica.getSchemaHash());
                         tabletInfo.add(compactionUrl);
+                        tabletInfo.add(tablet.getCooldownConf().first);
+                        if (replica.getCooldownMetaId() == null) {
+                            tabletInfo.add("");
+                        } else {
+                            
tabletInfo.add(replica.getCooldownMetaId().toString());
+                        }
                         tabletInfos.add(tabletInfo);
                     }
                 }


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

Reply via email to