mirror of https://github.com/apache/lucene.git
SOLR-13016: test errors fixed
This commit is contained in:
parent
7112d6f061
commit
3ffc9099bf
|
@ -47,8 +47,8 @@ import org.apache.solr.client.solrj.SolrClient;
|
|||
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.DistributedQueueFactory;
|
||||
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.client.solrj.cloud.autoscaling.ReplicaInfo;
|
||||
|
@ -426,7 +426,7 @@ public class SimCloudManager implements SolrCloudManager {
|
|||
// initialize history handler if this is the first node
|
||||
if (metricsHistoryHandler == null && liveNodesSet.size() == 1) {
|
||||
metricsHandler = new MetricsHandler(metricManager);
|
||||
metricsHistoryHandler = new MetricsHistoryHandler(nodeId, metricsHandler, solrClient, this, Collections.emptyMap());
|
||||
metricsHistoryHandler = new MetricsHistoryHandler(nodeId, metricsHandler, solrClient, this, new HashMap<>());
|
||||
metricsHistoryHandler.initializeMetrics(metricManager, SolrMetricManager.getRegistryName(SolrInfoBean.Group.node), metricTag, CommonParams.METRICS_HISTORY_PATH);
|
||||
}
|
||||
return nodeId;
|
||||
|
|
|
@ -210,14 +210,14 @@ public class SimClusterStateProvider implements ClusterStateProvider {
|
|||
}
|
||||
initialState.forEachCollection(dc -> {
|
||||
collProperties.computeIfAbsent(dc.getName(), name -> new ConcurrentHashMap<>()).putAll(dc.getProperties());
|
||||
opDelays.computeIfAbsent(dc.getName(), c -> new HashMap<>()).putAll(defaultOpDelays);
|
||||
opDelays.computeIfAbsent(dc.getName(), Utils.NEW_HASHMAP_FUN).putAll(defaultOpDelays);
|
||||
dc.getSlices().forEach(s -> {
|
||||
sliceProperties.computeIfAbsent(dc.getName(), name -> new ConcurrentHashMap<>())
|
||||
.computeIfAbsent(s.getName(), name -> new HashMap<>()).putAll(s.getProperties());
|
||||
.computeIfAbsent(s.getName(), Utils.NEW_HASHMAP_FUN).putAll(s.getProperties());
|
||||
s.getReplicas().forEach(r -> {
|
||||
ReplicaInfo ri = new ReplicaInfo(r.getName(), r.getCoreName(), dc.getName(), s.getName(), r.getType(), r.getNodeName(), r.getProperties());
|
||||
if (liveNodes.get().contains(r.getNodeName())) {
|
||||
nodeReplicaMap.computeIfAbsent(r.getNodeName(), rn -> new ArrayList<>()).add(ri);
|
||||
nodeReplicaMap.computeIfAbsent(r.getNodeName(), Utils.NEW_ARRAYLIST_FUN).add(ri);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -18,9 +18,7 @@ package org.apache.solr.cloud.autoscaling.sim;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
@ -295,7 +293,7 @@ public class SimNodeStateProvider implements NodeStateProvider {
|
|||
throw new RuntimeException("non-live node " + node);
|
||||
}
|
||||
if (tags.isEmpty()) {
|
||||
return Collections.emptyMap();
|
||||
return new HashMap<>();
|
||||
}
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
Map<String, Object> metrics = getReplicaMetricsValues(node, tags.stream().filter(s -> s.startsWith("metrics:solr.core.")).collect(Collectors.toList()));
|
||||
|
@ -312,13 +310,13 @@ public class SimNodeStateProvider implements NodeStateProvider {
|
|||
public Map<String, Map<String, List<ReplicaInfo>>> getReplicaInfo(String node, Collection<String> keys) {
|
||||
List<ReplicaInfo> replicas = clusterStateProvider.simGetReplicaInfos(node);
|
||||
if (replicas == null || replicas.isEmpty()) {
|
||||
return Collections.emptyMap();
|
||||
return new HashMap<>();
|
||||
}
|
||||
Map<String, Map<String, List<ReplicaInfo>>> res = new HashMap<>();
|
||||
// TODO: probably needs special treatment for "metrics:solr.core..." tags
|
||||
for (ReplicaInfo r : replicas) {
|
||||
Map<String, List<ReplicaInfo>> perCollection = res.computeIfAbsent(r.getCollection(), s -> new HashMap<>());
|
||||
List<ReplicaInfo> perShard = perCollection.computeIfAbsent(r.getShard(), s -> new ArrayList<>());
|
||||
Map<String, List<ReplicaInfo>> perCollection = res.computeIfAbsent(r.getCollection(), Utils.NEW_HASHMAP_FUN);
|
||||
List<ReplicaInfo> perShard = perCollection.computeIfAbsent(r.getShard(), Utils.NEW_ARRAYLIST_FUN);
|
||||
perShard.add(r);
|
||||
}
|
||||
return res;
|
||||
|
|
Loading…
Reference in New Issue