wuchong commented on code in PR #2024:
URL: https://github.com/apache/fluss/pull/2024#discussion_r2563703788


##########
fluss-client/src/main/java/org/apache/fluss/client/metadata/MetadataUpdater.java:
##########
@@ -316,14 +330,54 @@ private static Cluster initializeCluster(Configuration 
conf, RpcClient rpcClient
         return cluster;
     }
 
-    private static Cluster tryToInitializeCluster(RpcClient rpcClient, 
InetSocketAddress address)
+    @VisibleForTesting
+    static @Nullable Cluster tryToInitializeClusterWithRetries(
+            InetSocketAddress address, AdminReadOnlyGateway gateway, int 
maxRetryTimes)
+            throws Exception {
+        int retryCount = 0;
+        while (retryCount <= maxRetryTimes) {
+            try {
+                return tryToInitializeCluster(gateway);
+            } catch (Exception e) {

Review Comment:
   Instead of retrying only the first bootstrap server, the client should 
attempt to connect to all provided bootstrap servers before sleeping and 
retrying. For example, if a user specifies three bootstrap servers and only the 
first one is unavailable, the client should immediately try the second (or 
third) server—rather than repeatedly retrying the failed one—improving 
connection resilience and startup latency.



##########
fluss-client/src/main/java/org/apache/fluss/client/metadata/MetadataUpdater.java:
##########
@@ -293,7 +296,18 @@ private static Cluster initializeCluster(Configuration 
conf, RpcClient rpcClient
         Exception lastException = null;
         for (InetSocketAddress address : inetSocketAddresses) {
             try {
-                cluster = tryToInitializeCluster(rpcClient, address);
+                ServerNode serverNode =
+                        new ServerNode(
+                                -1,

Review Comment:
   We should `.disconnect()` with the bootstrap server id, otherwise, the 
second retry will still use the old server host. If the bootstrap server is a 
SLB, this makes the SLB doesn't work.  



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to