Internal: Remove originalSettings from Node (#36569)
This commit removes the originalSettings member from Node. It was only needed to allows test clusters to recreate the node in certain situations. Instead, the test cluster now keeps track of these settings.
This commit is contained in:
parent
32ce1240e4
commit
8ec8342a52
|
@ -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 @@ public class Node implements Closeable {
|
|||
final List<Closeable> 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 @@ public class Node implements Closeable {
|
|||
// 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.
|
||||
*/
|
||||
|
|
|
@ -660,8 +660,9 @@ public final class InternalTestCluster extends TestCluster {
|
|||
// 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 final class InternalTestCluster extends TestCluster {
|
|||
} 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 final class InternalTestCluster extends TestCluster {
|
|||
|
||||
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 @@ public final class InternalTestCluster extends TestCluster {
|
|||
// 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();
|
||||
|
|
Loading…
Reference in New Issue