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

Deprecation check for File Discovery plugin #36190

Merged
merged 1 commit into from Dec 7, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -38,7 +38,8 @@ private DeprecationChecks() {
static List<BiFunction<List<NodeInfo>, List<NodeStats>, DeprecationIssue>> NODE_SETTINGS_CHECKS =
Collections.unmodifiableList(Arrays.asList(
NodeDeprecationChecks::azureRepositoryChanges,
NodeDeprecationChecks::gcsRepositoryChanges
NodeDeprecationChecks::gcsRepositoryChanges,
NodeDeprecationChecks::fileDiscoveryPluginRemoved
));

static List<Function<IndexMetaData, DeprecationIssue>> INDEX_SETTINGS_CHECKS =
Expand Down
Expand Up @@ -49,4 +49,20 @@ static DeprecationIssue gcsRepositoryChanges(List<NodeInfo> nodeInfos, List<Node
}
return null;
}

static DeprecationIssue fileDiscoveryPluginRemoved(List<NodeInfo> nodeInfos, List<NodeStats> nodeStats) {
List<String> nodesFound = nodeInfos.stream()
.filter(nodeInfo ->
nodeInfo.getPlugins().getPluginInfos().stream()
.anyMatch(pluginInfo -> "discovery-file".equals(pluginInfo.getName()))
).map(nodeInfo -> nodeInfo.getNode().getName()).collect(Collectors.toList());
if (nodesFound.size() > 0) {
return new DeprecationIssue(DeprecationIssue.Level.WARNING,
"File-based discovery is no longer a plugin and uses a different path",
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_70_cluster_changes.html" +
"#_file_based_discovery_plugin",
"nodes with discovery-file installed: " + nodesFound);
}
return null;
}
}
Expand Up @@ -88,4 +88,19 @@ public void testGCSPluginCheck() {
"nodes with repository-gcs installed: [node_check]");
assertSettingsAndIssue("foo", "bar", expected);
}

public void testFileDiscoveryPluginCheck() {
Version esVersion = VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, Version.CURRENT);
PluginInfo deprecatedPlugin = new PluginInfo(
"discovery-file", "dummy plugin description", "dummy_plugin_version", esVersion,
"javaVersion", "DummyPluginName", Collections.emptyList(), false);
pluginsAndModules = new PluginsAndModules(Collections.singletonList(deprecatedPlugin), Collections.emptyList());

DeprecationIssue expected = new DeprecationIssue(DeprecationIssue.Level.WARNING,
"File-based discovery is no longer a plugin and uses a different path",
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_70_cluster_changes.html" +
"#_file_based_discovery_plugin",
"nodes with discovery-file installed: [node_check]");
assertSettingsAndIssue("foo", "bar", expected);
}
}