You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "TangSiyang2001 (via GitHub)" <gi...@apache.org> on 2023/04/20 02:54:38 UTC

[GitHub] [doris] TangSiyang2001 commented on a diff in pull request #18691: [enhancement](agent-task/schema-change) make agent batch tasks cancelable in BE

TangSiyang2001 commented on code in PR #18691:
URL: https://github.com/apache/doris/pull/18691#discussion_r1172029988


##########
fe/fe-core/src/main/java/org/apache/doris/task/AgentBatchTask.java:
##########
@@ -50,23 +51,35 @@
 import com.google.common.collect.Lists;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
+import org.apache.thrift.TException;
 
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.function.BiFunction;
 
 /*
  * This class group tasks by backend
  */
 public class AgentBatchTask implements Runnable {
     private static final Logger LOG = LogManager.getLogger(AgentBatchTask.class);
 
+    /**
+     * for tracing this batch task
+     */
+    private final long batchId;
+
     // backendId -> AgentTask List
-    private Map<Long, List<AgentTask>> backendIdToTasks;
+    private final Map<Long, List<AgentTask>> backendIdToTasks;
 
     public AgentBatchTask() {
-        this.backendIdToTasks = new HashMap<Long, List<AgentTask>>();
+        if (FeConstants.runningUnitTest) {
+            this.batchId = 1L;

Review Comment:
   Actually BackupJobTest.java encountered exception without this way, it seems to be caused by calling `Env.getCurrentEnv().getNextId();` in ut environment, where getCurrentEnv() seems to return null. Is there a way can resolve the problem during mocks?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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