Skip to content

Commit

Permalink
Make node client type setting a noop (elastic#101214)
Browse files Browse the repository at this point in the history
The node client type is a remnant of the transport client. This commit
cleans up some test reads and an unnecessary override of the setting. It
was already not read anywhere in production. Now it is only registered
in order to provide validation. In the future it should be deprecated
and removed.
  • Loading branch information
rjernst authored Oct 24, 2023
1 parent 6e6e85d commit b0fb121
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 43 deletions.
6 changes: 6 additions & 0 deletions rest-api-spec/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ tasks.named("yamlRestTestV7CompatTransform").configure { task ->

// we can now search using doc values only
task.replaceValueInMatch("fields.object\\.nested1.long.searchable", true)

//client.type no longer exists #101214
task.replaceKeyInMatch("nodes.\$node_id.settings.client.type", "nodes.\$node_id.settings.node.attr.testattr")
task.replaceValueInMatch("nodes.\$node_id.settings.node.attr.testattr", "test")
task.replaceKeyInMatch("nodes.\$node_id.settings.client\\.type", "nodes.\$node_id.settings.node\\.attr\\.testattr")
task.replaceValueInMatch("nodes.\$node_id.settings.node\\.attr\\.testattr", "test")
}

tasks.register('enforceYamlTestConvention').configure {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
nodes.info:
metric: [ settings ]

- match : { nodes.$node_id.settings.client.type: node }
- match : { nodes.$node_id.settings.node.attr.testattr: test }

- do:
nodes.info:
metric: [ settings ]
flat_settings: true

- match : { nodes.$node_id.settings.client\.type: node }
- match : { nodes.$node_id.settings.node\.attr\.testattr: test }

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
*/
public interface Client extends ElasticsearchClient, Releasable {

// Note: This setting is registered only for bwc. The value is never read.
Setting<String> CLIENT_TYPE_SETTING_S = new Setting<>("client.type", "node", (s) -> {
return switch (s) {
case "node", "transport" -> s;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,7 @@ private void construct(Environment initialEnvironment, NodeServiceProvider servi
throws IOException {
// Pass the node settings to the DeprecationLogger class so that it can have the deprecation.skip_deprecated_settings setting:
DeprecationLogger.initialize(initialEnvironment.settings());
Settings environmentSettings = Settings.builder()
.put(initialEnvironment.settings())
.put(Client.CLIENT_TYPE_SETTING_S.getKey(), "node")
.build();
Settings environmentSettings = initialEnvironment.settings();

final JvmInfo jvmInfo = JvmInfo.jvmInfo();
logger.info(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.client.internal.Client;
import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.node.DiscoveryNodeUtils;
Expand Down Expand Up @@ -74,9 +73,6 @@ public void setup() {
public void testXPackInstalledAttrClash() throws Exception {
Settings.Builder builder = Settings.builder();
builder.put("node.attr." + XPackPlugin.XPACK_INSTALLED_NODE_ATTR, randomBoolean());
if (randomBoolean()) {
builder.put(Client.CLIENT_TYPE_SETTING_S.getKey(), "transport");
}
XPackPlugin xpackPlugin = createXPackPlugin(builder.put("path.home", createTempDir()).build());
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, xpackPlugin::additionalSettings);
assertThat(
Expand Down

0 comments on commit b0fb121

Please sign in to comment.