You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2021/08/26 15:08:45 UTC

[GitHub] [incubator-doris] morningman commented on a change in pull request #6448: [Bug] Regularly clean up old DeleteInfos in the DeleteHandler

morningman commented on a change in pull request #6448:
URL: https://github.com/apache/incubator-doris/pull/6448#discussion_r696721817



##########
File path: fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java
##########
@@ -1340,6 +1340,8 @@ private void startNonMasterDaemonThreads() {
         esRepository.start();
         // domain resolver
         domainResolver.start();
+        // start daemon thread to clean up old deleteInfos
+        deleteHandler.start();

Review comment:
       No need to start a new thread to do this.
   You can just call `deleteHandler.removeOldDeleteInfos()` in `labelCleaner` in `Catalog`
   ```
       public void createLabelCleaner() {
           labelCleaner = new MasterDaemon("LoadLabelCleaner", Config.label_clean_interval_second * 1000L) {
               @Override
               protected void runAfterCatalogReady() {
                   load.removeOldLoadJobs();
                   loadManager.removeOldLoadJob();
                   exportMgr.removeOldExportJobs();
                   deleteHandler.removeOldDeleteInfos();
               }
           };
       }
   ```

##########
File path: fe/fe-core/src/main/java/org/apache/doris/load/DeleteHandler.java
##########
@@ -709,6 +746,48 @@ public void write(DataOutput out) throws IOException {
 
     public static DeleteHandler read(DataInput in) throws IOException {
         String json = Text.readString(in);
-        return GsonUtils.GSON.fromJson(json, DeleteHandler.class);
+        DeleteHandler deleteHandler = GsonUtils.GSON.fromJson(json, DeleteHandler.class);
+        deleteHandler.removeOldDeleteInfos();
+        return deleteHandler;
+    }
+
+    /**
+     * All FE timings or Master FE checkpoint trigger the deletion of old deleteInfos operations
+     */
+    public void removeOldDeleteInfos() {
+        if (Catalog.getCurrentCatalog().isReady()) {

Review comment:
       No need to check `Catalog.getCurrentCatalog().isReady()` now.
   And you can simply merge the 2 `removeOldDeleteInfos()` method.

##########
File path: fe/fe-core/src/main/java/org/apache/doris/common/Config.java
##########
@@ -153,6 +153,19 @@
      */
     @ConfField public static int label_clean_interval_second = 4 * 3600; // 4 hours
 
+    /**
+     * Delete all deleteInfo older than *delete_info_keep_max_second*
+     * Setting a shorter time will reduce FE memory usage and image file size
+     * (Because all deleteInfo is stored in memory and image files before being deleted)
+     */
+    @ConfField(mutable = true)
+    public static int delete_info_keep_max_second = 3 * 24 * 3600; // 3 days
+
+    /**
+     * DeleteHandler will run every *delete_info_clean_interval_second* to clean old delete infos.
+     */
+    @ConfField public static int delete_info_clean_interval_second = 3600; // 1 hours

Review comment:
       This can be removed.




-- 
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-unsubscribe@doris.apache.org

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



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