nextdreamblue commented on code in PR #14551:
URL: https://github.com/apache/doris/pull/14551#discussion_r1031421300


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/CatalogRecycleBin.java:
##########
@@ -400,12 +409,27 @@ private synchronized void erasePartition(long 
currentTimeMs) {
                 // erase partition
                 iterator.remove();
                 idToRecycleTime.remove(partitionId);
-
                 // log
                 
Env.getCurrentEnv().getEditLog().logErasePartition(partitionId);
-                LOG.info("erase partition[{}]", partitionId);
+                LOG.info("erase partition[{}]. reason: expired", partitionId);
             }
         } // end for partitions
+
+        // 2. erase exceed number

Review Comment:
   add if (keepNum > 0)



##########
fe/fe-core/src/main/java/org/apache/doris/catalog/CatalogRecycleBin.java:
##########
@@ -224,6 +212,12 @@ private synchronized void eraseDatabase(long 
currentTimeMs) {
                 LOG.info("erase db[{}]", db.getId());
             }
         }
+        // 2. erase exceed number

Review Comment:
   only if keepNum > 0, can erase trash, otherwise may out of range



##########
fe/fe-core/src/main/java/org/apache/doris/catalog/CatalogRecycleBin.java:
##########
@@ -224,6 +212,12 @@ private synchronized void eraseDatabase(long 
currentTimeMs) {
                 LOG.info("erase db[{}]", db.getId());
             }
         }
+        // 2. erase exceed number

Review Comment:
   add if (keepNum > 0)



##########
fe/fe-core/src/main/java/org/apache/doris/catalog/CatalogRecycleBin.java:
##########
@@ -246,30 +240,28 @@ private synchronized List<Long> 
getSameNameDbIdListToErase(String dbName, int ma
             return dbIdToErase;
         }
         // order by recycle time desc
-        dbRecycleTimeLists.sort((x, y) -> {
-            return (x.get(1).longValue() < y.get(1).longValue()) ? 1 : 
((x.get(1).equals(y.get(1))) ? 0 : -1);
-        });
+        dbRecycleTimeLists.sort((x, y) ->
+                (x.get(1).longValue() < y.get(1).longValue()) ? 1 : 
((x.get(1).equals(y.get(1))) ? 0 : -1));
 
         for (int i = maxSameNameTrashNum - 1; i < dbRecycleTimeLists.size(); 
i++) {
             dbIdToErase.add(dbRecycleTimeLists.get(i).get(0));

Review Comment:
   if keepNum <= 0, here will out of range



##########
fe/fe-core/src/main/java/org/apache/doris/catalog/CatalogRecycleBin.java:
##########
@@ -323,6 +316,22 @@ private synchronized void eraseTable(long currentTimeMs) {
                 LOG.info("erase table[{}]", tableId);
             }
         } // end for tables
+
+        // 2. erase exceed num

Review Comment:
   add if (keepNum > 0)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to