Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RATIS-2082] RaftPeers equal should also check address #1085

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,9 @@ public String getDetails() {

@Override
public boolean equals(Object o) {
return (o instanceof RaftPeer) && id.equals(((RaftPeer) o).getId());
return (o instanceof RaftPeer) && id.equals(((RaftPeer) o).getId()) &&
address != null && ((RaftPeer) o).getAddress() != null &&
address.equals(((RaftPeer) o).getAddress());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public void testYieldLeaderToHigherPriority() throws Exception {
Assertions.assertEquals(2, followers.size());
RaftServer.Division newLeader = followers.get(0);

List<RaftPeer> peers = cluster.getPeers();
List<RaftPeer> peers = new ArrayList<>(cluster.group.getPeers());
List<RaftPeer> peersWithNewPriority = getPeersWithPriority(peers, newLeader.getPeer());
RaftClientReply reply = client.admin().setConfiguration(peersWithNewPriority.toArray(new RaftPeer[0]));
Assertions.assertTrue(reply.isSuccess());
Expand Down Expand Up @@ -630,7 +630,7 @@ void runTestPauseResumeLeaderElection(CLUSTER cluster) throws IOException, Inter
Assertions.assertTrue(pauseLeaderReply.isSuccess());
client.io().send(new RaftTestUtil.SimpleMessage("message"));
RaftServer.Division newLeader = followers.get(0);
List<RaftPeer> peers = cluster.getPeers();
List<RaftPeer> peers = new ArrayList<>(cluster.group.getPeers());
List<RaftPeer> peersWithNewPriority = getPeersWithPriority(peers, newLeader.getPeer());
RaftClientReply reply = client.admin().setConfiguration(peersWithNewPriority.toArray(new RaftPeer[0]));
Assertions.assertTrue(reply.isSuccess());
Expand Down
Loading