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

Shutdown joining member when initial cluster version is not valid #13390

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -81,6 +81,7 @@
import static com.hazelcast.util.Preconditions.checkFalse;
import static com.hazelcast.util.Preconditions.checkNotNull;
import static com.hazelcast.util.Preconditions.checkTrue;
import static java.lang.String.format;

@SuppressWarnings({"checkstyle:methodcount", "checkstyle:classdataabstractioncoupling", "checkstyle:classfanoutcomplexity"})
public class ClusterServiceImpl implements ClusterService, ConnectionListener, ManagedService,
Expand Down Expand Up @@ -378,7 +379,15 @@ public boolean finalizeJoin(MembersView membersView, Address callerAddress, Stri

checkMemberUpdateContainsLocalMember(membersView, targetUuid);

initialClusterState(clusterState, clusterVersion);
try {
initialClusterState(clusterState, clusterVersion);
} catch (VersionMismatchException e) {
// node should shutdown since it cannot handle the cluster version
// it is safe to do so here because no operations have been executed yet
logger.severe(format("This member will shutdown because it cannot join the cluster: %s", e.getMessage()));
node.shutdown(true);
return false;
}
setClusterId(clusterId);
ClusterClockImpl clusterClock = getClusterClock();
clusterClock.setClusterStartTime(clusterStartTime);
Expand Down
Expand Up @@ -115,7 +115,7 @@ void initialClusterState(ClusterState initialState, Version version) {
+ initialState);
return;
}
// no need to validate again
validateNodeCompatibleWith(version);
logger.fine("Setting initial cluster state: " + initialState + " and version: " + version);
setClusterStateAndVersion(initialState, version, true);
} finally {
Expand Down