heguanhui commented on code in PR #63310:
URL: https://github.com/apache/doris/pull/63310#discussion_r3426559995


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/CatalogRecycleBin.java:
##########
@@ -67,6 +69,14 @@ public class CatalogRecycleBin extends MasterDaemon 
implements Writable {
 
     private final ReentrantReadWriteLock lock = new 
ReentrantReadWriteLock(true);
 
+    // Injectable clock source, defaults to system clock
+    private LongSupplier clock = System::currentTimeMillis;

Review Comment:
   I will fix this issue.



##########
fe/fe-core/src/main/java/org/apache/doris/catalog/CatalogRecycleBin.java:
##########
@@ -1393,13 +1403,14 @@ public void addTabletToInvertedIndex() {
 
     @Override
     protected void runAfterCatalogReady() {
-        long currentTimeMs = System.currentTimeMillis();
         // should follow the partition/table/db order
         // in case of partition(table) is still in recycle bin but table(db) 
is missing
+        // Each erase method gets its own currentTimeMs to avoid using a stale 
timestamp,
+        // since previous erase operations may take significant time.
         int keepNum = Config.max_same_name_catalog_trash_num;
-        erasePartition(currentTimeMs, keepNum);
-        eraseTable(currentTimeMs, keepNum);
-        eraseDatabase(currentTimeMs, keepNum);
+        erasePartition(clock.getAsLong(), keepNum);
+        eraseTable(clock.getAsLong(), keepNum);
+        eraseDatabase(clock.getAsLong(), keepNum);

Review Comment:
   I will fix this issue.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to