Gabriel39 commented on code in PR #67053:
URL: https://github.com/apache/doris/pull/67053#discussion_r3848929005


##########
fe/fe-core/src/main/java/org/apache/doris/qe/AuditLogHelper.java:
##########
@@ -408,7 +409,14 @@ private static void logAuditLogImpl(ConnectContext ctx, 
String origStmt, Stateme
             auditEventBuilder.setState(String.valueOf(MysqlStateType.OK));
         }
         AuditEvent event = auditEventBuilder.build();
-        
Env.getCurrentEnv().getWorkloadRuntimeStatusMgr().submitFinishQueryToAudit(event);
+        Set<Long> expectedBackendIds = ImmutableSet.of();
+        if (!event.isQuery && ctx.getExecutor() != null && 
ctx.getExecutor().getCoord() != null) {
+            // Audit completion is query-scoped: keep the event pending until 
every backend that
+            // received a fragment publishes its final cumulative statistics 
snapshot.
+            expectedBackendIds = 
ctx.getExecutor().getCoord().getInvolvedBackendIds();
+        }
+        Env.getCurrentEnv().getWorkloadRuntimeStatusMgr()

Review Comment:
   Updated both Mockito tests to capture the two-argument overload and assert 
an empty participant set for their paths. Also added direct StmtExecutor and 
Coordinator coverage that verifies the exact involved backend IDs reach the 
audit queue.



-- 
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