Skip to content

Commit

Permalink
Remove unsupported LEGACY_MULTI_NODE_DISCOVERY_TYPE (elastic#112903)
Browse files Browse the repository at this point in the history
This was never documented as supported anyway and has been deprecated
for several years so can now be removed.
  • Loading branch information
DaveCTurner authored Sep 16, 2024
1 parent 3a88358 commit 49dcc16
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 40 deletions.
17 changes: 17 additions & 0 deletions docs/changelog/112903.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
pr: 112903
summary: Remove unsupported legacy value for `discovery.type`
area: Cluster Coordination
type: breaking
issues: []
breaking:
title: Remove unsupported legacy value for `discovery.type`
area: Cluster and node setting
details: >-
Earlier versions of {es} had a `discovery.type` setting which permitted
values that referred to legacy discovery types. From v9.0.0 onwards, the
only supported values for this setting are `multi-node` (the default) and
`single-node`.
impact: >-
Remove any value for `discovery.type` from your `elasticsearch.yml`
configuration file.
notable: false
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,12 @@
import org.elasticsearch.cluster.version.CompatibilityVersions;
import org.elasticsearch.common.Randomness;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.network.NetworkService;
import org.elasticsearch.common.settings.ClusterSettings;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Setting.Property;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.features.FeatureService;
import org.elasticsearch.gateway.GatewayMetaState;
import org.elasticsearch.indices.breaker.CircuitBreakerService;
Expand Down Expand Up @@ -70,8 +67,6 @@ public class DiscoveryModule extends AbstractModule {

public static final String MULTI_NODE_DISCOVERY_TYPE = "multi-node";
public static final String SINGLE_NODE_DISCOVERY_TYPE = "single-node";
@Deprecated
public static final String LEGACY_MULTI_NODE_DISCOVERY_TYPE = "zen";

public static final Setting<String> DISCOVERY_TYPE_SETTING = new Setting<>(
"discovery.type",
Expand Down Expand Up @@ -175,15 +170,11 @@ public DiscoveryModule(
throw new IllegalArgumentException("Unknown election strategy " + ELECTION_STRATEGY_SETTING.get(settings));
}

checkLegacyMultiNodeDiscoveryType(discoveryType);

this.reconfigurator = getReconfigurator(settings, clusterSettings, clusterCoordinationPlugins);
var preVoteCollectorFactory = getPreVoteCollectorFactory(clusterCoordinationPlugins);
var leaderHeartbeatService = getLeaderHeartbeatService(settings, clusterCoordinationPlugins);

if (MULTI_NODE_DISCOVERY_TYPE.equals(discoveryType)
|| LEGACY_MULTI_NODE_DISCOVERY_TYPE.equals(discoveryType)
|| SINGLE_NODE_DISCOVERY_TYPE.equals(discoveryType)) {
if (MULTI_NODE_DISCOVERY_TYPE.equals(discoveryType) || SINGLE_NODE_DISCOVERY_TYPE.equals(discoveryType)) {
coordinator = new Coordinator(
NODE_NAME_SETTING.get(settings),
settings,
Expand Down Expand Up @@ -215,22 +206,6 @@ public DiscoveryModule(
logger.info("using discovery type [{}] and seed hosts providers {}", discoveryType, seedProviderNames);
}

@UpdateForV9
private static void checkLegacyMultiNodeDiscoveryType(String discoveryType) {
if (LEGACY_MULTI_NODE_DISCOVERY_TYPE.equals(discoveryType)) {
DeprecationLogger.getLogger(DiscoveryModule.class)
.critical(
DeprecationCategory.SETTINGS,
"legacy-discovery-type",
"Support for setting [{}] to [{}] is deprecated and will be removed in a future version. Set this setting to [{}] "
+ "instead.",
DISCOVERY_TYPE_SETTING.getKey(),
LEGACY_MULTI_NODE_DISCOVERY_TYPE,
MULTI_NODE_DISCOVERY_TYPE
);
}
}

// visible for testing
static Reconfigurator getReconfigurator(
Settings settings,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,20 +219,6 @@ public BiConsumer<DiscoveryNode, ClusterState> getJoinValidator() {
assertTrue(onJoinValidators.contains(consumer));
}

public void testLegacyDiscoveryType() {
newModule(
Settings.builder()
.put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), DiscoveryModule.LEGACY_MULTI_NODE_DISCOVERY_TYPE)
.build(),
List.of(),
List.of()
);
assertCriticalWarnings(
"Support for setting [discovery.type] to [zen] is deprecated and will be removed in a future version. Set this setting to "
+ "[multi-node] instead."
);
}

public void testRejectsMultipleReconfigurators() {
assertThat(
expectThrows(
Expand Down

0 comments on commit 49dcc16

Please sign in to comment.