Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -10,13 +10,18 @@
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.xpack.core.deprecation.DeprecationIssue;

import java.util.Locale;
import java.util.stream.Collectors;

public class ClusterDeprecationChecks {
static DeprecationIssue checkTransientSettingsExistence(ClusterState state) {
if (state.metadata().transientSettings().isEmpty() == false) {
return new DeprecationIssue(DeprecationIssue.Level.WARNING,
"Transient cluster settings are in the process of being removed.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like @debadair from our docs team has weighed in on this, and has recommended the message be "Transient cluster settings are deprecated" and the details be "Use persistent settings to configure your cluster." I like the idea of actually putting the setting names in the details like this though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing, I'll change the PR to use that exact wording :).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @masseyke! I updated the wording to match the docs team recommendation.

"https://ela.st/es-deprecation-7-transient-cluster-settings",
"Use persistent settings to define your cluster settings instead.",
String.format(Locale.ROOT,
"Use persistent settings instead of transient settings for the following: [%s]",
state.metadata().transientSettings().names().stream().sorted().collect(Collectors.joining(", "))),
false,
null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,41 @@
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.core.deprecation.DeprecationIssue;

import java.util.Locale;

import static org.hamcrest.Matchers.equalTo;

public class ClusterDeprecationChecksTests extends ESTestCase {

public void testCheckTransientSettingsExistence() {
Settings persistentSettings = Settings.builder()
.put("xpack.monitoring.collection.enabled", true)
.build();

Settings transientSettings = Settings.builder()
.put("indices.recovery.max_bytes_per_sec", "20mb")
.put("action.auto_create_index", true)
.put("cluster.routing.allocation.enable", "primaries")
.build();
Metadata metadataWithTransientSettings = Metadata.builder()
.persistentSettings(persistentSettings)
.transientSettings(transientSettings)
.build();

ClusterState badState = ClusterState.builder(new ClusterName("test")).metadata(metadataWithTransientSettings).build();
DeprecationIssue issue = ClusterDeprecationChecks.checkTransientSettingsExistence(badState);
String expectedDetails = String.format(Locale.ROOT,
"Use persistent settings instead of transient settings for the following: [%s]",
String.join(", ", "action", "cluster", "indices"));
assertThat(issue, equalTo(
new DeprecationIssue(DeprecationIssue.Level.WARNING,
"Transient cluster settings are in the process of being removed.",
"https://ela.st/es-deprecation-7-transient-cluster-settings",
"Use persistent settings to define your cluster settings instead.",
expectedDetails,
false, null)
));

Settings persistentSettings = Settings.builder()
persistentSettings = Settings.builder()
.put("indices.recovery.max_bytes_per_sec", "20mb")
.build();
Metadata metadataWithoutTransientSettings = Metadata.builder()
Expand Down