Skip to content

Commit 22438b7

Browse files
committed
remove more legacy settings
1 parent f4967bd commit 22438b7

File tree

11 files changed

+4
-141
lines changed

11 files changed

+4
-141
lines changed

server/src/main/java/org/elasticsearch/cluster/coordination/ClusterBootstrapService.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@
4949
import static java.util.Collections.emptyList;
5050
import static java.util.Collections.unmodifiableSet;
5151
import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING;
52-
import static org.elasticsearch.discovery.DiscoveryModule.LEGACY_DISCOVERY_HOSTS_PROVIDER_SETTING;
5352
import static org.elasticsearch.discovery.SettingsBasedSeedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING;
54-
import static org.elasticsearch.discovery.SettingsBasedSeedHostsProvider.LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING;
5553

5654
public class ClusterBootstrapService {
5755

@@ -93,8 +91,7 @@ public ClusterBootstrapService(Settings settings, TransportService transportServ
9391
}
9492

9593
public static boolean discoveryIsConfigured(Settings settings) {
96-
return Stream.of(DISCOVERY_SEED_PROVIDERS_SETTING, LEGACY_DISCOVERY_HOSTS_PROVIDER_SETTING,
97-
DISCOVERY_SEED_HOSTS_SETTING, LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING,
94+
return Stream.of(DISCOVERY_SEED_PROVIDERS_SETTING, DISCOVERY_SEED_HOSTS_SETTING,
9895
INITIAL_MASTER_NODES_SETTING).anyMatch(s -> s.exists(settings));
9996
}
10097

server/src/main/java/org/elasticsearch/cluster/coordination/NoMasterBlockService.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ public class NoMasterBlockService {
3535
public static final ClusterBlock NO_MASTER_BLOCK_ALL = new ClusterBlock(NO_MASTER_BLOCK_ID, "no master", true, true, false,
3636
RestStatus.SERVICE_UNAVAILABLE, ClusterBlockLevel.ALL);
3737

38-
public static final Setting<ClusterBlock> LEGACY_NO_MASTER_BLOCK_SETTING =
39-
new Setting<>("discovery.zen.no_master_block", "write", NoMasterBlockService::parseNoMasterBlock,
40-
Property.Dynamic, Property.NodeScope, Property.Deprecated);
4138
public static final Setting<ClusterBlock> NO_MASTER_BLOCK_SETTING =
4239
new Setting<>("cluster.no_master_block", "write", NoMasterBlockService::parseNoMasterBlock,
4340
Property.Dynamic, Property.NodeScope);
@@ -47,9 +44,6 @@ public class NoMasterBlockService {
4744
public NoMasterBlockService(Settings settings, ClusterSettings clusterSettings) {
4845
this.noMasterBlock = NO_MASTER_BLOCK_SETTING.get(settings);
4946
clusterSettings.addSettingsUpdateConsumer(NO_MASTER_BLOCK_SETTING, this::setNoMasterBlock);
50-
51-
LEGACY_NO_MASTER_BLOCK_SETTING.get(settings); // for deprecation warnings
52-
clusterSettings.addSettingsUpdateConsumer(LEGACY_NO_MASTER_BLOCK_SETTING, b -> {}); // for deprecation warnings
5347
}
5448

5549
private static ClusterBlock parseNoMasterBlock(String value) {

server/src/main/java/org/elasticsearch/common/settings/ClusterSettings.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ public void apply(Settings value, Settings current, Settings previous) {
230230
DiscoverySettings.PUBLISH_DIFF_ENABLE_SETTING,
231231
DiscoverySettings.COMMIT_TIMEOUT_SETTING,
232232
NoMasterBlockService.NO_MASTER_BLOCK_SETTING,
233-
NoMasterBlockService.LEGACY_NO_MASTER_BLOCK_SETTING,
234233
GatewayService.EXPECTED_DATA_NODES_SETTING,
235234
GatewayService.EXPECTED_MASTER_NODES_SETTING,
236235
GatewayService.EXPECTED_NODES_SETTING,
@@ -385,13 +384,9 @@ public void apply(Settings value, Settings current, Settings previous) {
385384
DiscoverySettings.INITIAL_STATE_TIMEOUT_SETTING,
386385
DiscoveryModule.DISCOVERY_TYPE_SETTING,
387386
DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING,
388-
DiscoveryModule.LEGACY_DISCOVERY_HOSTS_PROVIDER_SETTING,
389387
SettingsBasedSeedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING,
390-
SettingsBasedSeedHostsProvider.LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING,
391388
SeedHostsResolver.DISCOVERY_SEED_RESOLVER_MAX_CONCURRENT_RESOLVERS_SETTING,
392389
SeedHostsResolver.DISCOVERY_SEED_RESOLVER_TIMEOUT_SETTING,
393-
SeedHostsResolver.LEGACY_DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING,
394-
SeedHostsResolver.LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT,
395390
SearchService.DEFAULT_KEEPALIVE_SETTING,
396391
SearchService.KEEPALIVE_INTERVAL_SETTING,
397392
SearchService.MAX_KEEPALIVE_SETTING,

server/src/main/java/org/elasticsearch/discovery/DiscoveryModule.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ public class DiscoveryModule {
7171

7272
public static final Setting<String> DISCOVERY_TYPE_SETTING =
7373
new Setting<>("discovery.type", ZEN2_DISCOVERY_TYPE, Function.identity(), Property.NodeScope);
74-
public static final Setting<List<String>> LEGACY_DISCOVERY_HOSTS_PROVIDER_SETTING =
75-
Setting.listSetting("discovery.zen.hosts_provider", Collections.emptyList(), Function.identity(),
76-
Property.NodeScope, Property.Deprecated);
7774
public static final Setting<List<String>> DISCOVERY_SEED_PROVIDERS_SETTING =
7875
Setting.listSetting("discovery.seed_providers", Collections.emptyList(), Function.identity(),
7976
Property.NodeScope);
@@ -100,7 +97,7 @@ public DiscoveryModule(Settings settings, ThreadPool threadPool, TransportServic
10097
}
10198
}
10299

103-
List<String> seedProviderNames = getSeedProviderNames(settings);
100+
List<String> seedProviderNames = DISCOVERY_SEED_PROVIDERS_SETTING.get(settings);
104101
// for bwc purposes, add settings provider even if not explicitly specified
105102
if (seedProviderNames.contains("settings") == false) {
106103
List<String> extendedSeedProviderNames = new ArrayList<>();
@@ -142,17 +139,6 @@ public DiscoveryModule(Settings settings, ThreadPool threadPool, TransportServic
142139
discovery = Objects.requireNonNull(discoverySupplier.get());
143140
}
144141

145-
private List<String> getSeedProviderNames(Settings settings) {
146-
if (LEGACY_DISCOVERY_HOSTS_PROVIDER_SETTING.exists(settings)) {
147-
if (DISCOVERY_SEED_PROVIDERS_SETTING.exists(settings)) {
148-
throw new IllegalArgumentException("it is forbidden to set both [" + DISCOVERY_SEED_PROVIDERS_SETTING.getKey() + "] and ["
149-
+ LEGACY_DISCOVERY_HOSTS_PROVIDER_SETTING.getKey() + "]");
150-
}
151-
return LEGACY_DISCOVERY_HOSTS_PROVIDER_SETTING.get(settings);
152-
}
153-
return DISCOVERY_SEED_PROVIDERS_SETTING.get(settings);
154-
}
155-
156142
public Discovery getDiscovery() {
157143
return discovery;
158144
}

server/src/main/java/org/elasticsearch/discovery/SeedHostsResolver.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,6 @@
5252
import java.util.stream.Collectors;
5353

5454
public class SeedHostsResolver extends AbstractLifecycleComponent implements ConfiguredHostsResolver {
55-
public static final Setting<Integer> LEGACY_DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING =
56-
Setting.intSetting("discovery.zen.ping.unicast.concurrent_connects", 10, 0, Setting.Property.NodeScope,
57-
Setting.Property.Deprecated);
58-
public static final Setting<TimeValue> LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT =
59-
Setting.positiveTimeSetting("discovery.zen.ping.unicast.hosts.resolve_timeout", TimeValue.timeValueSeconds(5),
60-
Setting.Property.NodeScope, Setting.Property.Deprecated);
6155
public static final Setting<Integer> DISCOVERY_SEED_RESOLVER_MAX_CONCURRENT_RESOLVERS_SETTING =
6256
Setting.intSetting("discovery.seed_resolver.max_concurrent_resolvers", 10, 0, Setting.Property.NodeScope);
6357
public static final Setting<TimeValue> DISCOVERY_SEED_RESOLVER_TIMEOUT_SETTING =
@@ -85,26 +79,10 @@ public SeedHostsResolver(String nodeName, Settings settings, TransportService tr
8579
}
8680

8781
public static int getMaxConcurrentResolvers(Settings settings) {
88-
if (LEGACY_DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING.exists(settings)) {
89-
if (DISCOVERY_SEED_RESOLVER_MAX_CONCURRENT_RESOLVERS_SETTING.exists(settings)) {
90-
throw new IllegalArgumentException("it is forbidden to set both ["
91-
+ DISCOVERY_SEED_RESOLVER_MAX_CONCURRENT_RESOLVERS_SETTING.getKey() + "] and ["
92-
+ LEGACY_DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING.getKey() + "]");
93-
}
94-
return LEGACY_DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING.get(settings);
95-
}
9682
return DISCOVERY_SEED_RESOLVER_MAX_CONCURRENT_RESOLVERS_SETTING.get(settings);
9783
}
9884

9985
public static TimeValue getResolveTimeout(Settings settings) {
100-
if (LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT.exists(settings)) {
101-
if (DISCOVERY_SEED_RESOLVER_TIMEOUT_SETTING.exists(settings)) {
102-
throw new IllegalArgumentException("it is forbidden to set both ["
103-
+ DISCOVERY_SEED_RESOLVER_TIMEOUT_SETTING.getKey() + "] and ["
104-
+ LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT.getKey() + "]");
105-
}
106-
return LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT.get(settings);
107-
}
10886
return DISCOVERY_SEED_RESOLVER_TIMEOUT_SETTING.get(settings);
10987
}
11088

server/src/main/java/org/elasticsearch/discovery/SettingsBasedSeedHostsProvider.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ public class SettingsBasedSeedHostsProvider implements SeedHostsProvider {
4444

4545
private static final Logger logger = LogManager.getLogger(SettingsBasedSeedHostsProvider.class);
4646

47-
public static final Setting<List<String>> LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING =
48-
Setting.listSetting("discovery.zen.ping.unicast.hosts", emptyList(), Function.identity(), Property.NodeScope, Property.Deprecated);
49-
5047
public static final Setting<List<String>> DISCOVERY_SEED_HOSTS_SETTING =
5148
Setting.listSetting("discovery.seed_hosts", emptyList(), Function.identity(), Property.NodeScope);
5249

@@ -58,16 +55,7 @@ public class SettingsBasedSeedHostsProvider implements SeedHostsProvider {
5855
private final int limitPortCounts;
5956

6057
public SettingsBasedSeedHostsProvider(Settings settings, TransportService transportService) {
61-
if (LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.exists(settings)) {
62-
if (DISCOVERY_SEED_HOSTS_SETTING.exists(settings)) {
63-
throw new IllegalArgumentException("it is forbidden to set both ["
64-
+ DISCOVERY_SEED_HOSTS_SETTING.getKey() + "] and ["
65-
+ LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.getKey() + "]");
66-
}
67-
configuredHosts = LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.get(settings);
68-
// we only limit to 1 address, makes no sense to ping 100 ports
69-
limitPortCounts = LIMIT_FOREIGN_PORTS_COUNT;
70-
} else if (DISCOVERY_SEED_HOSTS_SETTING.exists(settings)) {
58+
if (DISCOVERY_SEED_HOSTS_SETTING.exists(settings)) {
7159
configuredHosts = DISCOVERY_SEED_HOSTS_SETTING.get(settings);
7260
// we only limit to 1 address, makes no sense to ping 100 ports
7361
limitPortCounts = LIMIT_FOREIGN_PORTS_COUNT;

server/src/test/java/org/elasticsearch/bootstrap/BootstrapChecksTests.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -730,8 +730,5 @@ public void testDiscoveryConfiguredCheck() throws NodeValidationException {
730730
ensureChecksPass.accept(Settings.builder().putList(ClusterBootstrapService.INITIAL_MASTER_NODES_SETTING.getKey()));
731731
ensureChecksPass.accept(Settings.builder().putList(DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING.getKey()));
732732
ensureChecksPass.accept(Settings.builder().putList(SettingsBasedSeedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING.getKey()));
733-
ensureChecksPass.accept(Settings.builder().putList(DiscoveryModule.LEGACY_DISCOVERY_HOSTS_PROVIDER_SETTING.getKey()));
734-
ensureChecksPass.accept(Settings.builder().putList(SettingsBasedSeedHostsProvider.LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING
735-
.getKey()));
736733
}
737734
}

server/src/test/java/org/elasticsearch/cluster/coordination/NoMasterBlockServiceTests.java

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import static org.elasticsearch.cluster.coordination.NoMasterBlockService.NO_MASTER_BLOCK_ALL;
2626
import static org.elasticsearch.cluster.coordination.NoMasterBlockService.NO_MASTER_BLOCK_SETTING;
2727
import static org.elasticsearch.cluster.coordination.NoMasterBlockService.NO_MASTER_BLOCK_WRITES;
28-
import static org.elasticsearch.cluster.coordination.NoMasterBlockService.LEGACY_NO_MASTER_BLOCK_SETTING;
2928
import static org.elasticsearch.common.settings.ClusterSettings.BUILT_IN_CLUSTER_SETTINGS;
3029
import static org.hamcrest.Matchers.sameInstance;
3130

@@ -39,33 +38,16 @@ private void createService(Settings settings) {
3938
noMasterBlockService = new NoMasterBlockService(settings, clusterSettings);
4039
}
4140

42-
private void assertDeprecatedWarningEmitted() {
43-
assertWarnings("[discovery.zen.no_master_block] setting was deprecated in Elasticsearch and will be removed in a future release! " +
44-
"See the breaking changes documentation for the next major version.");
45-
}
46-
4741
public void testBlocksWritesByDefault() {
4842
createService(Settings.EMPTY);
4943
assertThat(noMasterBlockService.getNoMasterBlock(), sameInstance(NO_MASTER_BLOCK_WRITES));
5044
}
5145

52-
public void testIgnoresLegacySettingBlockingWrites() {
53-
createService(Settings.builder().put(LEGACY_NO_MASTER_BLOCK_SETTING.getKey(), "write").build());
54-
assertThat(noMasterBlockService.getNoMasterBlock(), sameInstance(NO_MASTER_BLOCK_WRITES));
55-
assertDeprecatedWarningEmitted();
56-
}
57-
5846
public void testBlocksWritesIfConfiguredBySetting() {
5947
createService(Settings.builder().put(NO_MASTER_BLOCK_SETTING.getKey(), "write").build());
6048
assertThat(noMasterBlockService.getNoMasterBlock(), sameInstance(NO_MASTER_BLOCK_WRITES));
6149
}
6250

63-
public void testIgnoresLegacySettingBlockingAll() {
64-
createService(Settings.builder().put(LEGACY_NO_MASTER_BLOCK_SETTING.getKey(), "all").build());
65-
assertThat(noMasterBlockService.getNoMasterBlock(), sameInstance(NO_MASTER_BLOCK_WRITES));
66-
assertDeprecatedWarningEmitted();
67-
}
68-
6951
public void testBlocksAllIfConfiguredBySetting() {
7052
createService(Settings.builder().put(NO_MASTER_BLOCK_SETTING.getKey(), "all").build());
7153
assertThat(noMasterBlockService.getNoMasterBlock(), sameInstance(NO_MASTER_BLOCK_ALL));
@@ -76,26 +58,11 @@ public void testRejectsInvalidSetting() {
7658
createService(Settings.builder().put(NO_MASTER_BLOCK_SETTING.getKey(), "unknown").build()));
7759
}
7860

79-
public void testRejectsInvalidLegacySetting() {
80-
expectThrows(IllegalArgumentException.class, () ->
81-
createService(Settings.builder().put(LEGACY_NO_MASTER_BLOCK_SETTING.getKey(), "unknown").build()));
82-
assertDeprecatedWarningEmitted();
83-
}
84-
8561
public void testSettingCanBeUpdated() {
8662
createService(Settings.builder().put(NO_MASTER_BLOCK_SETTING.getKey(), "all").build());
8763
assertThat(noMasterBlockService.getNoMasterBlock(), sameInstance(NO_MASTER_BLOCK_ALL));
8864

8965
clusterSettings.applySettings(Settings.builder().put(NO_MASTER_BLOCK_SETTING.getKey(), "write").build());
9066
assertThat(noMasterBlockService.getNoMasterBlock(), sameInstance(NO_MASTER_BLOCK_WRITES));
9167
}
92-
93-
public void testIgnoresUpdatesToLegacySetting() {
94-
createService(Settings.builder().put(NO_MASTER_BLOCK_SETTING.getKey(), "all").build());
95-
assertThat(noMasterBlockService.getNoMasterBlock(), sameInstance(NO_MASTER_BLOCK_ALL));
96-
97-
clusterSettings.applySettings(Settings.builder().put(LEGACY_NO_MASTER_BLOCK_SETTING.getKey(), "write").build());
98-
assertThat(noMasterBlockService.getNoMasterBlock(), sameInstance(NO_MASTER_BLOCK_ALL));
99-
assertDeprecatedWarningEmitted();
100-
}
10168
}

server/src/test/java/org/elasticsearch/discovery/DiscoveryModuleTests.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -116,27 +116,6 @@ public void testSeedProviders() {
116116
assertTrue(created.get());
117117
}
118118

119-
public void testLegacyHostsProvider() {
120-
Settings settings = Settings.builder().put(DiscoveryModule.LEGACY_DISCOVERY_HOSTS_PROVIDER_SETTING.getKey(), "custom").build();
121-
AtomicBoolean created = new AtomicBoolean(false);
122-
DummyHostsProviderPlugin plugin = () -> Collections.singletonMap("custom", () -> {
123-
created.set(true);
124-
return hostsResolver -> Collections.emptyList();
125-
});
126-
newModule(settings, Collections.singletonList(plugin));
127-
assertTrue(created.get());
128-
assertWarnings("[discovery.zen.hosts_provider] setting was deprecated in Elasticsearch and will be removed in a future release! " +
129-
"See the breaking changes documentation for the next major version.");
130-
}
131-
132-
public void testLegacyAndNonLegacyProvidersRejected() {
133-
Settings settings = Settings.builder().putList(DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING.getKey())
134-
.putList(DiscoveryModule.LEGACY_DISCOVERY_HOSTS_PROVIDER_SETTING.getKey()).build();
135-
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () ->
136-
newModule(settings, Collections.emptyList()));
137-
assertEquals("it is forbidden to set both [discovery.seed_providers] and [discovery.zen.hosts_provider]", e.getMessage());
138-
}
139-
140119
public void testUnknownSeedsProvider() {
141120
Settings settings = Settings.builder().put(DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING.getKey(), "dne").build();
142121
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () ->

server/src/test/java/org/elasticsearch/discovery/SettingsBasedSeedHostsProviderTests.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.elasticsearch.common.transport.TransportAddress;
2323
import org.elasticsearch.common.util.set.Sets;
2424
import org.elasticsearch.discovery.SeedHostsProvider.HostsResolver;
25-
import org.elasticsearch.discovery.SettingsBasedSeedHostsProvider;
2625
import org.elasticsearch.test.ESTestCase;
2726
import org.elasticsearch.transport.TransportService;
2827

@@ -75,21 +74,4 @@ public void testGetsHostsFromSetting() {
7574
.build(), null).getSeedAddresses(hostsResolver);
7675
assertTrue(hostsResolver.getResolvedHosts());
7776
}
78-
79-
public void testGetsHostsFromLegacySetting() {
80-
final AssertingHostsResolver hostsResolver = new AssertingHostsResolver(1, "bar", "foo");
81-
new SettingsBasedSeedHostsProvider(Settings.builder()
82-
.putList(SettingsBasedSeedHostsProvider.LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.getKey(), "foo", "bar")
83-
.build(), null).getSeedAddresses(hostsResolver);
84-
assertTrue(hostsResolver.getResolvedHosts());
85-
assertWarnings("[discovery.zen.ping.unicast.hosts] setting was deprecated in Elasticsearch and will be removed in a future " +
86-
"release! See the breaking changes documentation for the next major version.");
87-
}
88-
89-
public void testForbidsBothSettingsAtTheSameTime() {
90-
expectThrows(IllegalArgumentException.class, () -> new SettingsBasedSeedHostsProvider(Settings.builder()
91-
.putList(SettingsBasedSeedHostsProvider.LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.getKey())
92-
.putList(SettingsBasedSeedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING.getKey())
93-
.build(), null));
94-
}
9577
}

0 commit comments

Comments
 (0)