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

dataroaring 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 472dc904e06 [fix](cloud) fix incorrect timeout of FE connection pool 
(#41202)
472dc904e06 is described below

commit 472dc904e06ec2b0f50926fd0b7603bb0eba87fd
Author: Luwei <814383...@qq.com>
AuthorDate: Wed Sep 25 11:19:14 2024 +0800

    [fix](cloud) fix incorrect timeout of FE connection pool (#41202)
---
 .../src/main/java/org/apache/doris/cloud/rpc/MetaServiceClient.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/cloud/rpc/MetaServiceClient.java 
b/fe/fe-core/src/main/java/org/apache/doris/cloud/rpc/MetaServiceClient.java
index 47108b147f5..323b880a3a7 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/cloud/rpc/MetaServiceClient.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/cloud/rpc/MetaServiceClient.java
@@ -33,6 +33,7 @@ import org.apache.logging.log4j.Logger;
 import java.io.InputStreamReader;
 import java.nio.charset.StandardCharsets;
 import java.util.Map;
+import java.util.Random;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 
@@ -45,6 +46,7 @@ public class MetaServiceClient {
     private final ManagedChannel channel;
     private final long expiredAt;
     private final boolean isMetaServiceEndpointList;
+    private Random random = new Random();
 
     static {
         NameResolverRegistry.getDefaultRegistry().register(new 
MetaServiceListResolverProvider());
@@ -76,7 +78,9 @@ public class MetaServiceClient {
         // Disable connection age if the endpoint is a list.
         if (!isMetaServiceEndpointList && connectionAgeBase > 1) {
             long base = TimeUnit.MINUTES.toMillis(connectionAgeBase);
-            return base + System.currentTimeMillis() % base;
+            long now = System.currentTimeMillis();
+            long rand = random.nextLong(base);
+            return now + base + rand;
         }
         return Long.MAX_VALUE;
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to