q763562998 commented on code in PR #17884:
URL: https://github.com/apache/doris/pull/17884#discussion_r1159405620


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/RefreshManager.java:
##########
@@ -19,26 +19,44 @@
 
 import org.apache.doris.analysis.CreateTableStmt;
 import org.apache.doris.analysis.DropTableStmt;
+import org.apache.doris.analysis.RefreshCatalogStmt;
 import org.apache.doris.analysis.RefreshDbStmt;
 import org.apache.doris.analysis.RefreshTableStmt;
 import org.apache.doris.analysis.TableName;
 import org.apache.doris.catalog.external.ExternalDatabase;
 import org.apache.doris.common.DdlException;
+import org.apache.doris.common.ThreadPoolManager;
 import org.apache.doris.common.UserException;
 import org.apache.doris.datasource.CatalogIf;
 import org.apache.doris.datasource.ExternalCatalog;
 import org.apache.doris.datasource.ExternalObjectLog;
 import org.apache.doris.datasource.InternalCatalog;
+import org.apache.doris.qe.DdlExecutor;
 
+import com.google.common.collect.Maps;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
 import java.util.Map;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
 
 // Manager for refresh database and table action
-public class RefreshManager {
+public class RefreshManager implements Runnable {
     private static final Logger LOG = 
LogManager.getLogger(RefreshManager.class);
 
+    private static final ScheduledThreadPoolExecutor REFRESH_TIMER = 
ThreadPoolManager.newDaemonScheduledThreadPool(1,
+        "catalog-refresh-timer-pool", true);
+    // Unit:SECONDS
+    private static final int REFRESH_TIME = 5;
+    // key is the name of a catalog, value is an array of length 2, used to 
store
+    // the original refresh time and the current remaining time of the catalog
+    private Map<String, Integer[]> refreshMap = Maps.newConcurrentMap();
+
+    public RefreshManager() {
+        REFRESH_TIMER.scheduleAtFixedRate(this::run, 0, REFRESH_TIME, 
TimeUnit.SECONDS);

Review Comment:
   Ok, I thought `RefreshManager` was a singleton object before such an bug 
occurred, I will correct it. And add `start()` in 
`Env.startMasterOnlyDaemonThreads()`



-- 
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