This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-3.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push: new 987385ec6c4 branch-3.0: [fix](audit) fix the delay in loading audit log #46175 (#46192) 987385ec6c4 is described below commit 987385ec6c4cbd56475a1559628ab3a1d2ad1e6c Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> AuthorDate: Tue Dec 31 22:56:39 2024 +0800 branch-3.0: [fix](audit) fix the delay in loading audit log #46175 (#46192) Cherry-picked from #46175 Co-authored-by: shee <13843187+qz...@users.noreply.github.com> --- .../src/main/java/org/apache/doris/plugin/audit/AuditLoader.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/plugin/audit/AuditLoader.java b/fe/fe-core/src/main/java/org/apache/doris/plugin/audit/AuditLoader.java index 644bddee58b..722ab48669b 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/plugin/audit/AuditLoader.java +++ b/fe/fe-core/src/main/java/org/apache/doris/plugin/audit/AuditLoader.java @@ -180,8 +180,8 @@ public class AuditLoader extends Plugin implements AuditPlugin { public synchronized void loadIfNecessary(boolean force) { long currentTime = System.currentTimeMillis(); - if (force || auditLogBuffer.length() >= GlobalVariable.auditPluginMaxBatchBytes - || currentTime - lastLoadTimeAuditLog >= GlobalVariable.auditPluginMaxBatchInternalSec * 1000) { + if (auditLogBuffer.length() != 0 && (force || auditLogBuffer.length() >= GlobalVariable.auditPluginMaxBatchBytes + || currentTime - lastLoadTimeAuditLog >= GlobalVariable.auditPluginMaxBatchInternalSec * 1000)) { // begin to load try { String token = ""; @@ -229,9 +229,9 @@ public class AuditLoader extends Plugin implements AuditPlugin { AuditEvent event = auditEventQueue.poll(5, TimeUnit.SECONDS); if (event != null) { assembleAudit(event); - // process all audit logs - loadIfNecessary(false); } + // process all audit logs + loadIfNecessary(false); } catch (InterruptedException ie) { if (LOG.isDebugEnabled()) { LOG.debug("encounter exception when loading current audit batch", ie); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org