Remove peers from string intern map

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2023-04-09 08:01:36 -07:00
parent 6fa55540a7
commit 80a57a3d51

View File

@@ -2096,8 +2096,6 @@ func (n *raft) handleForwardedRemovePeerProposal(sub *subscription, c *client, _
n.warn("Received invalid peer name for remove proposal: %q", msg)
return
}
// Need to copy since this is underlying client/route buffer.
peer := string(copyBytes(msg))
n.RLock()
prop, werr := n.prop, n.werr
@@ -2108,7 +2106,9 @@ func (n *raft) handleForwardedRemovePeerProposal(sub *subscription, c *client, _
return
}
prop.push(newEntry(EntryRemovePeer, []byte(peer)))
// Need to copy since this is underlying client/route buffer.
peer := copyBytes(msg)
prop.push(newEntry(EntryRemovePeer, peer))
}
// Called when a peer has forwarded a proposal.
@@ -2603,6 +2603,9 @@ func (n *raft) applyCommit(index uint64) error {
n.stepdown.push(n.selectNextLeader())
}
// Remove from string intern map.
peers.Delete(peer)
// We pass these up as well.
committed = append(committed, e)
}