From 673f654fbe0cd6d1957f6c91c776bceec3b48623 Mon Sep 17 00:00:00 2001 From: Waldemar Quevedo Date: Mon, 21 Aug 2023 15:11:59 -0700 Subject: [PATCH] Fix discarding explicit routes while removing duplicate ones In the new clustering logic sometimes the TestStressChainedSolicitWorks test would fail because the a node would end up with only implicit routes. In this change, we stamp that one of the remotes is configured so that the nodes at least have one explicit configured remote node. Signed-off-by: Waldemar Quevedo --- server/route.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server/route.go b/server/route.go index 6f6adbe0..ef33d0b1 100644 --- a/server/route.go +++ b/server/route.go @@ -2083,8 +2083,9 @@ func handleDuplicateRoute(remote, c *client, setNoReconnect bool) { // removeRoute() now does the right thing of doing that only when // the closed connection was an added route connection. c.mu.Lock() - didSolict := c.route.didSolicit + didSolicit := c.route.didSolicit url := c.route.url + rtype := c.route.routeType if setNoReconnect { c.flags.set(noReconnect) } @@ -2095,10 +2096,15 @@ func handleDuplicateRoute(remote, c *client, setNoReconnect bool) { } remote.mu.Lock() - if didSolict && !remote.route.didSolicit { + if didSolicit && !remote.route.didSolicit { remote.route.didSolicit = true remote.route.url = url } + // The extra route might be an configured explicit route + // so keep the state that the remote was configured. + if rtype == Explicit { + remote.route.routeType = rtype + } // This is to mitigate the issue where both sides add the route // on the opposite connection, and therefore end-up with both // connections being dropped.