github-actions[bot] commented on code in PR #67053:
URL: https://github.com/apache/doris/pull/67053#discussion_r3859336568
##########
fe/fe-core/src/main/java/org/apache/doris/qe/AuditLogHelper.java:
##########
@@ -408,12 +409,41 @@ 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> externalInsertBackendIds =
getSuccessfulExternalInsertBackendIds(ctx, parsedStmt);
+ if (externalInsertBackendIds.isEmpty()) {
+
Env.getCurrentEnv().getWorkloadRuntimeStatusMgr().submitFinishQueryToAudit(event);
+ } else {
+ Env.getCurrentEnv().getWorkloadRuntimeStatusMgr()
+ .submitFinishQueryToAudit(event, externalInsertBackendIds);
+ }
if (LOG.isDebugEnabled()) {
LOG.debug("submit audit event: {}", event.queryId);
}
}
+ private static Set<Long> getSuccessfulExternalInsertBackendIds(
+ ConnectContext ctx, StatementBase parsedStmt) {
+ MysqlStateType stateType = ctx.getState().getStateType();
+ if (stateType != MysqlStateType.OK && stateType != MysqlStateType.EOF)
{
+ return ImmutableSet.of();
+ }
+ if (!(parsedStmt instanceof LogicalPlanAdapter)) {
+ return ImmutableSet.of();
+ }
+ LogicalPlan logicalPlan = ((LogicalPlanAdapter)
parsedStmt).getLogicalPlan();
+ if (!(logicalPlan instanceof InsertIntoTableCommand)
Review Comment:
[P1] Classify the resolved target, not the current logical root. A plain
Remote-Doris INSERT is represented by `UnboundTableSink` and therefore skips
this barrier even though planning builds `RemoteOlapInsertExecutor`. The
inverse also fails: WARM UP uses `UnboundBlackholeSink`, and an internal INSERT
with CTE replaces its sink root with `LogicalCTE`, so both unrelated audits can
wait up to the longer report timeout and consume queue capacity. Carry the
resolved target or executor kind into audit routing and cover these three real
command shapes; the current positive test stubs this predicate and cannot catch
either polarity.
--
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]