This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 3355ebe5e7a [enhancement](delete) Using insert timeout session var to 
control delete job timeout (#41063) (#41475)
3355ebe5e7a is described below

commit 3355ebe5e7a35c4d5ed781af016fb2cece878656
Author: Siyang Tang <82279870+tangsiyang2...@users.noreply.github.com>
AuthorDate: Tue Oct 8 12:03:30 2024 +0800

    [enhancement](delete) Using insert timeout session var to control delete 
job timeout (#41063) (#41475)
    
    ## Proposed changes
    
    pick: #41063
---
 .../src/main/java/org/apache/doris/load/DeleteJob.java     | 14 +++++++++++---
 .../src/main/java/org/apache/doris/qe/StmtExecutor.java    |  6 ++++--
 2 files changed, 15 insertions(+), 5 deletions(-)

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 dcdd91e7fc3..44b58f33672 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<Long, Long> countDownLatch;
 
+    private long timeoutS = 300L;
+
     public DeleteJob(long id, long transactionId, String label,
                      Map<Long, Short> 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 24a9a98814d..3efed4b7650 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() {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to