From 8c492545305cf9ef80a6ab2af85def854630910e Mon Sep 17 00:00:00 2001 From: BePPPower Date: Tue, 10 Dec 2024 16:44:04 +0800 Subject: [PATCH] fix --- .../main/java/org/apache/doris/load/ExportMgr.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/ExportMgr.java b/fe/fe-core/src/main/java/org/apache/doris/load/ExportMgr.java index 94ae436ee6d87d..ed6ee29bb9c969 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/load/ExportMgr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/load/ExportMgr.java @@ -122,8 +122,16 @@ public void addExportJobAndRegisterTask(ExportJob job) throws Exception { job.getBrokerDesc()); } // ATTN: Must add task after edit log, otherwise the job may finish before adding job. - for (int i = 0; i < job.getCopiedTaskExecutors().size(); i++) { - Env.getCurrentEnv().getTransientTaskManager().addMemoryTask(job.getCopiedTaskExecutors().get(i)); + try { + for (int i = 0; i < job.getCopiedTaskExecutors().size(); i++) { + Env.getCurrentEnv().getTransientTaskManager().addMemoryTask(job.getCopiedTaskExecutors().get(i)); + } + } catch (Exception e) { + // If there happens exceptions in `addMemoryTask` + // we must update the state of export job to `CANCELLED` + // because we have added this export in `ExportMgr` + job.updateExportJobState(ExportJobState.CANCELLED, 0L, null, + ExportFailMsg.CancelType.RUN_FAIL, e.getMessage()); } LOG.info("add export job. {}", job); }