Skip to content

Commit c9d397f

Browse files
authored
Remove the pidfile setting (#45940)
The pidfile setting was deprecated in version 7.4.0 of Elasticsearch for removal in Elasticsearch 8.0.0. This commit removes the pidfile setting.
1 parent e2ad888 commit c9d397f

File tree

4 files changed

+12
-21
lines changed

4 files changed

+12
-21
lines changed

docs/reference/migration/migrate_8_0/settings.asciidoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ counterparts. In 8.0.0, these settings have been removed. Elasticsearch will
1212
refuse to start if you have these settings in your configuration or cluster
1313
state.
1414

15+
[float]
16+
[[remove-pidfile]]
17+
==== `pidfile` setting is replaced by `node.pidfile`
18+
19+
To ensure that all settings are in a proper namespace, the `pidfile` setting was
20+
previously deprecated in version 7.4.0 of Elasticsearch, and is removed in
21+
version 8.0.0. Instead, use `node.pidfile`.
22+
1523
[float]
1624
[[remove-processors]]
1725
==== `processors` setting is replaced by `node.processors`

server/src/main/java/org/elasticsearch/common/settings/ClusterSettings.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@ public void apply(Settings value, Settings current, Settings previous) {
362362
Environment.PATH_LOGS_SETTING,
363363
Environment.PATH_REPO_SETTING,
364364
Environment.PATH_SHARED_DATA_SETTING,
365-
Environment.PIDFILE_SETTING,
366365
Environment.NODE_PIDFILE_SETTING,
367366
NodeEnvironment.NODE_ID_SEED_SETTING,
368367
Node.INITIAL_STATE_TIMEOUT_SETTING,

server/src/main/java/org/elasticsearch/env/Environment.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ public class Environment {
6060
public static final Setting<List<String>> PATH_REPO_SETTING =
6161
Setting.listSetting("path.repo", Collections.emptyList(), Function.identity(), Property.NodeScope);
6262
public static final Setting<String> PATH_SHARED_DATA_SETTING = Setting.simpleString("path.shared_data", Property.NodeScope);
63-
public static final Setting<String> PIDFILE_SETTING = Setting.simpleString("pidfile", Property.Deprecated, Property.NodeScope);
64-
public static final Setting<String> NODE_PIDFILE_SETTING = Setting.simpleString("node.pidfile", PIDFILE_SETTING, Property.NodeScope);
63+
public static final Setting<String> NODE_PIDFILE_SETTING = Setting.simpleString("node.pidfile", Property.NodeScope);
6564

6665
private final Settings settings;
6766

@@ -155,7 +154,7 @@ public Environment(final Settings settings, final Path configPath) {
155154
logsFile = homeFile.resolve("logs");
156155
}
157156

158-
if (NODE_PIDFILE_SETTING.exists(settings) || PIDFILE_SETTING.exists(settings)) {
157+
if (NODE_PIDFILE_SETTING.exists(settings)) {
159158
pidFile = PathUtils.get(NODE_PIDFILE_SETTING.get(settings)).toAbsolutePath().normalize();
160159
} else {
161160
pidFile = null;
@@ -183,9 +182,6 @@ public Environment(final Settings settings, final Path configPath) {
183182
if (NODE_PIDFILE_SETTING.exists(settings)) {
184183
assert pidFile != null;
185184
finalSettings.put(Environment.NODE_PIDFILE_SETTING.getKey(), pidFile.toString());
186-
} else if (PIDFILE_SETTING.exists(settings)) {
187-
assert pidFile != null;
188-
finalSettings.put(Environment.PIDFILE_SETTING.getKey(), pidFile.toString());
189185
}
190186
this.settings = finalSettings.build();
191187
}

server/src/test/java/org/elasticsearch/env/EnvironmentTests.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
package org.elasticsearch.env;
2020

2121
import org.elasticsearch.common.io.PathUtils;
22-
import org.elasticsearch.common.settings.Setting;
2322
import org.elasticsearch.common.settings.Settings;
2423
import org.elasticsearch.test.ESTestCase;
2524

@@ -175,20 +174,13 @@ public void testTempPathValidationWhenRegularFile() throws IOException {
175174

176175
// test that environment paths are absolute and normalized
177176
public void testPathNormalization() throws IOException {
178-
final Setting<String> pidFileSetting;
179-
if (randomBoolean()) {
180-
pidFileSetting = Environment.NODE_PIDFILE_SETTING;
181-
} else {
182-
pidFileSetting = Environment.PIDFILE_SETTING;
183-
}
184-
185177
final Settings settings = Settings.builder()
186178
.put(Environment.PATH_HOME_SETTING.getKey(), "home")
187179
.put(Environment.PATH_DATA_SETTING.getKey(), "./home/../home/data")
188180
.put(Environment.PATH_LOGS_SETTING.getKey(), "./home/../home/logs")
189181
.put(Environment.PATH_REPO_SETTING.getKey(), "./home/../home/repo")
190182
.put(Environment.PATH_SHARED_DATA_SETTING.getKey(), "./home/../home/shared_data")
191-
.put(pidFileSetting.getKey(), "./home/../home/pidfile")
183+
.put(Environment.NODE_PIDFILE_SETTING.getKey(), "./home/../home/pidfile")
192184
.build();
193185

194186
// the above paths will be treated as relative to the working directory
@@ -214,12 +206,8 @@ public void testPathNormalization() throws IOException {
214206
final String sharedDataPath = Environment.PATH_SHARED_DATA_SETTING.get(environment.settings());
215207
assertPath(sharedDataPath, home.resolve("shared_data"));
216208

217-
final String pidFile = pidFileSetting.get(environment.settings());
209+
final String pidFile = Environment.NODE_PIDFILE_SETTING.get(environment.settings());
218210
assertPath(pidFile, home.resolve("pidfile"));
219-
220-
if (pidFileSetting.isDeprecated()) {
221-
assertSettingDeprecationsAndWarnings(new Setting<?>[] { pidFileSetting });
222-
}
223211
}
224212

225213
private void assertPath(final String actual, final Path expected) {

0 commit comments

Comments
 (0)