SOLR-6941: DistributedQueue#containsTaskWithRequestId can fail with NPE.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1651380 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2015-01-13 15:25:56 +00:00
parent 1696206de6
commit 423e469e5f
2 changed files with 9 additions and 4 deletions

View File

@ -435,6 +435,8 @@ Bug Fixes
* SOLR-6923: AutoAddReplicas also consults live_nodes to see if a state change has happened.
(Varun Thacker via Anshum Gupta)
* SOLR-6941: DistributedQueue#containsTaskWithRequestId can fail with NPE. (Mark Miller)
Optimizations
----------------------

View File

@ -122,10 +122,13 @@ public class DistributedQueue {
for (String childName : childNames) {
if (childName != null) {
try {
ZkNodeProps message = ZkNodeProps.load(zookeeper.getData(dir + "/" + childName, null, null, true));
if (message.containsKey(OverseerCollectionProcessor.ASYNC)) {
LOG.info(">>>> {}", message.get(OverseerCollectionProcessor.ASYNC));
if(message.get(OverseerCollectionProcessor.ASYNC).equals(requestId)) return true;
byte[] data = zookeeper.getData(dir + "/" + childName, null, null, true);
if (data != null) {
ZkNodeProps message = ZkNodeProps.load(data);
if (message.containsKey(OverseerCollectionProcessor.ASYNC)) {
LOG.debug(">>>> {}", message.get(OverseerCollectionProcessor.ASYNC));
if(message.get(OverseerCollectionProcessor.ASYNC).equals(requestId)) return true;
}
}
} catch (KeeperException.NoNodeException e) {
// Another client removed the node first, try next