Skip to content
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

[enhancement](delete) Using insert timeout session var to control delete job timeout #41063

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions fe/fe-core/src/main/java/org/apache/doris/load/DeleteJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ public enum DeleteState {

private MarkedCountDownLatch<Long, Long> countDownLatch;

private long timeoutS = 300L;

public DeleteJob(long id, long transactionId, String label,
Map<Long, Short> partitionReplicaNum, DeleteInfo deleteInfo) {
this.id = id;
Expand Down Expand Up @@ -251,14 +253,16 @@ public Collection<TabletDeleteInfo> getTabletDeleteInfo() {
return tabletDeleteInfoMap.values();
}

public void setTimeoutS(long timeoutS) {
this.timeoutS = timeoutS;
}

public long getTimeoutMs() {
if (FeConstants.runningUnitTest) {
// for making unit test run fast
return 1000;
}
// timeout is between 30 seconds to 5 min
long timeout = Math.max(totalTablets.size() * Config.tablet_delete_timeout_second * 1000L, 30000L);
return Math.min(timeout, Config.delete_job_max_timeout_second * 1000L);
return timeoutS * 1000L;
}

public void setTargetDb(Database targetDb) {
Expand Down Expand Up @@ -563,6 +567,10 @@ public DeleteJob buildWith(BuildParams params) throws Exception {
deleteJob.setTargetDb(params.getDb());
deleteJob.setTargetTbl(params.getTable());
deleteJob.setCountDownLatch(new MarkedCountDownLatch<>((int) replicaNum));
ConnectContext connectContext = ConnectContext.get();
if (connectContext != null) {
deleteJob.setTimeoutS(connectContext.getExecTimeout());
}
return deleteJob;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,10 +498,11 @@ public boolean isSyncLoadKindStmt() {
return logicalPlan instanceof InsertIntoTableCommand
|| logicalPlan instanceof InsertOverwriteTableCommand
|| (logicalPlan instanceof CreateTableCommand
&& ((CreateTableCommand) logicalPlan).isCtasCommand());
&& ((CreateTableCommand) logicalPlan).isCtasCommand())
|| logicalPlan instanceof DeleteFromCommand;
}
return parsedStmt instanceof InsertStmt || parsedStmt instanceof InsertOverwriteTableStmt
|| parsedStmt instanceof CreateTableAsSelectStmt;
|| parsedStmt instanceof CreateTableAsSelectStmt || parsedStmt instanceof DeleteStmt;
}

public boolean isAnalyzeStmt() {
Expand Down
Loading