This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 8670378f82b [fix](audit) fix the delay in loading audit log (#46175)
8670378f82b is described below
commit 8670378f82b32258533b70bab9947a12c42ae8d1
Author: shee <[email protected]>
AuthorDate: Tue Dec 31 14:42:16 2024 +0800
[fix](audit) fix the delay in loading audit log (#46175)
### What problem does this PR solve?
The following conditions exist:
A query is placed in the audit log queue, and the AuditLoader does not
reach the refresh time, and the query does not arrive for a long time,
then the previous audit data will remain in the queue until the next
audit data arrives
Co-authored-by: garenshi <[email protected]>
---
.../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: [email protected]
For additional commands, e-mail: [email protected]