Skip to content

Commit

Permalink
./gradlew tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
patsonluk committed Oct 11, 2024
1 parent bec693f commit 003117a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
42 changes: 23 additions & 19 deletions solr/core/src/java/org/apache/solr/cloud/ZkController.java
Original file line number Diff line number Diff line change
Expand Up @@ -2903,7 +2903,8 @@ public boolean checkIfCoreNodeNameAlreadyExists(CoreDescriptor dcore) {
*/
public Collection<String> publishNodeAsDown(String nodeName) {
log.info("Publish node={} as DOWN", nodeName);
Map<DocCollection, List<Replica>> replicasPerCollectionOnNode = getReplicasPerCollectionOnThisNode();
Map<DocCollection, List<Replica>> replicasPerCollectionOnNode =
getReplicasPerCollectionOnThisNode();

if (distributedClusterStateUpdater.isDistributedStateUpdate()) {
// Note that with the current implementation, when distributed cluster state updates are
Expand All @@ -2926,7 +2927,8 @@ public Collection<String> publishNodeAsDown(String nodeName) {
coll.getZNode(), zkClient, coll.getPerReplicaStates()))
.persist(coll.getZNode(), zkClient);
} else {
// if this node contains any non PRS collection, then we need to notify the overseer as overseer
// if this node contains any non PRS collection, then we need to notify the overseer as
// overseer
// manages the replica state for non PRS collections
sendToOverseer = true;
}
Expand Down Expand Up @@ -2955,7 +2957,9 @@ public Collection<String> publishNodeAsDown(String nodeName) {
log.warn("Could not publish node as down: ", e);
}
}
return replicasPerCollectionOnNode.keySet().stream().map(DocCollection::getName).collect(Collectors.toSet());
return replicasPerCollectionOnNode.keySet().stream()
.map(DocCollection::getName)
.collect(Collectors.toSet());
}

private Map<DocCollection, List<Replica>> getReplicasPerCollectionOnThisNode() {
Expand All @@ -2966,29 +2970,29 @@ private Map<DocCollection, List<Replica>> getReplicasPerCollectionOnThisNode() {
String collName = cd.getCollectionName();
DocCollection coll;
if (collName != null
&& processedCollections.add(collName)
&& (coll = zkStateReader.getCollection(collName)) != null) {
&& processedCollections.add(collName)
&& (coll = zkStateReader.getCollection(collName)) != null) {
final List<Replica> replicasOnThisNode = new ArrayList<>();
coll.forEachReplica(
(s, replica) -> {
if (replica.getNodeName().equals(nodeName)) {
replicasOnThisNode.add(replica);
}
});
(s, replica) -> {
if (replica.getNodeName().equals(nodeName)) {
replicasOnThisNode.add(replica);
}
});
result.put(coll, replicasOnThisNode);
}
}
} else {
getClusterState().getCollectionStates().values().stream()
.map(ClusterState.CollectionRef::get)
.filter(Objects::nonNull)
.forEach(
col -> {
List<Replica> replicas = col.getReplicas(nodeName);
if (replicas != null && !replicas.isEmpty()) {
result.put(col, replicas);
}
});
.map(ClusterState.CollectionRef::get)
.filter(Objects::nonNull)
.forEach(
col -> {
List<Replica> replicas = col.getReplicas(nodeName);
if (replicas != null && !replicas.isEmpty()) {
result.put(col, replicas);
}
});
}
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
Expand Down

0 comments on commit 003117a

Please sign in to comment.