diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/dart/worker/DartWorkerContext.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/dart/worker/DartWorkerContext.java index 525162fd8ddd..05cbf210f897 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/dart/worker/DartWorkerContext.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/dart/worker/DartWorkerContext.java @@ -58,7 +58,7 @@ public class DartWorkerContext implements WorkerContext { private final String queryId; private final String controllerHost; - private final String workerId; + private final WorkerId workerId; private final DruidNode selfNode; private final ObjectMapper jsonMapper; private final Injector injector; @@ -82,7 +82,6 @@ public class DartWorkerContext implements WorkerContext DartWorkerContext( final String queryId, final String controllerHost, - final String workerId, final DruidNode selfNode, final ObjectMapper jsonMapper, final Injector injector, @@ -100,7 +99,7 @@ public class DartWorkerContext implements WorkerContext { this.queryId = queryId; this.controllerHost = controllerHost; - this.workerId = workerId; + this.workerId = WorkerId.fromDruidNode(selfNode, queryId); this.selfNode = selfNode; this.jsonMapper = jsonMapper; this.injector = injector; @@ -125,7 +124,7 @@ public String queryId() @Override public String workerId() { - return workerId; + return workerId.toString(); } @Override diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/dart/worker/DartWorkerFactoryImpl.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/dart/worker/DartWorkerFactoryImpl.java index eb2b25252f6a..34da929060d8 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/dart/worker/DartWorkerFactoryImpl.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/dart/worker/DartWorkerFactoryImpl.java @@ -29,7 +29,6 @@ import org.apache.druid.messages.server.Outbox; import org.apache.druid.msq.dart.Dart; import org.apache.druid.msq.dart.controller.messages.ControllerMessage; -import org.apache.druid.msq.dart.worker.http.DartWorkerResource; import org.apache.druid.msq.exec.MemoryIntrospector; import org.apache.druid.msq.exec.ProcessingBuffersProvider; import org.apache.druid.msq.exec.Worker; @@ -44,15 +43,12 @@ import org.apache.druid.server.DruidNode; import java.io.File; -import java.net.URI; -import java.net.URISyntaxException; /** * Production implementation of {@link DartWorkerFactory}. */ public class DartWorkerFactoryImpl implements DartWorkerFactory { - private final String id; private final DruidNode selfNode; private final ObjectMapper jsonMapper; private final ObjectMapper smileMapper; @@ -82,7 +78,6 @@ public DartWorkerFactoryImpl( Outbox outbox ) { - this.id = makeWorkerId(selfNode); this.selfNode = selfNode; this.jsonMapper = jsonMapper; this.smileMapper = smileMapper; @@ -103,7 +98,6 @@ public Worker build(String queryId, String controllerHost, File tempDir, QueryCo final WorkerContext workerContext = new DartWorkerContext( queryId, controllerHost, - id, selfNode, jsonMapper, injector, @@ -121,22 +115,4 @@ public Worker build(String queryId, String controllerHost, File tempDir, QueryCo return new WorkerImpl(null, workerContext); } - - private static String makeWorkerId(final DruidNode selfNode) - { - try { - return new URI( - selfNode.getServiceScheme(), - null, - selfNode.getHost(), - selfNode.getPortToUse(), - DartWorkerResource.PATH, - null, - null - ).toString(); - } - catch (URISyntaxException e) { - throw new RuntimeException(e); - } - } }