From 6f6415099329dba7b7f0d1a09b0a0e125f11175c Mon Sep 17 00:00:00 2001 From: Tiewei Fang Date: Sun, 17 Nov 2024 19:48:49 +0800 Subject: [PATCH] [fix](Export) fix a memory leak in the FE because of the ExportJob (#44019) ### What problem does this PR solve? Problem Summary: When an `Export` job has finished or been cancelled, `ExportMgr` will maintain a reference of the `ExportJob` object. Therefore, we need to clear these no longer used objects; otherwise it will cause a memory leak in the FE. --- .../src/main/java/org/apache/doris/load/ExportJob.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/ExportJob.java b/fe/fe-core/src/main/java/org/apache/doris/load/ExportJob.java index 9e50d9318558a0..852c3ff94feb8f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/load/ExportJob.java +++ b/fe/fe-core/src/main/java/org/apache/doris/load/ExportJob.java @@ -705,6 +705,9 @@ private void cancelExportJobUnprotected(ExportFailMsg.CancelType type, String ms finishTimeMs = System.currentTimeMillis(); failMsg = new ExportFailMsg(type, msg); jobExecutorList.clear(); + selectStmtListPerParallel.clear(); + allOutfileInfo.clear(); + partitionToVersion.clear(); if (FeConstants.runningUnitTest) { return; } @@ -752,6 +755,9 @@ private void finishExportJobUnprotected() { outfileInfo = GsonUtils.GSON.toJson(allOutfileInfo); // Clear the jobExecutorList to release memory. jobExecutorList.clear(); + selectStmtListPerParallel.clear(); + allOutfileInfo.clear(); + partitionToVersion.clear(); Env.getCurrentEnv().getEditLog().logExportUpdateState(this, ExportJobState.FINISHED); LOG.info("finish export job {}", id); }