You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by no...@apache.org on 2022/09/21 13:13:30 UTC
[solr] branch main updated: SOLR-16414: NPE on node down (#1034)
This is an automated email from the ASF dual-hosted git repository.
noble pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new 7f058eb8379 SOLR-16414: NPE on node down (#1034)
7f058eb8379 is described below
commit 7f058eb8379b1f0b51367f2fdbbe0fbee9d11cc1
Author: Noble Paul <no...@users.noreply.github.com>
AuthorDate: Wed Sep 21 23:13:24 2022 +1000
SOLR-16414: NPE on node down (#1034)
---
.../java/org/apache/solr/cloud/ZkController.java | 36 ++++++++++++++--------
1 file changed, 24 insertions(+), 12 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 267fc55cc0b..1465e1bf41c 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -2922,19 +2922,30 @@ public class ZkController implements Closeable {
} else {
try {
// Create a concurrently accessible set to avoid repeating collections
- Set<String> processedCollections = ConcurrentHashMap.newKeySet();
- cc.getCoreDescriptors().parallelStream()
+ Set<String> collectionsInThisNode = new HashSet<>();
+ for (CoreDescriptor cd : cc.getCoreDescriptors()) {
+ if (cd.getCloudDescriptor() != null
+ && cd.getCloudDescriptor().getCollectionName() != null) {
+ collectionsInThisNode.add(cd.getCloudDescriptor().getCollectionName());
+ }
+ }
+ collectionsInThisNode.parallelStream()
.forEach(
- cd -> {
- DocCollection coll = zkStateReader.getCollection(cd.getCollectionName());
- if (processedCollections.add(coll.getName()) && coll.isPerReplicaState()) {
- final List<String> replicasToDown = new ArrayList<>();
- coll.forEachReplica(
- (s, replica) -> {
- if (replica.getNodeName().equals(nodeName)) {
- replicasToDown.add(replica.getName());
- }
- });
+ c -> {
+ final List<String> replicasToDown = new ArrayList<>();
+ DocCollection coll = zkStateReader.getCollection(c);
+ if (coll == null) {
+ // may be the collection no more exists
+ return;
+ }
+ coll.forEachReplica(
+ (s, r) -> {
+ if (r.getNodeName().equals(nodeName)) {
+ replicasToDown.add(r.getName());
+ }
+ });
+
+ if (!replicasToDown.isEmpty()) {
try {
PerReplicaStatesOps.downReplicas(
replicasToDown,
@@ -2946,6 +2957,7 @@ public class ZkController implements Closeable {
}
}
});
+
// We always send a down node event to overseer to be safe, but overseer will not need to do
// anything for PRS collections
ZkNodeProps m =