|
52 | 52 | import org.elasticsearch.cluster.service.ClusterService; |
53 | 53 | import org.elasticsearch.common.StopWatch; |
54 | 54 | import org.elasticsearch.common.breaker.CircuitBreaker; |
| 55 | +import org.elasticsearch.common.collect.Tuple; |
55 | 56 | import org.elasticsearch.common.component.Lifecycle; |
56 | 57 | import org.elasticsearch.common.component.LifecycleComponent; |
57 | 58 | import org.elasticsearch.common.inject.Injector; |
|
181 | 182 | import java.util.LinkedHashSet; |
182 | 183 | import java.util.List; |
183 | 184 | import java.util.Map; |
| 185 | +import java.util.Objects; |
184 | 186 | import java.util.Optional; |
185 | 187 | import java.util.Set; |
186 | 188 | import java.util.concurrent.CountDownLatch; |
@@ -338,11 +340,36 @@ protected Node(final Environment initialEnvironment, |
338 | 340 | this.environment = new Environment(settings, initialEnvironment.configFile()); |
339 | 341 | Environment.assertEquivalent(initialEnvironment, this.environment); |
340 | 342 | nodeEnvironment = new NodeEnvironment(tmpSettings, environment); |
341 | | - logger.info("node name [{}], node ID [{}], cluster name [{}], roles {}", |
342 | | - NODE_NAME_SETTING.get(tmpSettings), nodeEnvironment.nodeId(), ClusterName.CLUSTER_NAME_SETTING.get(tmpSettings).value(), |
343 | | - DiscoveryNode.getRolesFromSettings(settings).stream() |
344 | | - .map(DiscoveryNodeRole::roleName) |
345 | | - .collect(Collectors.toCollection(LinkedHashSet::new))); |
| 343 | + final Set<String> roleNames = DiscoveryNode.getRolesFromSettings(settings).stream() |
| 344 | + .map(DiscoveryNodeRole::roleName) |
| 345 | + .collect(Collectors.toCollection(LinkedHashSet::new)); |
| 346 | + logger.info( |
| 347 | + "node name [{}], node ID [{}], cluster name [{}], roles {}", |
| 348 | + NODE_NAME_SETTING.get(tmpSettings), |
| 349 | + nodeEnvironment.nodeId(), |
| 350 | + ClusterName.CLUSTER_NAME_SETTING.get(tmpSettings).value(), |
| 351 | + roleNames |
| 352 | + ); |
| 353 | + { |
| 354 | + // are there any legacy settings in use? |
| 355 | + final List<Tuple<DiscoveryNodeRole, Setting<Boolean>>> maybeLegacyRoleSettings = DiscoveryNode.getPossibleRoles() |
| 356 | + .stream() |
| 357 | + .filter(s -> s.legacySetting() != null) |
| 358 | + .map(s -> Tuple.tuple(s, s.legacySetting())) |
| 359 | + .filter(t -> t.v2().exists(settings)) |
| 360 | + .collect(Collectors.toUnmodifiableList()); |
| 361 | + if (maybeLegacyRoleSettings.isEmpty() == false) { |
| 362 | + final String legacyRoleSettingNames = |
| 363 | + maybeLegacyRoleSettings.stream().map(Tuple::v2).map(Setting::getKey).collect(Collectors.joining(", ")); |
| 364 | + deprecationLogger.deprecate( |
| 365 | + DeprecationCategory.SETTINGS, |
| 366 | + "legacy role settings", |
| 367 | + "legacy role settings [{}] are deprecated, use [node.roles={}]", |
| 368 | + legacyRoleSettingNames, |
| 369 | + roleNames |
| 370 | + ); |
| 371 | + } |
| 372 | + } |
346 | 373 | resourcesToClose.add(nodeEnvironment); |
347 | 374 | localNodeFactory = new LocalNodeFactory(settings, nodeEnvironment.nodeId()); |
348 | 375 |
|
|
0 commit comments