mirror of https://github.com/apache/lucene.git
SOLR-13882: Collections API COLSTATUS does not check live_nodes when reporting replica's status.
This commit is contained in:
parent
e58a90f18d
commit
720fb94113
|
@ -153,6 +153,9 @@ Bug Fixes
|
|||
|
||||
* SOLR-13762: Fix BinaryField support for non-binary wt's (Thomas Woeckinger via Jason Gerlowski)
|
||||
|
||||
* SOLR-13882: Collections API COLSTATUS does not check live_nodes when reporting replica's status.
|
||||
(Erick Erickson, Andrzej Białecki)
|
||||
|
||||
Other Changes
|
||||
---------------------
|
||||
|
||||
|
|
|
@ -123,6 +123,11 @@ public class ColStatus {
|
|||
int recoveringReplicas = 0;
|
||||
int recoveryFailedReplicas = 0;
|
||||
for (Replica r : s.getReplicas()) {
|
||||
// replica may still be marked as ACTIVE even though its node is no longer live
|
||||
if (! r.isActive(clusterState.getLiveNodes())) {
|
||||
downReplicas++;
|
||||
continue;
|
||||
}
|
||||
switch (r.getState()) {
|
||||
case ACTIVE:
|
||||
activeReplicas++;
|
||||
|
|
|
@ -43,6 +43,7 @@ import org.apache.lucene.util.TestUtil;
|
|||
import org.apache.solr.client.solrj.SolrClient;
|
||||
import org.apache.solr.client.solrj.SolrRequest;
|
||||
import org.apache.solr.client.solrj.SolrServerException;
|
||||
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
||||
import org.apache.solr.client.solrj.impl.CloudSolrClient;
|
||||
import org.apache.solr.client.solrj.impl.HttpSolrClient;
|
||||
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
|
||||
|
@ -658,6 +659,19 @@ public class CollectionsAPISolrJTest extends SolrCloudTestCase {
|
|||
assertNotNull(Utils.toJSONString(rsp), segInfos.get("fieldInfoLegend"));
|
||||
assertNotNull(Utils.toJSONString(rsp), segInfos.findRecursive("segments", "_0", "fields", "id", "flags"));
|
||||
assertNotNull(Utils.toJSONString(rsp), segInfos.findRecursive("segments", "_0", "ramBytesUsed"));
|
||||
// test for replicas not active - SOLR-13882
|
||||
DocCollection coll = cluster.getSolrClient().getClusterStateProvider().getClusterState().getCollection(collectionName);
|
||||
Replica firstReplica = coll.getSlice("shard1").getReplicas().iterator().next();
|
||||
String firstNode = firstReplica.getNodeName();
|
||||
for (JettySolrRunner jetty : cluster.getJettySolrRunners()) {
|
||||
if (jetty.getNodeName().equals(firstNode)) {
|
||||
cluster.stopJettySolrRunner(jetty);
|
||||
}
|
||||
}
|
||||
rsp = req.process(cluster.getSolrClient());
|
||||
assertEquals(0, rsp.getStatus());
|
||||
Number down = (Number) rsp.getResponse().findRecursive(collectionName, "shards", "shard1", "replicas", "down");
|
||||
assertTrue("should be some down replicas, but there were none in shard1:" + rsp, down.intValue() > 0);
|
||||
}
|
||||
|
||||
private static final int NUM_DOCS = 10;
|
||||
|
|
Loading…
Reference in New Issue