You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2017/11/10 09:24:59 UTC

lucene-solr:jira/solr-11285-sim: SOLR-11285: Add convenience methods for simulated cluster setup.

Repository: lucene-solr
Updated Branches:
  refs/heads/jira/solr-11285-sim 73b1a95b7 -> 41a28dc64


SOLR-11285: Add convenience methods for simulated cluster setup.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/41a28dc6
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/41a28dc6
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/41a28dc6

Branch: refs/heads/jira/solr-11285-sim
Commit: 41a28dc649932f29dd907ffbfa5aa1976e8d9a88
Parents: 73b1a95
Author: Andrzej Bialecki <ab...@apache.org>
Authored: Thu Nov 9 23:43:34 2017 +0100
Committer: Andrzej Bialecki <ab...@apache.org>
Committed: Thu Nov 9 23:43:34 2017 +0100

----------------------------------------------------------------------
 .../cloud/autoscaling/sim/RandomThrottle.java   |   9 ++
 .../cloud/autoscaling/sim/SimCloudManager.java  | 162 ++++++++++++++++++-
 .../sim/SimClusterStateProvider.java            | 123 +-------------
 .../autoscaling/sim/SimNodeStateProvider.java   |  16 +-
 .../sim/TestSimClusterStateProvider.java        |   7 +-
 5 files changed, 191 insertions(+), 126 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/41a28dc6/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/RandomThrottle.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/RandomThrottle.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/RandomThrottle.java
index 1b8981a..86c3065 100644
--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/RandomThrottle.java
+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/RandomThrottle.java
@@ -16,6 +16,8 @@
  */
 package org.apache.solr.cloud.autoscaling.sim;
 
+import java.util.concurrent.ExecutorService;
+
 import org.apache.commons.math3.distribution.RealDistribution;
 import org.apache.commons.math3.distribution.UniformRealDistribution;
 
@@ -48,4 +50,11 @@ public class RandomThrottle {
       // do nothing
     }
   }
+
+  public void throttle(ExecutorService executor, Runnable runnable) {
+    executor.submit(() -> {
+      throttle();
+      runnable.run();
+    });
+  }
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/41a28dc6/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimCloudManager.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimCloudManager.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimCloudManager.java
index c31819a..547fb37 100644
--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimCloudManager.java
+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimCloudManager.java
@@ -18,7 +18,14 @@
 package org.apache.solr.cloud.autoscaling.sim;
 
 import java.io.IOException;
+import java.lang.invoke.MethodHandles;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.SolrRequest;
@@ -29,30 +36,50 @@ import org.apache.solr.client.solrj.cloud.autoscaling.DistribStateManager;
 import org.apache.solr.client.solrj.cloud.autoscaling.NodeStateProvider;
 import org.apache.solr.client.solrj.cloud.autoscaling.SolrCloudManager;
 import org.apache.solr.client.solrj.impl.ClusterStateProvider;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.request.UpdateRequest;
+import org.apache.solr.client.solrj.response.SolrResponseBase;
+import org.apache.solr.client.solrj.response.UpdateResponse;
 import org.apache.solr.cloud.Overseer;
 import org.apache.solr.cloud.autoscaling.OverseerTriggerThread;
+import org.apache.solr.common.SolrException;
+import org.apache.solr.common.SolrInputDocument;
+import org.apache.solr.common.cloud.rule.ImplicitSnitch;
+import org.apache.solr.common.params.CollectionAdminParams;
+import org.apache.solr.common.params.CollectionParams;
+import org.apache.solr.common.params.CoreAdminParams;
+import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.IOUtils;
+import org.apache.solr.common.util.NamedList;
 import org.apache.solr.core.CloudConfig;
 import org.apache.solr.core.SolrResourceLoader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Simulated {@link SolrCloudManager}.
  */
 public class SimCloudManager implements SolrCloudManager {
+  private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
   private final SimDistribStateManager stateManager;
   private final SimClusterStateProvider clusterStateProvider;
   private final SimNodeStateProvider nodeStateProvider;
+  private final Set<String> liveNodes = ConcurrentHashMap.newKeySet();
   private final SimDistributedQueueFactory queueFactory;
   private SolrClient solrClient;
   private final SimHttpServer httpServer;
 
+  private final List<SolrInputDocument> systemColl = Collections.synchronizedList(new ArrayList<>());
+
   private Overseer.OverseerThread triggerThread;
 
+  private static int nodeIdPort = 10000;
+
   public SimCloudManager() {
     this.stateManager = new SimDistribStateManager();
-    this.clusterStateProvider = new SimClusterStateProvider();
-    this.nodeStateProvider = new SimNodeStateProvider(this.clusterStateProvider, null);
+    this.clusterStateProvider = new SimClusterStateProvider(liveNodes);
+    this.nodeStateProvider = new SimNodeStateProvider(liveNodes, this.clusterStateProvider, null);
     this.queueFactory = new SimDistributedQueueFactory();
     this.httpServer = new SimHttpServer();
     ThreadGroup triggerThreadGroup = new ThreadGroup("Simulated Overseer autoscaling triggers");
@@ -68,6 +95,56 @@ public class SimCloudManager implements SolrCloudManager {
 
   // ---------- simulator setup methods -----------
 
+  public static SimCloudManager createCluster(int numNodes) throws Exception {
+    SimCloudManager cloudManager = new SimCloudManager();
+    for (int i = 1; i <= numNodes; i++) {
+      Map<String, Object> values = createNodeValues();
+      String nodeId = (String)values.get(ImplicitSnitch.NODE);
+      cloudManager.getSimClusterStateProvider().simAddNode(nodeId);
+      cloudManager.getSimNodeStateProvider().simSetNodeValues(nodeId, values);
+    }
+    return cloudManager;
+  }
+
+  public static Map<String, Object> createNodeValues() {
+    String host = "127.0.0.1";
+    String port = "" + nodeIdPort++;
+    String nodeId = host + ":" + port + "_solr";
+    Map<String, Object> values = new HashMap<>();
+    values.put("ip_1", "127");
+    values.put("ip_2", "0");
+    values.put("ip_3", "0");
+    values.put("ip_4", "1");
+    values.put(ImplicitSnitch.HOST, host);
+    values.put(ImplicitSnitch.PORT, port);
+    values.put(ImplicitSnitch.NODE, nodeId);
+    values.put(ImplicitSnitch.CORES, 4);
+    values.put(ImplicitSnitch.DISK, 123450000);
+    values.put(ImplicitSnitch.SYSLOADAVG, 1.0);
+    values.put(ImplicitSnitch.HEAPUSAGE, 123450000);
+    return values;
+  }
+
+  public void simAddNode() throws Exception {
+    Map<String, Object> values = createNodeValues();
+    String nodeId = (String)values.get(ImplicitSnitch.NODE);
+    clusterStateProvider.simAddNode(nodeId);
+    nodeStateProvider.simSetNodeValues(nodeId, values);
+  }
+
+  public void simRemoveNode(String nodeId) throws Exception {
+    clusterStateProvider.simRemoveNode(nodeId);
+    nodeStateProvider.simRemoveNodeValues(nodeId);
+  }
+
+  public void simClearSystemCollection() {
+    systemColl.clear();
+  }
+
+  public List<SolrInputDocument> simGetSystemCollection() {
+    return systemColl;
+  }
+
 
   // ---------- type-safe methods to obtain simulator components ----------
   public SimClusterStateProvider getSimClusterStateProvider() {
@@ -117,10 +194,89 @@ public class SimCloudManager implements SolrCloudManager {
         throw new IOException(e);
       }
     } else {
-      return clusterStateProvider.simHandleSolrRequest(req);
+      return simHandleSolrRequest(req);
+    }
+  }
+
+  public SolrResponse simHandleSolrRequest(SolrRequest req) throws IOException {
+    LOG.info("--- got SolrRequest: " + req);
+    if (req instanceof UpdateRequest) {
+      // support only updates to the system collection
+      UpdateRequest ureq = (UpdateRequest)req;
+      if (ureq.getCollection() == null || !ureq.getCollection().equals(CollectionAdminParams.SYSTEM_COLL)) {
+        throw new UnsupportedOperationException("Only .system updates are supported but got: " + req);
+      }
+      List<SolrInputDocument> docs = ureq.getDocuments();
+      if (docs != null) {
+        systemColl.addAll(docs);
+      }
+      return new UpdateResponse();
+    }
+    // support only a specific subset of collection admin ops
+    if (!(req instanceof CollectionAdminRequest)) {
+      throw new UnsupportedOperationException("Only CollectionAdminRequest-s are supported: " + req.getClass().getName());
+    }
+    SolrParams params = req.getParams();
+    String a = params.get(CoreAdminParams.ACTION);
+    SolrResponse rsp = new SolrResponseBase();
+    if (a != null) {
+      CollectionParams.CollectionAction action = CollectionParams.CollectionAction.get(a);
+      if (action == null) {
+        throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unknown action: " + a);
+      }
+      LOG.info("Invoking Collection Action :{} with params {}", action.toLower(), req.getParams().toQueryString());
+      switch (action) {
+        case ADDREPLICA:
+          break;
+        case ADDREPLICAPROP:
+          break;
+        case CREATE:
+          break;
+        case CLUSTERPROP:
+          break;
+        case CREATESHARD:
+          break;
+        case DELETE:
+          break;
+        case DELETENODE:
+          break;
+        case DELETEREPLICA:
+          break;
+        case DELETEREPLICAPROP:
+          break;
+        case DELETESHARD:
+          break;
+        case FORCELEADER:
+          break;
+        case LIST:
+          NamedList results = new NamedList();
+          results.add("collections", clusterStateProvider.simListCollections());
+          rsp.setResponse(results);
+          break;
+        case MODIFYCOLLECTION:
+          break;
+        case MOVEREPLICA:
+          break;
+        case REBALANCELEADERS:
+          break;
+        case RELOAD:
+          break;
+        case REPLACENODE:
+          break;
+        case SPLITSHARD:
+          break;
+        default:
+          throw new UnsupportedOperationException("Unsupported collection admin action=" + action);
+      }
+    } else {
+      throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "action is a required param");
     }
+    return rsp;
+
   }
 
+
+
   @Override
   public byte[] httpRequest(String url, SolrRequest.METHOD method, Map<String, String> headers, String payload, int timeout, boolean followRedirects) throws IOException {
     return httpServer.httpRequest(url, method, headers, payload, timeout, followRedirects);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/41a28dc6/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimClusterStateProvider.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimClusterStateProvider.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimClusterStateProvider.java
index 37888f3..18ecea1 100644
--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimClusterStateProvider.java
+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimClusterStateProvider.java
@@ -33,15 +33,8 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.concurrent.locks.ReentrantLock;
 
-import org.apache.solr.client.solrj.SolrRequest;
-import org.apache.solr.client.solrj.SolrResponse;
 import org.apache.solr.client.solrj.cloud.autoscaling.ReplicaInfo;
 import org.apache.solr.client.solrj.impl.ClusterStateProvider;
-import org.apache.solr.client.solrj.request.CollectionAdminRequest;
-import org.apache.solr.client.solrj.request.UpdateRequest;
-import org.apache.solr.client.solrj.response.SolrResponseBase;
-import org.apache.solr.client.solrj.response.UpdateResponse;
-import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.cloud.ClusterState;
 import org.apache.solr.common.cloud.DocCollection;
@@ -49,12 +42,7 @@ import org.apache.solr.common.cloud.DocRouter;
 import org.apache.solr.common.cloud.Replica;
 import org.apache.solr.common.cloud.Slice;
 import org.apache.solr.common.cloud.ZkStateReader;
-import org.apache.solr.common.params.CollectionAdminParams;
-import org.apache.solr.common.params.CollectionParams;
-import org.apache.solr.common.params.CoreAdminParams;
-import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.ExecutorUtil;
-import org.apache.solr.common.util.NamedList;
 import org.apache.solr.util.DefaultSolrThreadFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -65,17 +53,13 @@ import org.slf4j.LoggerFactory;
 public class SimClusterStateProvider implements ClusterStateProvider {
   private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
-  private static final String REPLICA_INFO_PROP = "__ri__";
-
   private final Map<String, List<ReplicaInfo>> nodeReplicaMap = new ConcurrentHashMap<>();
-  private final Set<String> liveNodes = ConcurrentHashMap.newKeySet();
+  private final Set<String> liveNodes;
 
   private final Map<String, Object> clusterProperties = new ConcurrentHashMap<>();
   private final Map<String, Map<String, Object>> collProperties = new ConcurrentHashMap<>();
   private final Map<String, Map<String, Map<String, Object>>> sliceProperties = new ConcurrentHashMap<>();
 
-  private final List<SolrInputDocument> systemColl = Collections.synchronizedList(new ArrayList<>());
-
   private final ExecutorService simStateProviderPool;
 
   private final ReentrantLock lock = new ReentrantLock();
@@ -84,8 +68,9 @@ public class SimClusterStateProvider implements ClusterStateProvider {
    * Zero-arg constructor. The instance needs to be initialized using the <code>sim*</code> methods in order
    * to ensure proper behavior, otherwise it will behave as a cluster with zero live nodes and zero replicas.
    */
-  public SimClusterStateProvider() {
-    simStateProviderPool = ExecutorUtil.newMDCAwareCachedThreadPool(new DefaultSolrThreadFactory("simStateProviderPool"));
+  public SimClusterStateProvider(Set<String> liveNodes) {
+    this.liveNodes = liveNodes;
+    simStateProviderPool = ExecutorUtil.newMDCAwareCachedThreadPool(new DefaultSolrThreadFactory("simClusterStateProviderPool"));
   }
 
   // ============== SIMULATOR SETUP METHODS ====================
@@ -115,17 +100,6 @@ public class SimClusterStateProvider implements ClusterStateProvider {
     }
   }
 
-  public void simAddNodes(Collection<String> nodeIds) throws Exception {
-    for (String node : nodeIds) {
-      if (liveNodes.contains(node)) {
-        throw new Exception("Node " + node + " already exists");
-      }
-    }
-    for (String node : nodeIds) {
-      simAddNode(node);
-    }
-  }
-
   // todo: maybe hook up DistribStateManager /live_nodes ?
   // todo: maybe hook up DistribStateManager /clusterstate.json watchers?
   public boolean simAddNode(String nodeId) throws Exception {
@@ -232,6 +206,7 @@ public class SimClusterStateProvider implements ClusterStateProvider {
               LOG.warn("-- can't find any active replicas for " + dc.getName() + " / " + s.getName());
               return;
             }
+            // pick random one
             Collections.shuffle(active);
             ReplicaInfo ri = active.get(0);
             ri.getVariables().put(ZkStateReader.LEADER_PROP, "true");
@@ -273,14 +248,6 @@ public class SimClusterStateProvider implements ClusterStateProvider {
     }
   }
 
-  public void simClearSystemCollection() {
-    systemColl.clear();
-  }
-
-  public List<SolrInputDocument> simGetSystemCollection() {
-    return systemColl;
-  }
-
   // todo: maybe hook up DistribStateManager /clusterstate.json watchers?
   public void simSetClusterProperties(Map<String, Object> properties) {
     clusterProperties.clear();
@@ -335,89 +302,11 @@ public class SimClusterStateProvider implements ClusterStateProvider {
     }
   }
 
-  public SolrResponse simHandleSolrRequest(SolrRequest req) throws IOException {
-    LOG.info("--- got SolrRequest: " + req);
-    if (req instanceof UpdateRequest) {
-      // support only updates to the system collection
-      UpdateRequest ureq = (UpdateRequest)req;
-      if (ureq.getCollection() == null || !ureq.getCollection().equals(CollectionAdminParams.SYSTEM_COLL)) {
-        throw new UnsupportedOperationException("Only .system updates are supported but got: " + req);
-      }
-      List<SolrInputDocument> docs = ureq.getDocuments();
-      if (docs != null) {
-        systemColl.addAll(docs);
-      }
-      return new UpdateResponse();
-    }
-    // support only a specific subset of collection admin ops
-    if (!(req instanceof CollectionAdminRequest)) {
-      throw new UnsupportedOperationException("Only CollectionAdminRequest-s are supported: " + req.getClass().getName());
-    }
-    SolrParams params = req.getParams();
-    String a = params.get(CoreAdminParams.ACTION);
-    SolrResponse rsp = new SolrResponseBase();
-    if (a != null) {
-      CollectionParams.CollectionAction action = CollectionParams.CollectionAction.get(a);
-      if (action == null) {
-        throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unknown action: " + a);
-      }
-      switch (action) {
-        case ADDREPLICA:
-          break;
-        case ADDREPLICAPROP:
-          break;
-        case CREATE:
-          break;
-        case CLUSTERPROP:
-          break;
-        case CREATESHARD:
-          break;
-        case DELETE:
-          break;
-        case DELETENODE:
-          break;
-        case DELETEREPLICA:
-          break;
-        case DELETEREPLICAPROP:
-          break;
-        case DELETESHARD:
-          break;
-        case FORCELEADER:
-          break;
-        case LIST:
-          NamedList results = new NamedList();
-          results.add("collections", listCollections());
-          rsp.setResponse(results);
-          break;
-        case MODIFYCOLLECTION:
-          break;
-        case MOVEREPLICA:
-          break;
-        case REBALANCELEADERS:
-          break;
-        case RELOAD:
-          break;
-        case REPLACENODE:
-          break;
-        case SPLITSHARD:
-          break;
-        default:
-          throw new UnsupportedOperationException("Unsupported collection admin action=" + action);
-      }
-      LOG.info("Invoked Collection Action :{} with params {}", action.toLower(), req.getParams().toQueryString());
-    } else {
-      throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "action is a required param");
-    }
-
-    return rsp;
-
-  }
-
   public List<ReplicaInfo> simGetReplicaInfos(String node) {
     return nodeReplicaMap.get(node);
   }
 
-  private List<String> listCollections() {
+  public List<String> simListCollections() {
     final Set<String> collections = new HashSet<>();
     lock.lock();
     try {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/41a28dc6/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimNodeStateProvider.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimNodeStateProvider.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimNodeStateProvider.java
index cbac7cb..432dea7 100644
--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimNodeStateProvider.java
+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimNodeStateProvider.java
@@ -8,6 +8,7 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Collectors;
 
@@ -24,8 +25,10 @@ public class SimNodeStateProvider implements NodeStateProvider {
 
   private final Map<String, Map<String, Object>> nodeValues = new ConcurrentHashMap<>();
   private final SimClusterStateProvider stateProvider;
+  private final Set<String> liveNodes;
 
-  public SimNodeStateProvider(SimClusterStateProvider stateProvider, Map<String, Map<String, Object>> nodeValues) {
+  public SimNodeStateProvider(Set<String> liveNodes, SimClusterStateProvider stateProvider, Map<String, Map<String, Object>> nodeValues) {
+    this.liveNodes = liveNodes;
     this.stateProvider = stateProvider;
     if (nodeValues != null) {
       this.nodeValues.putAll(nodeValues);
@@ -41,10 +44,18 @@ public class SimNodeStateProvider implements NodeStateProvider {
     nodeValues.computeIfAbsent(node, n -> new ConcurrentHashMap<>()).put(key, value);
   }
 
+  public void simRemoveNodeValues(String node) {
+    nodeValues.remove(node);
+  }
+
   // ---------- interface methods -------------
 
   @Override
   public Map<String, Object> getNodeValues(String node, Collection<String> tags) {
+    if (!liveNodes.contains(node)) {
+      nodeValues.remove(node);
+      return Collections.emptyMap();
+    }
     Map<String, Object> values = nodeValues.get(node);
     if (values == null) {
       return Collections.emptyMap();
@@ -60,6 +71,9 @@ public class SimNodeStateProvider implements NodeStateProvider {
     }
     Map<String, Map<String, List<ReplicaInfo>>> res = new HashMap<>();
     for (ReplicaInfo r : replicas) {
+      if (!liveNodes.contains(r.getNode())) {
+        continue;
+      }
       Map<String, List<ReplicaInfo>> perCollection = res.computeIfAbsent(r.getCollection(), s -> new HashMap<>());
       List<ReplicaInfo> perShard = perCollection.computeIfAbsent(r.getShard(), s -> new ArrayList<>());
       perShard.add(r);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/41a28dc6/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimClusterStateProvider.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimClusterStateProvider.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimClusterStateProvider.java
index decb1b3..679c90e 100644
--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimClusterStateProvider.java
+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimClusterStateProvider.java
@@ -1,12 +1,11 @@
 package org.apache.solr.cloud.autoscaling.sim;
 
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 
 import com.google.common.collect.ImmutableSet;
 import org.apache.solr.SolrTestCaseJ4;
-import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.common.cloud.ClusterState;
-import org.apache.solr.common.cloud.Replica;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -64,15 +63,13 @@ public class TestSimClusterStateProvider extends SolrTestCaseJ4 {
   public void setup() throws Exception {
     ClusterState cs = ClusterState.load(1, coll1State.getBytes(UTF_8),
         initialLiveNodes, "/collections/gettingstarted/state.json");
-    dataProvider = new SimClusterStateProvider();
+    dataProvider = new SimClusterStateProvider(ConcurrentHashMap.newKeySet());
     dataProvider.simSetClusterState(cs);
   }
 
   @Test
   public void testAddReplica() throws Exception {
 
-    CollectionAdminRequest req = CollectionAdminRequest.addReplicaToShard(COLL, "shard1", Replica.Type.PULL);
-    dataProvider.simHandleSolrRequest(req);
   }
 
 }