diff --git a/server/src/main/java/org/elasticsearch/node/Node.java b/server/src/main/java/org/elasticsearch/node/Node.java index 068b713cb8c3e..cf564ebb6d898 100644 --- a/server/src/main/java/org/elasticsearch/node/Node.java +++ b/server/src/main/java/org/elasticsearch/node/Node.java @@ -238,7 +238,6 @@ public class Node implements Closeable { private final Logger logger; private final Injector injector; private final Settings settings; - private final Settings originalSettings; private final Environment environment; private final NodeEnvironment nodeEnvironment; private final PluginsService pluginsService; @@ -265,7 +264,6 @@ protected Node( final List resourcesToClose = new ArrayList<>(); // register everything we need to release in the case of an error boolean success = false; try { - originalSettings = environment.settings(); Settings tmpSettings = Settings.builder().put(environment.settings()) .put(Client.CLIENT_TYPE_SETTING_S.getKey(), CLIENT_TYPE).build(); @@ -595,13 +593,6 @@ protected void processRecoverySettings(ClusterSettings clusterSettings, Recovery // Noop in production, overridden by tests } - /** - * The original settings that were used to create the node - */ - public Settings originalSettings() { - return originalSettings; - } - /** * The settings that are used by this node. Contains original settings as well as additional settings provided by plugins. */ diff --git a/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java b/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java index a625de4150509..246e0f555b1e7 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java +++ b/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java @@ -660,8 +660,9 @@ private NodeAndClient buildNode(int nodeId, long seed, Settings settings, // we clone this here since in the case of a node restart we might need it again secureSettings = ((MockSecureSettings) secureSettings).clone(); } + final Settings nodeSettings = finalSettings.build(); MockNode node = new MockNode( - finalSettings.build(), + nodeSettings, plugins, nodeConfigurationSource.nodeConfigPath(nodeId), forbidPrivateIndexSettings); @@ -676,7 +677,7 @@ public void afterStart() { } catch (IOException e) { throw new UncheckedIOException(e); } - return new NodeAndClient(name, node, nodeId); + return new NodeAndClient(name, node, nodeSettings, nodeId); } private String buildNodeName(int id, Settings settings) { @@ -820,15 +821,17 @@ public synchronized void close() { private final class NodeAndClient implements Closeable { private MockNode node; + private final Settings originalNodeSettings; private Client nodeClient; private Client transportClient; private final AtomicBoolean closed = new AtomicBoolean(false); private final String name; private final int nodeAndClientId; - NodeAndClient(String name, MockNode node, int nodeAndClientId) { + NodeAndClient(String name, MockNode node, Settings originalNodeSettings, int nodeAndClientId) { this.node = node; this.name = name; + this.originalNodeSettings = originalNodeSettings; this.nodeAndClientId = nodeAndClientId; markNodeDataDirsAsNotEligableForWipe(node); } @@ -954,7 +957,7 @@ private void recreateNode(final Settings newSettings, final Runnable onTransport // use a new seed to make sure we have new node id final long newIdSeed = NodeEnvironment.NODE_ID_SEED_SETTING.get(node.settings()) + 1; Settings finalSettings = Settings.builder() - .put(node.originalSettings()) + .put(originalNodeSettings) .put(newSettings) .put(NodeEnvironment.NODE_ID_SEED_SETTING.getKey(), newIdSeed) .build();