yujun777 commented on code in PR #42276:
URL: https://github.com/apache/doris/pull/42276#discussion_r1811674609


##########
fe/fe-core/src/main/java/org/apache/doris/task/AgentBatchTask.java:
##########
@@ -169,29 +171,34 @@ public void run() {
                 client = ClientPool.backendPool.borrowObject(address);
                 List<TAgentTaskRequest> agentTaskRequests = new 
LinkedList<TAgentTaskRequest>();
                 for (AgentTask task : tasks) {
-                    try {
-                        agentTaskRequests.add(toAgentTaskRequest(task));
-                    } catch (Exception e) {
-                        task.failed();
-                        throw e;
-                    }
+                    agentTaskRequests.add(toAgentTaskRequest(task));
                 }
                 client.submitTasks(agentTaskRequests);
                 if (LOG.isDebugEnabled()) {
                     for (AgentTask task : tasks) {
-                        if (LOG.isDebugEnabled()) {
-                            LOG.debug("send task: type[{}], backend[{}], 
signature[{}]",
-                                    task.getTaskType(), backendId, 
task.getSignature());
-                        }
+                        LOG.debug("send task: type[{}], backend[{}], 
signature[{}]",
+                                task.getTaskType(), backendId, 
task.getSignature());
                     }
                 }
                 ok = true;
             } catch (Exception e) {
                 LOG.warn("task exec error. backend[{}]", backendId, e);
+                errMsg = String.format("task exec error: %s", e.getMessage());
             } finally {
                 if (ok) {
                     ClientPool.backendPool.returnObject(address, client);
                 } else {
+                    for (AgentTask task : tasks) {
+                        task.failed();
+
+                        // CreateReplicaTask will not trigger a retry in 
ReportTask.
+                        // Therefore, it needs to be marked as failed here and 
all
+                        // threads waiting for the result of CreateReplicaTask 
need
+                        // to be awakened.
+                        if (task instanceof CreateReplicaTask) {
+                            ((CreateReplicaTask) task).countDownToZero(errMsg);

Review Comment:
   不应该调用  countDownToZero ? 这个函数的意思是让整个latch 不再等待其他的请求,这里应该是latch count - 1.
   
   因为普通建表create replicas 时是允许有create replica task 失败的,只要多数派副本创建成功即可
   
   改成重载?
   ```
   void CreateReplicaTask::failed() {
       super.failed();
       this.countDownLatch(this.getBackendId(),   this.getSignature(),  err)
   }
   
   ```
   给 CreateReplicaTask::countDownLatch 函数加上一个参数 err, 
当!err.ok,设置CreateReplicaTask.latch.setStatus(err)
   
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to