diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/DeleteJob.java b/fe/fe-core/src/main/java/org/apache/doris/load/DeleteJob.java index dcdd91e7fc..44b58f3367 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/load/DeleteJob.java +++ b/fe/fe-core/src/main/java/org/apache/doris/load/DeleteJob.java @@ -120,6 +120,8 @@ public class DeleteJob extends AbstractTxnStateChangeCallback implements DeleteJ private MarkedCountDownLatch countDownLatch; + private long timeoutS = 300L; + public DeleteJob(long id, long transactionId, String label, Map partitionReplicaNum, DeleteInfo deleteInfo) { this.id = id; @@ -250,14 +252,16 @@ public class DeleteJob extends AbstractTxnStateChangeCallback implements DeleteJ 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) { @@ -550,6 +554,10 @@ public class DeleteJob extends AbstractTxnStateChangeCallback implements DeleteJ 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; } diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java index 24a9a98814..3efed4b765 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java @@ -145,6 +145,7 @@ import org.apache.doris.nereids.parser.NereidsParser; import org.apache.doris.nereids.rules.exploration.mv.InitMaterializationContextHook; import org.apache.doris.nereids.trees.plans.commands.Command; import org.apache.doris.nereids.trees.plans.commands.CreateTableCommand; +import org.apache.doris.nereids.trees.plans.commands.DeleteFromCommand; import org.apache.doris.nereids.trees.plans.commands.Forward; import org.apache.doris.nereids.trees.plans.commands.NotAllowFallback; import org.apache.doris.nereids.trees.plans.commands.PrepareCommand; @@ -479,10 +480,11 @@ public class StmtExecutor { 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() {