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

Internal: Remove originalSettings from Node #36569

Merged
merged 7 commits into from
Dec 18, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
9 changes: 0 additions & 9 deletions server/src/main/java/org/elasticsearch/node/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -265,7 +264,6 @@ protected Node(
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();

Expand Down Expand Up @@ -594,13 +592,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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,8 +661,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);
Expand All @@ -677,7 +678,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) {
Expand Down Expand Up @@ -821,15 +822,17 @@ public synchronized void close() {

private final class NodeAndClient implements Closeable {
private MockNode node;
private Settings originalNodeSettings;
Copy link
Member

Choose a reason for hiding this comment

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

I think these can be declared final?

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);
}
Expand Down Expand Up @@ -955,7 +958,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();
Expand Down