Fix issue that deprecated setting 'cluster.initial_master_nodes' is not identified in node bootstrap check (#2779)
* Fix issue that deprecated setting 'cluster.initial_master_nodes' is not identified during node bootstrap Signed-off-by: Tianli Feng <ftianli@amazon.com> * Restore a variable name Signed-off-by: Tianli Feng <ftianli@amazon.com>
This commit is contained in:
parent
ce5c55dbbc
commit
dd24e17ea6
|
@ -113,12 +113,12 @@ public class 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
|
||||
|
@ -145,7 +145,7 @@ public class 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);
|
||||
|
@ -163,7 +163,8 @@ public class ClusterBootstrapService {
|
|||
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));
|
||||
}
|
||||
|
||||
|
|
|
@ -818,5 +818,7 @@ public class BootstrapChecksTests extends AbstractBootstrapCheckTestCase {
|
|||
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()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,10 +166,19 @@ public class ClusterBootstrapServiceTests extends OpenSearchTestCase {
|
|||
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",
|
||||
|
|
Loading…
Reference in New Issue