Skip to content

RATIS-1825: Change listener to follower or change follower to listener is not supported #866

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

Open
wants to merge 1 commit 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 @@ -1245,6 +1245,22 @@ public CompletableFuture<RaftClientReply> setConfigurationAsync(SetConfiguration
return pending.getFuture();
}

// change listener to follower or change follower to listener is not supported yet
for (RaftPeer server : serversInNewConf) {
for (RaftPeer currentListener : current.getAllPeers(RaftPeerRole.LISTENER)) {
if (Objects.equals(currentListener.getId(), server.getId())) {
throw new SetConfigurationException("change listener to follower is not supported yet");
}
}
}
for (RaftPeer listener : listenersInNewConf) {
for (RaftPeer currentServer : current.getAllPeers(RaftPeerRole.FOLLOWER)) {
if (Objects.equals(currentServer.getId(), listener.getId())) {
throw new SetConfigurationException("change follower to listener is not supported yet");
}
}
}

getRaftServer().addRaftPeers(serversInNewConf);
getRaftServer().addRaftPeers(listenersInNewConf);
// add staging state into the leaderState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.apache.ratis.util.TimeDuration;
import org.apache.ratis.util.Timestamp;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;

Expand Down Expand Up @@ -430,6 +431,7 @@ public void testRemoveListener() throws Exception {
}

@Test
@Ignore("not supported")
public void testChangeFollowerToListener() throws Exception {
try(final MiniRaftCluster cluster = newCluster(3)) {
cluster.start();
Expand All @@ -453,6 +455,7 @@ public void testChangeFollowerToListener() throws Exception {
}

@Test
@Ignore("not supported")
public void testChangeListenerToFollower() throws Exception {
try(final MiniRaftCluster cluster = newCluster(2, 1)) {
cluster.start();
Expand Down