Use Broker peering directionality when re-peering after backpressure overflows

This avoids creating pointless connection reattempts to ephemeral TCP
client-side ports, which have been cluttering up the Broker logs since 7.1.
This commit is contained in:
Christian Kreibich 2025-04-18 15:51:55 -07:00
parent b430d5235c
commit 549e678dff

View file

@ -10,26 +10,22 @@
##! - In cluster.log, with a higher-level message indicating the node names involved. ##! - In cluster.log, with a higher-level message indicating the node names involved.
##! - Via telemetry, using a labeled counter. ##! - Via telemetry, using a labeled counter.
event Broker::peer_removed(endpoint: Broker::EndpointInfo, msg: string) event Broker::peer_removed(ep: Broker::EndpointInfo, msg: string)
{ {
if ( "caf::sec::backpressure_overflow" !in msg ) { if ( "caf::sec::backpressure_overflow" !in msg ) {
return; return;
} }
if ( ! endpoint?$network ) { if ( ! ep?$network ) {
Reporter::error(fmt("Missing network info to re-peer with %s", endpoint$id)); Reporter::error(fmt("Missing network info to re-peer with %s", ep$id));
return; return;
} }
# Re-establish the peering so Broker's reconnect behavior kicks in once # Re-establish the peering. Broker will periodically re-try connecting
# the other endpoint catches up. Broker will periodically re-try # as necessary. Do this only if the local node originally established
# connecting as necessary. If the other endpoint originally connected to # the peering, otherwise we would connect to an ephemeral client-side
# us, our attempt will fail (since we attempt to connect to the peer's # TCP port that doesn't listen. If we didn't originally establish the
# ephemeral port), but in that case the peer will reconnect with us once # peering, the other side will retry anyway.
# it recovers. if ( Broker::is_outbound_peering(ep$network$address, ep$network$bound_port) )
# Broker::peer(ep$network$address, ep$network$bound_port);
# We could do this more cleanly by leveraging information from the
# cluster framework (since it knows who connects to whom), but that
# would further entangle Broker into it.
Broker::peer(endpoint$network$address, endpoint$network$bound_port);
} }