hubcio commented on code in PR #3783:
URL: https://github.com/apache/iggy/pull/3783#discussion_r3690483962


##########
core/server-ng/src/bootstrap.rs:
##########
@@ -2371,25 +2374,48 @@ fn resolve_cluster_optional_addr(
         transport,
         replica_id: self_node.replica_id,
     })?;
-    // The roster ip is what the cluster advertises (metadata, follower-to-
-    // primary HTTP forwarding targets); the transport's own `address` decides
-    // the bind interface. Merging keeps a loopback-only `127.0.0.1` private
-    // and a `0.0.0.0` wide in cluster mode instead of silently rebinding to
-    // the roster interface.
-    let listen_addr = SocketAddr::new(default_addr.ip(), port);
-    if !listen_addr.ip().is_unspecified()
-        && self_node
-            .ip
-            .parse::<IpAddr>()
-            .is_ok_and(|roster_ip| roster_ip != listen_addr.ip())
-    {
+    Ok(Some(merge_roster_port_with_bind_ip(
+        transport,
+        &self_node.ip,
+        default_addr,
+        port,
+    )))
+}
+
+/// Combine the roster-supplied `port` with the bind interface the transport's
+/// own `address` config asked for.
+///
+/// The roster ip is what the cluster advertises (metadata, follower-to-primary
+/// HTTP forwarding targets); the transport's own `address` decides the bind
+/// interface. Merging keeps a loopback-only `127.0.0.1` private and a
+/// `0.0.0.0` wide in cluster mode instead of silently rebinding to the roster
+/// interface, which would strand every co-located dialer (sidecars, health
+/// probes, on-host consumers) on `ECONNREFUSED`.
+fn merge_roster_port_with_bind_ip(
+    transport: &'static str,
+    roster_ip: &str,
+    bind_addr: SocketAddr,
+    port: u16,
+) -> SocketAddr {
+    let listen_addr = SocketAddr::new(bind_addr.ip(), port);
+    if roster_ip_unreachable_from_bind_addr(roster_ip, listen_addr) {
         warn!(
-            "{transport} listener binds {listen_addr} but the roster 
advertises {}:{port}; \
-             peers and clients dialing the advertised endpoint will not reach 
this node",
-            self_node.ip
+            "{transport} listener binds {listen_addr} but the roster 
advertises {roster_ip}:{port}; \
+             peers and clients dialing the advertised endpoint will not reach 
this node"

Review Comment:
   will not -> may not



##########
core/server-ng/src/bootstrap.rs:
##########
@@ -2328,6 +2329,7 @@ struct ClusterClientAddrs {
 
 fn resolve_cluster_client_addrs(
     self_node: &configs::ng_cluster::ClusterNodeConfig,
+    default_client_addr: SocketAddr,

Review Comment:
   default_tcp_addr to keep concistency with the rest



-- 
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