Skip to content

Commit ca51823

Browse files
committed
simplify node name retrieval
1 parent b2bcc22 commit ca51823

File tree

10 files changed

+10
-84
lines changed

10 files changed

+10
-84
lines changed

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/Driver.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,6 @@ public class Driver implements Releasable, Describable {
5959
*/
6060
private final String taskDescription;
6161

62-
/**
63-
* Name of the cluster executing this driver.
64-
*/
65-
private final String clusterName;
66-
67-
/**
68-
* Name of the node executing this driver.
69-
*/
70-
private final String nodeName;
71-
7262
/**
7363
* The wall clock time when this driver was created in milliseconds since epoch.
7464
* Compared to {@link #startNanos} this is less accurate and is measured by a
@@ -141,8 +131,6 @@ public Driver(
141131
) {
142132
this.sessionId = sessionId;
143133
this.taskDescription = taskDescription;
144-
this.clusterName = clusterName;
145-
this.nodeName = nodeName;
146134
this.startTime = startTime;
147135
this.startNanos = startNanos;
148136
this.driverContext = driverContext;
@@ -536,8 +524,8 @@ private void updateStatus(long extraCpuNanos, int extraIterations, DriverStatus.
536524
return new DriverStatus(
537525
sessionId,
538526
taskDescription,
539-
clusterName,
540-
nodeName,
527+
prev.clusterName(),
528+
prev.nodeName(),
541529
startTime,
542530
now,
543531
prev.cpuNanos() + extraCpuNanos,

x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/exchange/ExchangeServiceTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import org.elasticsearch.compute.operator.SinkOperator;
3838
import org.elasticsearch.compute.operator.SourceOperator;
3939
import org.elasticsearch.compute.test.MockBlockFactory;
40-
import org.elasticsearch.compute.test.TestDriverFactory;
4140
import org.elasticsearch.core.ReleasableRef;
4241
import org.elasticsearch.core.TimeValue;
4342
import org.elasticsearch.tasks.Task;

x-pack/plugin/esql/qa/server/single-node/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/RestEsqlIT.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,10 @@ public void testForceSleepsProfile() throws IOException {
531531
}
532532

533533
private MapMatcher commonProfile() {
534-
return matchesMap().entry("task_description", any(String.class))
534+
return matchesMap() //
535+
.entry("task_description", any(String.class))
536+
.entry("cluster_name", any(String.class))
537+
.entry("node_name", any(String.class))
535538
.entry("start_millis", greaterThan(0L))
536539
.entry("stop_millis", greaterThan(0L))
537540
.entry("iterations", greaterThan(0L))

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/planner/LocalExecutionPlanner.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
package org.elasticsearch.xpack.esql.planner;
99

10+
import org.elasticsearch.cluster.ClusterName;
1011
import org.elasticsearch.common.settings.Settings;
1112
import org.elasticsearch.common.util.BigArrays;
1213
import org.elasticsearch.compute.Describable;
@@ -51,6 +52,7 @@
5152
import org.elasticsearch.index.IndexMode;
5253
import org.elasticsearch.logging.LogManager;
5354
import org.elasticsearch.logging.Logger;
55+
import org.elasticsearch.node.Node;
5456
import org.elasticsearch.tasks.CancellableTask;
5557
import org.elasticsearch.xpack.esql.EsqlIllegalArgumentException;
5658
import org.elasticsearch.xpack.esql.core.expression.Alias;
@@ -131,7 +133,6 @@ public class LocalExecutionPlanner {
131133
private final BigArrays bigArrays;
132134
private final BlockFactory blockFactory;
133135
private final Settings settings;
134-
private final NodeInfoSupplier nodeInfoSupplier;
135136
private final Configuration configuration;
136137
private final Supplier<ExchangeSource> exchangeSourceSupplier;
137138
private final Supplier<ExchangeSink> exchangeSinkSupplier;
@@ -147,7 +148,6 @@ public LocalExecutionPlanner(
147148
BigArrays bigArrays,
148149
BlockFactory blockFactory,
149150
Settings settings,
150-
NodeInfoSupplier nodeInfoSupplier,
151151
Configuration configuration,
152152
Supplier<ExchangeSource> exchangeSourceSupplier,
153153
Supplier<ExchangeSink> exchangeSinkSupplier,
@@ -163,7 +163,6 @@ public LocalExecutionPlanner(
163163
this.bigArrays = bigArrays;
164164
this.blockFactory = blockFactory;
165165
this.settings = settings;
166-
this.nodeInfoSupplier = nodeInfoSupplier;
167166
this.configuration = configuration;
168167
this.exchangeSourceSupplier = exchangeSourceSupplier;
169168
this.exchangeSinkSupplier = exchangeSinkSupplier;
@@ -199,8 +198,8 @@ public LocalExecutionPlan plan(String taskDescription, FoldContext foldCtx, Phys
199198
new DriverFactory(
200199
new DriverSupplier(
201200
taskDescription,
202-
nodeInfoSupplier.clusterName(),
203-
nodeInfoSupplier.nodeName(),
201+
Node.NODE_NAME_SETTING.get(settings),
202+
ClusterName.CLUSTER_NAME_SETTING.get(settings).value(),
204203
context.bigArrays,
205204
context.blockFactory,
206205
physicalOperation,

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/planner/NodeInfoSupplier.java

Lines changed: 0 additions & 31 deletions
This file was deleted.

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/ComputeService.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
import org.elasticsearch.xpack.esql.plan.physical.PhysicalPlan;
5252
import org.elasticsearch.xpack.esql.planner.EsPhysicalOperationProviders;
5353
import org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner;
54-
import org.elasticsearch.xpack.esql.planner.NodeInfoSupplier;
5554
import org.elasticsearch.xpack.esql.planner.PlannerUtils;
5655
import org.elasticsearch.xpack.esql.session.Configuration;
5756
import org.elasticsearch.xpack.esql.session.Result;
@@ -366,7 +365,6 @@ public SourceProvider createSourceProvider() {
366365
bigArrays,
367366
blockFactory,
368367
clusterService.getSettings(),
369-
NodeInfoSupplier.from(clusterService),
370368
context.configuration(),
371369
context.exchangeSourceSupplier(),
372370
context.exchangeSinkSupplier(),

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/CsvTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,6 @@ void executeSubPlan(
643643
bigArrays,
644644
blockFactory,
645645
randomNodeSettings(),
646-
TestNodeInfoSupplier.INSTANCE,
647646
configuration,
648647
exchangeSource::createExchangeSource,
649648
() -> exchangeSink.createExchangeSink(() -> {}),

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/TestNodeInfoSupplier.java

Lines changed: 0 additions & 25 deletions
This file was deleted.

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/PhysicalPlanOptimizerTests.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import org.elasticsearch.xpack.esql.EsqlTestUtils;
4242
import org.elasticsearch.xpack.esql.EsqlTestUtils.TestConfigurableSearchStats;
4343
import org.elasticsearch.xpack.esql.EsqlTestUtils.TestConfigurableSearchStats.Config;
44-
import org.elasticsearch.xpack.esql.TestNodeInfoSupplier;
4544
import org.elasticsearch.xpack.esql.VerificationException;
4645
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
4746
import org.elasticsearch.xpack.esql.analysis.Analyzer;
@@ -7596,7 +7595,6 @@ private LocalExecutionPlanner.LocalExecutionPlan physicalOperationsFromPhysicalP
75967595
BigArrays.NON_RECYCLING_INSTANCE,
75977596
TestBlockFactory.getNonBreakingInstance(),
75987597
Settings.EMPTY,
7599-
TestNodeInfoSupplier.INSTANCE,
76007598
config,
76017599
new ExchangeSourceHandler(10, null)::createExchangeSource,
76027600
() -> exchangeSinkHandler.createExchangeSink(() -> {}),

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/planner/LocalExecutionPlannerTests.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import org.elasticsearch.index.mapper.MapperServiceTestCase;
3232
import org.elasticsearch.search.internal.AliasFilter;
3333
import org.elasticsearch.search.internal.ContextIndexSearcher;
34-
import org.elasticsearch.xpack.esql.TestNodeInfoSupplier;
3534
import org.elasticsearch.xpack.esql.core.expression.FieldAttribute;
3635
import org.elasticsearch.xpack.esql.core.expression.FoldContext;
3736
import org.elasticsearch.xpack.esql.core.expression.Literal;
@@ -181,7 +180,6 @@ private LocalExecutionPlanner planner() throws IOException {
181180
BigArrays.NON_RECYCLING_INSTANCE,
182181
TestBlockFactory.getNonBreakingInstance(),
183182
Settings.EMPTY,
184-
TestNodeInfoSupplier.INSTANCE,
185183
config(),
186184
null,
187185
null,

0 commit comments

Comments
 (0)