Skip to content

Commit

Permalink
[fix](export) fix potential export concurrency issue apache#43109 (ap…
Browse files Browse the repository at this point in the history
  • Loading branch information
morningman authored Nov 2, 2024
1 parent 98d3db0 commit 9e7a1c9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public void analyze(Analyzer analyzer) throws UserException {
}

private void setJob() throws UserException {
exportJob = new ExportJob();
exportJob = new ExportJob(Env.getCurrentEnv().getNextId());

Database db = Env.getCurrentInternalCatalog().getDbOrDdlException(this.tblName.getDb());
exportJob.setDbId(db.getId());
Expand Down
4 changes: 2 additions & 2 deletions fe/fe-core/src/main/java/org/apache/doris/load/ExportJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,8 @@ private StatementBase generateLogicalPlanAdapter(LogicalPlan outfileLogicalPlan)
return statementBase;
}

public List<? extends TransientTaskExecutor> getTaskExecutors() {
return jobExecutorList;
public List<? extends TransientTaskExecutor> getCopiedTaskExecutors() {
return Lists.newArrayList(jobExecutorList);
}

private void generateExportJobExecutor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ private void writeUnlock() {
}

public void addExportJobAndRegisterTask(ExportJob job) throws Exception {
long jobId = Env.getCurrentEnv().getNextId();
job.setId(jobId);
writeLock();
try {
if (dbTolabelToExportJobId.containsKey(job.getDbId())
Expand All @@ -113,7 +111,7 @@ public void addExportJobAndRegisterTask(ExportJob job) throws Exception {
BrokerUtil.deleteDirectoryWithFileSystem(fullPath.substring(0, fullPath.lastIndexOf('/') + 1),
job.getBrokerDesc());
}
job.getTaskExecutors().forEach(executor -> {
job.getCopiedTaskExecutors().forEach(executor -> {
Env.getCurrentEnv().getTransientTaskManager().addMemoryTask(executor);
});
Env.getCurrentEnv().getEditLog().logExportCreate(job);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ private void checkBrokerDesc(ConnectContext ctx) throws UserException {

private ExportJob generateExportJob(ConnectContext ctx, Map<String, String> fileProperties, TableName tblName)
throws UserException {
ExportJob exportJob = new ExportJob();
ExportJob exportJob = new ExportJob(Env.getCurrentEnv().getNextId());
// set export job and check catalog/db/table
CatalogIf catalog = ctx.getEnv().getCatalogMgr().getCatalogOrAnalysisException(tblName.getCtl());
DatabaseIf db = catalog.getDbOrAnalysisException(tblName.getDb());
Expand Down

0 comments on commit 9e7a1c9

Please sign in to comment.