gianm commented on a change in pull request #12222:
URL: https://github.com/apache/druid/pull/12222#discussion_r840043894
##########
File path:
server/src/main/java/org/apache/druid/initialization/Initialization.java
##########
@@ -420,7 +421,6 @@ public static Injector makeInjectorWithModules(
new IndexingServiceDiscoveryModule(),
new CoordinatorDiscoveryModule(),
new LocalDataStorageDruidModule(),
- new TombstoneDataStorageModule(),
Review comment:
Is this removal intentional?
##########
File path:
server/src/main/java/org/apache/druid/discovery/LocalDruidNodeDiscoveryProvider.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.discovery;
+
+import org.apache.druid.server.DruidNode;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.BooleanSupplier;
+
+/**
+ * Local node discovery. In this mode, Druid may run a number of
+ * logical servers within a single process, so that node discovery
+ * is all within the same process, but matches a true distributed
+ * node discovery.
+ * <p>
+ * Concurrency is at the level of the entire provider, which is
+ * necessary to coordinate the active state with ongoing node
+ * discovery and listener registrations. Such a "global" lock
+ * is fine because the actions don't occur frequently, nor do the
+ * actions take much time.
+ */
+public class LocalDruidNodeDiscoveryProvider extends
DruidNodeDiscoveryProvider implements DruidNodeAnnouncer
+{
+ private class RoleEntry implements DruidNodeDiscovery
+ {
+ @SuppressWarnings("unused")
+ private final NodeRole role;
+ private final Map<DruidNode, DiscoveryDruidNode> nodes = new HashMap<>();
+ private final List<Listener> listeners = new ArrayList<>();
+
+ private RoleEntry(NodeRole role)
+ {
+ this.role = role;
+ }
+
+ private void register(DiscoveryDruidNode node)
+ {
+ List<DruidNodeDiscovery.Listener> targets;
+ synchronized (LocalDruidNodeDiscoveryProvider.this) {
Review comment:
Suggestion: add errorprone's `@GuardedBy` annotation too, which will
make the IDE complain at you if something is used without the proper
synchronization.
##########
File path:
server/src/main/java/org/apache/druid/discovery/LocalDruidNodeDiscoveryProvider.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.discovery;
+
+import org.apache.druid.server.DruidNode;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.BooleanSupplier;
+
+/**
+ * Local node discovery. In this mode, Druid may run a number of
+ * logical servers within a single process, so that node discovery
+ * is all within the same process, but matches a true distributed
+ * node discovery.
+ * <p>
+ * Concurrency is at the level of the entire provider, which is
+ * necessary to coordinate the active state with ongoing node
+ * discovery and listener registrations. Such a "global" lock
+ * is fine because the actions don't occur frequently, nor do the
+ * actions take much time.
+ */
+public class LocalDruidNodeDiscoveryProvider extends
DruidNodeDiscoveryProvider implements DruidNodeAnnouncer
+{
+ private class RoleEntry implements DruidNodeDiscovery
+ {
+ @SuppressWarnings("unused")
+ private final NodeRole role;
+ private final Map<DruidNode, DiscoveryDruidNode> nodes = new HashMap<>();
Review comment:
Ah I believe you're right. The structure in this file is NodeRole ->
DruidNode -> DruidNodeDiscovery, which does match how the ZK one works. When I
was looking at it earlier, I missed that this map here is scoped to a single
NodeRole.
##########
File path: server/src/main/java/org/apache/druid/server/Node.java
##########
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.server;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Objects;
+
+/**
+ * This class exists only to support two REST endpoints. It is similar to a
Review comment:
Which two?
##########
File path: server/src/main/java/org/apache/druid/server/Node.java
##########
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.server;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Objects;
+
+/**
+ * This class exists only to support two REST endpoints. It is similar to a
+ * DruidNode, but serializes to the specific form expected by those REST
+ * endpoints. This version omits {@code bindOnHost}, uses the name
+ * {@code `service} where DruidNode uses {@code serviceName}, and
Review comment:
Stray backtick.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]