This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 89c4d12ddfa branch-2.1: [fix](audit) fix audit loader thread hang and 
label already exists issue #54031 (#54169)
89c4d12ddfa is described below

commit 89c4d12ddfa030eff8a7a841e03fcf4c4fa5aa24
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Aug 1 09:13:12 2025 +0800

    branch-2.1: [fix](audit) fix audit loader thread hang and label already 
exists issue #54031 (#54169)
    
    Cherry-picked from #54031
    
    Co-authored-by: camby <[email protected]>
---
 .../java/org/apache/doris/plugin/audit/AuditStreamLoader.java    | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/plugin/audit/AuditStreamLoader.java 
b/fe/fe-core/src/main/java/org/apache/doris/plugin/audit/AuditStreamLoader.java
index 6d071dafda7..4176aace4e3 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/plugin/audit/AuditStreamLoader.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/plugin/audit/AuditStreamLoader.java
@@ -17,6 +17,7 @@
 
 package org.apache.doris.plugin.audit;
 
+import org.apache.doris.catalog.Env;
 import org.apache.doris.catalog.InternalSchema;
 import org.apache.doris.common.Config;
 import org.apache.doris.common.FeConstants;
@@ -37,6 +38,8 @@ import java.util.stream.Collectors;
 public class AuditStreamLoader {
     private static final Logger LOG = 
LogManager.getLogger(AuditStreamLoader.class);
     private static String loadUrlPattern = "http://%s/api/%s/%s/_stream_load?";;
+    // timeout for both connection and read. 10 seconds is long enough.
+    private static final int HTTP_TIMEOUT_MS = 10000;
     private String hostPort;
     private String db;
     private String auditLogTbl;
@@ -48,8 +51,8 @@ public class AuditStreamLoader {
         this.db = FeConstants.INTERNAL_DB_NAME;
         this.auditLogTbl = AuditLoader.AUDIT_LOG_TABLE;
         this.auditLogLoadUrlStr = String.format(loadUrlPattern, hostPort, db, 
auditLogTbl);
-        // currently, FE identity is FE's IP, so we replace the "." in IP to 
make it suitable for label
-        this.feIdentity = hostPort.replaceAll("\\.", "_").replaceAll(":", "_");
+        // currently, FE identity is FE's IP:port, so we replace the "." and 
":" to make it suitable for label
+        this.feIdentity = 
Env.getCurrentEnv().getSelfNode().getIdent().replaceAll("\\.", 
"_").replaceAll(":", "_");
     }
 
     private HttpURLConnection getConnection(String urlStr, String label, 
String clusterToken) throws IOException {
@@ -62,6 +65,8 @@ public class AuditStreamLoader {
         conn.addRequestProperty("Expect", "100-continue");
         conn.addRequestProperty("Content-Type", "text/plain; charset=UTF-8");
         conn.addRequestProperty("label", label);
+        conn.setConnectTimeout(HTTP_TIMEOUT_MS);
+        conn.setReadTimeout(HTTP_TIMEOUT_MS);
         conn.setRequestProperty("timeout", 
String.valueOf(GlobalVariable.auditPluginLoadTimeoutS));
         conn.addRequestProperty("max_filter_ratio", "1.0");
         conn.addRequestProperty("columns",


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to