You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ds...@apache.org on 2023/08/03 12:51:41 UTC

[solr] branch branch_9x updated: Remove DistributedQueueFactory (#1732)

This is an automated email from the ASF dual-hosted git repository.

dsmiley pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new ad1675aecc7 Remove DistributedQueueFactory (#1732)
ad1675aecc7 is described below

commit ad1675aecc7b5ac2d25bb80c143b4e0de422b4fa
Author: David Smiley <ds...@apache.org>
AuthorDate: Thu Aug 3 08:47:35 2023 -0400

    Remove DistributedQueueFactory (#1732)
    
    Not needed.
    Refactoring. No real back-compatibility concern; too internal for a JIRA.
---
 .../java/org/apache/solr/cloud/ZkController.java   |  4 +--
 .../solr/cloud/ZkDistributedQueueFactory.java      | 39 ----------------------
 .../test/org/apache/solr/cloud/OverseerTest.java   |  7 ++--
 .../client/solrj/cloud/DelegatingCloudManager.java |  5 ---
 .../solrj/cloud/DistributedQueueFactory.java       | 26 ---------------
 .../solr/client/solrj/cloud/SolrCloudManager.java  |  2 --
 .../client/solrj/impl/SolrClientCloudManager.java  | 18 ++--------
 7 files changed, 7 insertions(+), 94 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
index 548587b9e04..0886200f00e 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -875,9 +875,7 @@ public class ZkController implements Closeable {
               .withConnectionTimeout(15000, TimeUnit.MILLISECONDS)
               .withSocketTimeout(30000, TimeUnit.MILLISECONDS)
               .build();
-      cloudManager =
-          new SolrClientCloudManager(
-              new ZkDistributedQueueFactory(zkClient), cloudSolrClient, cc.getObjectCache());
+      cloudManager = new SolrClientCloudManager(cloudSolrClient, cc.getObjectCache());
       cloudManager.getClusterStateProvider().connect();
     }
     return cloudManager;
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkDistributedQueueFactory.java b/solr/core/src/java/org/apache/solr/cloud/ZkDistributedQueueFactory.java
deleted file mode 100644
index 50cdc3bd1f8..00000000000
--- a/solr/core/src/java/org/apache/solr/cloud/ZkDistributedQueueFactory.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.solr.cloud;
-
-import java.io.IOException;
-import org.apache.solr.client.solrj.cloud.DistributedQueue;
-import org.apache.solr.client.solrj.cloud.DistributedQueueFactory;
-import org.apache.solr.common.cloud.SolrZkClient;
-
-/** Implementation of {@link DistributedQueueFactory} that uses ZooKeeper. */
-public class ZkDistributedQueueFactory implements DistributedQueueFactory {
-  private final SolrZkClient zkClient;
-
-  public ZkDistributedQueueFactory(SolrZkClient zkClient) {
-    this.zkClient = zkClient;
-  }
-
-  @Override
-  public DistributedQueue makeQueue(String path) throws IOException {
-    return new ZkDistributedQueue(zkClient, path);
-  }
-
-  @Override
-  public void removeQueue(String path) throws IOException {}
-}
diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
index 4b9bb5b5d2d..661054a63dc 100644
--- a/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
@@ -1936,19 +1936,18 @@ public class OverseerTest extends SolrTestCaseJ4 {
     when(zkController.getLeaderProps(anyString(), anyString(), anyInt())).thenCallRealMethod();
     when(zkController.getLeaderProps(anyString(), anyString(), anyInt(), anyBoolean()))
         .thenCallRealMethod();
-    doReturn(getCloudDataProvider(zkAddress, zkClient)).when(zkController).getSolrCloudManager();
+    doReturn(getCloudDataProvider(zkAddress)).when(zkController).getSolrCloudManager();
     return zkController;
   }
 
-  private SolrCloudManager getCloudDataProvider(String zkAddress, SolrZkClient zkClient) {
+  private SolrCloudManager getCloudDataProvider(String zkAddress) {
     var client =
         new CloudLegacySolrClient.Builder(Collections.singletonList(zkAddress), Optional.empty())
             .withSocketTimeout(30000, TimeUnit.MILLISECONDS)
             .withConnectionTimeout(15000, TimeUnit.MILLISECONDS)
             .build();
     solrClients.add(client);
-    SolrClientCloudManager sccm =
-        new SolrClientCloudManager(new ZkDistributedQueueFactory(zkClient), client);
+    SolrClientCloudManager sccm = new SolrClientCloudManager(client);
     sccm.getClusterStateProvider().connect();
     return sccm;
   }
diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/cloud/DelegatingCloudManager.java b/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/cloud/DelegatingCloudManager.java
index a8039fd95cf..cc8c265692f 100644
--- a/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/cloud/DelegatingCloudManager.java
+++ b/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/cloud/DelegatingCloudManager.java
@@ -49,11 +49,6 @@ public class DelegatingCloudManager implements SolrCloudManager {
     return delegate.getDistribStateManager();
   }
 
-  @Override
-  public DistributedQueueFactory getDistributedQueueFactory() {
-    return delegate.getDistributedQueueFactory();
-  }
-
   @Override
   public ObjectCache getObjectCache() {
     return delegate == null ? objectCache : delegate.getObjectCache();
diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/cloud/DistributedQueueFactory.java b/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/cloud/DistributedQueueFactory.java
deleted file mode 100644
index bd5244a6080..00000000000
--- a/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/cloud/DistributedQueueFactory.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.solr.client.solrj.cloud;
-
-import java.io.IOException;
-
-/** */
-public interface DistributedQueueFactory {
-  DistributedQueue makeQueue(String path) throws IOException;
-
-  void removeQueue(String path) throws IOException;
-}
diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/cloud/SolrCloudManager.java b/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/cloud/SolrCloudManager.java
index 3c5e5d87346..f169bbc3443 100644
--- a/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/cloud/SolrCloudManager.java
+++ b/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/cloud/SolrCloudManager.java
@@ -46,8 +46,6 @@ public interface SolrCloudManager extends SolrCloseable {
 
   DistribStateManager getDistribStateManager();
 
-  DistributedQueueFactory getDistributedQueueFactory();
-
   ObjectCache getObjectCache();
 
   TimeSource getTimeSource();
diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/impl/SolrClientCloudManager.java b/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/impl/SolrClientCloudManager.java
index 7a58a80bc9f..b7645a9a671 100644
--- a/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/impl/SolrClientCloudManager.java
+++ b/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/impl/SolrClientCloudManager.java
@@ -36,7 +36,6 @@ import org.apache.solr.client.solrj.SolrRequest;
 import org.apache.solr.client.solrj.SolrResponse;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.cloud.DistribStateManager;
-import org.apache.solr.client.solrj.cloud.DistributedQueueFactory;
 import org.apache.solr.client.solrj.cloud.NodeStateProvider;
 import org.apache.solr.client.solrj.cloud.SolrCloudManager;
 import org.apache.solr.common.cloud.SolrZkClient;
@@ -53,23 +52,17 @@ public class SolrClientCloudManager implements SolrCloudManager {
 
   protected final CloudLegacySolrClient solrClient;
   private final ZkDistribStateManager stateManager;
-  private final DistributedQueueFactory queueFactory;
   private final ZkStateReader zkStateReader;
   private final SolrZkClient zkClient;
   private final ObjectCache objectCache;
   private final boolean closeObjectCache;
   private volatile boolean isClosed;
 
-  public SolrClientCloudManager(
-      DistributedQueueFactory queueFactory, CloudLegacySolrClient solrClient) {
-    this(queueFactory, solrClient, null);
+  public SolrClientCloudManager(CloudLegacySolrClient solrClient) {
+    this(solrClient, null);
   }
 
-  public SolrClientCloudManager(
-      DistributedQueueFactory queueFactory,
-      CloudLegacySolrClient solrClient,
-      ObjectCache objectCache) {
-    this.queueFactory = queueFactory;
+  public SolrClientCloudManager(CloudLegacySolrClient solrClient, ObjectCache objectCache) {
     this.solrClient = solrClient;
     this.zkStateReader = ZkStateReader.from(solrClient);
     this.zkClient = zkStateReader.getZkClient();
@@ -198,9 +191,4 @@ public class SolrClientCloudManager implements SolrCloudManager {
   public SolrZkClient getZkClient() {
     return zkClient;
   }
-
-  @Override
-  public DistributedQueueFactory getDistributedQueueFactory() {
-    return queueFactory;
-  }
 }