From 003117a0759093dbe24a2925bdbe035eba1851d4 Mon Sep 17 00:00:00 2001 From: patsonluk Date: Fri, 11 Oct 2024 12:07:21 -0700 Subject: [PATCH] ./gradlew tidy --- .../org/apache/solr/cloud/ZkController.java | 42 ++++++++++--------- .../solr/common/cloud/ClusterState.java | 1 - 2 files changed, 23 insertions(+), 20 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 5f33d01a370..32eaa418984 100644 --- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java +++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java @@ -2903,7 +2903,8 @@ public boolean checkIfCoreNodeNameAlreadyExists(CoreDescriptor dcore) { */ public Collection publishNodeAsDown(String nodeName) { log.info("Publish node={} as DOWN", nodeName); - Map> replicasPerCollectionOnNode = getReplicasPerCollectionOnThisNode(); + Map> replicasPerCollectionOnNode = + getReplicasPerCollectionOnThisNode(); if (distributedClusterStateUpdater.isDistributedStateUpdate()) { // Note that with the current implementation, when distributed cluster state updates are @@ -2926,7 +2927,8 @@ public Collection 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; } @@ -2955,7 +2957,9 @@ public Collection 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> getReplicasPerCollectionOnThisNode() { @@ -2966,29 +2970,29 @@ private Map> 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 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 replicas = col.getReplicas(nodeName); - if (replicas != null && !replicas.isEmpty()) { - result.put(col, replicas); - } - }); + .map(ClusterState.CollectionRef::get) + .filter(Objects::nonNull) + .forEach( + col -> { + List replicas = col.getReplicas(nodeName); + if (replicas != null && !replicas.isEmpty()) { + result.put(col, replicas); + } + }); } return result; } diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java index b3e18dea862..5ee8faf9aca 100644 --- a/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java +++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java @@ -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;