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

[Backport 2.x] Fix issue that deprecated setting 'cluster.initial_master_nodes' is not identified in node bootstrap check #2793

Merged
merged 1 commit into from
Apr 6, 2022
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.
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 @@ -113,12 +113,12 @@ public ClusterBootstrapService(
BooleanSupplier isBootstrappedSupplier,
Consumer<VotingConfiguration> votingConfigurationConsumer
) {
// TODO: Remove variable 'initialClusterManagerSettingName' after removing MASTER_ROLE.
String initialClusterManagerSettingName = INITIAL_CLUSTER_MANAGER_NODES_SETTING.exists(settings)
? INITIAL_CLUSTER_MANAGER_NODES_SETTING.getKey()
: INITIAL_MASTER_NODES_SETTING.getKey();
if (DiscoveryModule.isSingleNodeDiscovery(settings)) {
if (INITIAL_CLUSTER_MANAGER_NODES_SETTING.existsOrFallbackExists(settings)) {
// TODO: Remove variable 'initialClusterManagerSettingName' after removing MASTER_ROLE.
String initialClusterManagerSettingName = INITIAL_CLUSTER_MANAGER_NODES_SETTING.exists(settings)
? INITIAL_CLUSTER_MANAGER_NODES_SETTING.getKey()
: INITIAL_MASTER_NODES_SETTING.getKey();
throw new IllegalArgumentException(
"setting ["
+ initialClusterManagerSettingName
Expand All @@ -145,7 +145,7 @@ public ClusterBootstrapService(
bootstrapRequirements = unmodifiableSet(new LinkedHashSet<>(initialMasterNodes));
if (bootstrapRequirements.size() != initialMasterNodes.size()) {
throw new IllegalArgumentException(
"setting [" + INITIAL_CLUSTER_MANAGER_NODES_SETTING.getKey() + "] contains duplicates: " + initialMasterNodes
"setting [" + initialClusterManagerSettingName + "] contains duplicates: " + initialMasterNodes
);
}
unconfiguredBootstrapTimeout = discoveryIsConfigured(settings) ? null : UNCONFIGURED_BOOTSTRAP_TIMEOUT_SETTING.get(settings);
Expand All @@ -163,7 +163,8 @@ public static boolean discoveryIsConfigured(Settings settings) {
LEGACY_DISCOVERY_HOSTS_PROVIDER_SETTING,
DISCOVERY_SEED_HOSTS_SETTING,
LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING,
INITIAL_CLUSTER_MANAGER_NODES_SETTING
INITIAL_CLUSTER_MANAGER_NODES_SETTING,
INITIAL_MASTER_NODES_SETTING
).anyMatch(s -> s.exists(settings));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -818,5 +818,7 @@ public void testDiscoveryConfiguredCheck() throws NodeValidationException {
ensureChecksPass.accept(Settings.builder().putList(ClusterBootstrapService.INITIAL_CLUSTER_MANAGER_NODES_SETTING.getKey()));
ensureChecksPass.accept(Settings.builder().putList(DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING.getKey()));
ensureChecksPass.accept(Settings.builder().putList(SettingsBasedSeedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING.getKey()));
// Validate the deprecated setting is still valid during the node bootstrap.
ensureChecksPass.accept(Settings.builder().putList(ClusterBootstrapService.INITIAL_MASTER_NODES_SETTING.getKey()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,19 @@ public void testDoesNothingByDefaultIfSeedHostsConfigured() {
testDoesNothingWithSettings(builder().putList(DISCOVERY_SEED_HOSTS_SETTING.getKey()));
}

public void testDoesNothingByDefaultIfMasterNodesConfigured() {
public void testDoesNothingByDefaultIfClusterManagerNodesConfigured() {
testDoesNothingWithSettings(builder().putList(INITIAL_CLUSTER_MANAGER_NODES_SETTING.getKey()));
}

// Validate the deprecated setting is still valid during the cluster bootstrap.
public void testDoesNothingByDefaultIfMasterNodesConfigured() {
testDoesNothingWithSettings(builder().putList(INITIAL_MASTER_NODES_SETTING.getKey()));
assertWarnings(
"[cluster.initial_master_nodes] setting was deprecated in OpenSearch and will be removed in a future release! "
+ "See the breaking changes documentation for the next major version."
);
}

public void testDoesNothingByDefaultOnMasterIneligibleNodes() {
localNode = new DiscoveryNode(
"local",
Expand Down