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

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 2fe6d580be7 [improvement](diagnose) add tablet in recycle bin hint 
#39547 (#39622)
2fe6d580be7 is described below

commit 2fe6d580be76ce26f2189ccf6a8eda3c5997ed50
Author: yujun <yu.jun.re...@gmail.com>
AuthorDate: Wed Aug 21 09:16:01 2024 +0800

    [improvement](diagnose) add tablet in recycle bin hint #39547 (#39622)
    
    cherry pick from #39547
---
 .../main/java/org/apache/doris/catalog/CatalogRecycleBin.java | 11 +++++++++--
 .../java/org/apache/doris/catalog/TabletInvertedIndex.java    |  5 ++++-
 .../java/org/apache/doris/cooldown/CooldownConfHandler.java   |  6 +++++-
 .../src/main/java/org/apache/doris/system/Diagnoser.java      | 11 ++++++++---
 4 files changed, 26 insertions(+), 7 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/CatalogRecycleBin.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/CatalogRecycleBin.java
index 7d31a8c6bb3..560b575440c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/CatalogRecycleBin.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/CatalogRecycleBin.java
@@ -207,9 +207,16 @@ public class CatalogRecycleBin extends MasterDaemon 
implements Writable {
         idToRecycleTime.put(id, recycleTime);
     }
 
+    public synchronized boolean isRecycleDatabase(long dbId) {
+        return idToDatabase.containsKey(dbId);
+    }
+
+    public synchronized boolean isRecycleTable(long dbId, long tableId) {
+        return isRecycleDatabase(dbId) || idToTable.containsKey(tableId);
+    }
+
     public synchronized boolean isRecyclePartition(long dbId, long tableId, 
long partitionId) {
-        return idToDatabase.containsKey(dbId) || idToTable.containsKey(tableId)
-                || idToPartition.containsKey(partitionId);
+        return isRecycleTable(dbId, tableId) || 
idToPartition.containsKey(partitionId);
     }
 
     public synchronized void getRecycleIds(Set<Long> dbIds, Set<Long> 
tableIds, Set<Long> partitionIds) {
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/TabletInvertedIndex.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/TabletInvertedIndex.java
index c2d2926aed5..18ffb42fb6c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/TabletInvertedIndex.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/TabletInvertedIndex.java
@@ -469,7 +469,10 @@ public class TabletInvertedIndex {
                 table.readUnlock();
             }
         } catch (RuntimeException e) {
-            LOG.warn("failed to get tablet. tabletId={}", 
beTabletInfo.tablet_id);
+            if 
(!Env.getCurrentRecycleBin().isRecyclePartition(tabletMeta.getDbId(),
+                    tabletMeta.getTableId(), tabletMeta.getPartitionId())) {
+                LOG.warn("failed to get tablet. tabletId={}", 
beTabletInfo.tablet_id);
+            }
             return;
         }
         Pair<Long, Long> cooldownConf = tablet.getCooldownConf();
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/cooldown/CooldownConfHandler.java 
b/fe/fe-core/src/main/java/org/apache/doris/cooldown/CooldownConfHandler.java
index b3b9ae698ff..a243cac6e55 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/cooldown/CooldownConfHandler.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/cooldown/CooldownConfHandler.java
@@ -124,7 +124,11 @@ public class CooldownConfHandler extends MasterDaemon {
                 table.readUnlock();
             }
         } catch (RuntimeException e) {
-            LOG.warn("failed to get tablet. tabletId={}", conf.tabletId);
+            if (Env.getCurrentRecycleBin().isRecyclePartition(conf.dbId, 
conf.tableId, conf.partitionId)) {
+                LOG.debug("failed to get tablet, it's in catalog recycle bin. 
tabletId={}", conf.tabletId);
+            } else {
+                LOG.warn("failed to get tablet. tabletId={}", conf.tabletId);
+            }
             return null;
         }
     }
diff --git a/fe/fe-core/src/main/java/org/apache/doris/system/Diagnoser.java 
b/fe/fe-core/src/main/java/org/apache/doris/system/Diagnoser.java
index 5e7748a3524..952ec1181a8 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/system/Diagnoser.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/system/Diagnoser.java
@@ -61,21 +61,26 @@ public class Diagnoser {
         // database
         Database db = 
Env.getCurrentInternalCatalog().getDbNullable(tabletMeta.getDbId());
         if (db == null) {
-            results.add(Lists.newArrayList("Database", "Not exist", ""));
+            boolean inRecycleBin = 
Env.getCurrentRecycleBin().isRecycleDatabase(tabletMeta.getDbId());
+            results.add(Lists.newArrayList("Database", inRecycleBin ? "In 
catalog recycle bin" : "Not exist", ""));
             return results;
         }
         results.add(Lists.newArrayList("Database", db.getFullName() + ": " + 
db.getId(), ""));
         // table
         OlapTable tbl = (OlapTable) 
db.getTableNullable(tabletMeta.getTableId());
         if (tbl == null) {
-            results.add(Lists.newArrayList("Table", "Not exist", ""));
+            boolean inRecycleBin = 
Env.getCurrentRecycleBin().isRecycleTable(tabletMeta.getDbId(),
+                    tabletMeta.getTableId());
+            results.add(Lists.newArrayList("Table", inRecycleBin ? "In catalog 
recycle bin" : "Not exist", ""));
             return results;
         }
         results.add(Lists.newArrayList("Table", tbl.getName() + ": " + 
tbl.getId(), ""));
         // partition
         Partition partition = tbl.getPartition(tabletMeta.getPartitionId());
         if (partition == null) {
-            results.add(Lists.newArrayList("Partition", "Not exist", ""));
+            boolean inRecycleBin = 
Env.getCurrentRecycleBin().isRecyclePartition(tabletMeta.getDbId(),
+                    tabletMeta.getTableId(), tabletMeta.getPartitionId());
+            results.add(Lists.newArrayList("Partition", inRecycleBin ? "In 
catalog recycle bin" : "Not exist", ""));
             return results;
         }
         results.add(Lists.newArrayList("Partition", partition.getName() + ": " 
+ partition.getId(), ""));


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

Reply via email to