Skip to content

Commit

Permalink
Fix discarding explicit routes while removing duplicate ones (#4414)
Browse files Browse the repository at this point in the history
In the new clustering logic for v2.10, sometimes the `TestStressChainedSolicitWorks` 
test would flake because 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.
  • Loading branch information
wallyqs committed Aug 22, 2023
2 parents 6d0fdf5 + 673f654 commit baa2805
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions server/route.go
Expand Up @@ -2089,8 +2089,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)
}
Expand All @@ -2101,10 +2102,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.
Expand Down

0 comments on commit baa2805

Please sign in to comment.