-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enhencement](Export) support export with outfile syntax #18325
Conversation
connectContext.setEnv(Env.getCurrentEnv()); | ||
connectContext.setDatabase(job.getTableName().getDb()); | ||
// TODO(ftw): 这里的权限可能要改一下 | ||
connectContext.setQualifiedUser(UserIdentity.ROOT.getQualifiedUser()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to save user info in export job
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
fe/fe-core/src/main/java/org/apache/doris/analysis/ExportStmt.java
Outdated
Show resolved
Hide resolved
@@ -547,6 +546,7 @@ private Env(boolean isCheckpointCatalog) { | |||
this.routineLoadManager = new RoutineLoadManager(); | |||
this.sqlBlockRuleMgr = new SqlBlockRuleMgr(); | |||
this.exportMgr = new ExportMgr(); | |||
this.exportMgr.start(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this to startMasterOnlyDaemonThreads()
public ExportMgr() { | ||
int poolSize = Config.export_running_job_num_limit == 0 ? 5 : Config.export_running_job_num_limit; | ||
exportingExecutor = new MasterTaskExecutor("export-exporting-job", poolSize, true); | ||
exportingExecutor.start(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Override the start()
of MasterDaemon
and move this exportingExecutor.start()
to start()
List<ExportJob> jobs = getExportJobs(JobState.PENDING); | ||
// Because exportJob may be replayed from log | ||
// we also need handle EXPORTING state exportJob. | ||
jobs.addAll(getExportJobs(JobState.EXPORTING)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need to handle exporting
state jobs here.
All jobs replayed from log should be reset to PENDING.
// we also need handle EXPORTING state exportJob. | ||
jobs.addAll(getExportJobs(JobState.EXPORTING)); | ||
int runningJobNumLimit = Config.export_running_job_num_limit; | ||
if (runningJobNumLimit > 0 && !jobs.isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to calc the remaining job num.
The number of thread in executor pool is limit to 5, and the submitted job will be queued when all threads are taken.
So here, we can simply do:
- change the job's state to EXPORTING, so that it won't be scheduled again.
- submit the job to the executor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exporting state means this exportJob is exporting. If we change the job's state to EXPORTING
here, the job may not be assigned to the thread in the executor pool. So I think the change of job's state should in ExportExportingTask.exec()
return; | ||
} | ||
|
||
if (job.updateState(ExportJob.JobState.EXPORTING)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to persist EXPORTING
state.
The state should already be changed before submitting to the executor thread pool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
newFiles.add(destPath); | ||
} | ||
|
||
private Status makeSnapshots() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, we can comment out this makeSnapshots()
method because it is not used.
It can be reopened after we implement exporting tablet one by one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
} | ||
} catch (Exception e) { | ||
LOG.warn("run export exporting job error", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOG.warn("run export exporting job error", e); | |
LOG.warn("run export exporting job {}.", job, e); |
@@ -714,6 +500,52 @@ public synchronized boolean isFinalState() { | |||
return this.state == ExportJob.JobState.CANCELLED || this.state == ExportJob.JobState.FINISHED; | |||
} | |||
|
|||
public Status makeSnapshots() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public Status makeSnapshots() { | |
private Status makeSnapshots() { |
clang-tidy review says "All clean, LGTM! 👍" |
run buildall |
clang-tidy review says "All clean, LGTM! 👍" |
clang-tidy review says "All clean, LGTM! 👍" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
run clickbench |
run beut |
TeamCity pipeline, clickbench performance test result: |
run feut |
run buildall |
run buildall |
clang-tidy review says "All clean, LGTM! 👍" |
run buildall |
clang-tidy review says "All clean, LGTM! 👍" |
run feut |
run buildall |
clang-tidy review says "All clean, LGTM! 👍" |
run p0 |
run p1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
`Export` syntax provides asynchronous export function, but `Export` does not achieve vectorization. `Outfile` syntax provides synchronous export function`. So we can reimplement the export syntax with oufile syntax.
`Export` syntax provides asynchronous export function, but `Export` does not achieve vectorization. `Outfile` syntax provides synchronous export function`. So we can reimplement the export syntax with oufile syntax.
Proposed changes
Issue Number: close #xxx
Problem summary
Export
syntax provides asynchronous export function, butExport
does not achieve vectorization.Outfile
syntax provides synchronous export function`.So we can reimplement the export syntax with oufile syntax.
Checklist(Required)
Further comments
If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...