[Fix](audit) do not use duplicate query id in fe.audit.log (#11746)

The original logic in ConnectProcessor.java might result in duplicate query id for different query statement in fe.audit.log as follows.
This commit is contained in:
AlexYue
2022-08-16 14:37:16 +08:00
committed by GitHub
parent c124470408
commit cf45151a66

View File

@ -294,13 +294,13 @@ public class ConnectProcessor {
auditInfoList.add(new Pair<>(executor.getParsedStmt(), executor.getQueryStatisticsForAuditLog()));
}
// audit after exec
// audit after exec, analysis query would not be recorded
if (!auditInfoList.isEmpty()) {
for (Pair<StatementBase, Data.PQueryStatistics> audit : auditInfoList) {
auditAfterExec(originStmt.replace("\n", " "), audit.first, audit.second);
}
} else {
// auditInfoList can be empty if we encounter analysis error.
} else if (QueryState.ErrType.ANALYSIS_ERR != ctx.getState().getErrType()) {
// auditInfoList can be empty if we encounter error.
auditAfterExec(originStmt.replace("\n", " "), null, null);
}
if (executor != null) {