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:
   > I wouldn't recommend it if it's just for UT.
   > This can be done by way of mocks without intruding into the code.
   
   Actually BackupJobTest.java encountered exception without this way, it seems 
to be caused by calling `Env.getCurrentEnv().getNextId();` (failed to init 
SingletonHolder) in class AgentBatchTask in ut environment, where 
getCurrentEnv() seems to return null. Is there any 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-unsubscr...@doris.apache.org

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


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

Reply via email to