mirror of https://github.com/apache/lucene.git
SOLR-5535: Set partialResults header for shards that error out if shards.tolerant is specified
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1563576 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
584fda3bdf
commit
1da7b4b4c9
|
@ -160,6 +160,8 @@ New Features
|
||||||
|
|
||||||
* SOLR-5670: allow _version_ to use DocValues. (Per Steffensen via yonik)
|
* SOLR-5670: allow _version_ to use DocValues. (Per Steffensen via yonik)
|
||||||
|
|
||||||
|
* SOLR-5535: Set "partialResults" header for shards that error out if
|
||||||
|
shards.tolerant is specified. (Steve Davids via shalin)
|
||||||
|
|
||||||
Bug Fixes
|
Bug Fixes
|
||||||
----------------------
|
----------------------
|
||||||
|
|
|
@ -848,6 +848,7 @@ public class QueryComponent extends SearchComponent
|
||||||
}
|
}
|
||||||
// now that we've added the shard info, let's only proceed if we have no error.
|
// now that we've added the shard info, let's only proceed if we have no error.
|
||||||
if (srsp.getException() != null) {
|
if (srsp.getException() != null) {
|
||||||
|
partialResults = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -308,6 +308,10 @@ public class SearchHandler extends RequestHandlerBase implements SolrCoreAware ,
|
||||||
} else {
|
} else {
|
||||||
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, srsp.getException());
|
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, srsp.getException());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if(rsp.getResponseHeader().get("partialResults") == null) {
|
||||||
|
rsp.getResponseHeader().add("partialResults", Boolean.TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,9 @@ public class SearchGroupShardResponseProcessor implements ShardResponseProcessor
|
||||||
shardInfo.add(srsp.getShard(), nl);
|
shardInfo.add(srsp.getShard(), nl);
|
||||||
}
|
}
|
||||||
if (rb.req.getParams().getBool(ShardParams.SHARDS_TOLERANT, false) && srsp.getException() != null) {
|
if (rb.req.getParams().getBool(ShardParams.SHARDS_TOLERANT, false) && srsp.getException() != null) {
|
||||||
|
if(rb.rsp.getResponseHeader().get("partialResults") == null) {
|
||||||
|
rb.rsp.getResponseHeader().add("partialResults", Boolean.TRUE);
|
||||||
|
}
|
||||||
continue; // continue if there was an error and we're tolerant.
|
continue; // continue if there was an error and we're tolerant.
|
||||||
}
|
}
|
||||||
maxElapsedTime = (int) Math.max(maxElapsedTime, srsp.getSolrResponse().getElapsedTime());
|
maxElapsedTime = (int) Math.max(maxElapsedTime, srsp.getSolrResponse().getElapsedTime());
|
||||||
|
|
|
@ -114,6 +114,9 @@ public class TopGroupsShardResponseProcessor implements ShardResponseProcessor {
|
||||||
shardInfo.add(srsp.getShard(), individualShardInfo);
|
shardInfo.add(srsp.getShard(), individualShardInfo);
|
||||||
}
|
}
|
||||||
if (rb.req.getParams().getBool(ShardParams.SHARDS_TOLERANT, false) && srsp.getException() != null) {
|
if (rb.req.getParams().getBool(ShardParams.SHARDS_TOLERANT, false) && srsp.getException() != null) {
|
||||||
|
if(rb.rsp.getResponseHeader().get("partialResults") == null) {
|
||||||
|
rb.rsp.getResponseHeader().add("partialResults", Boolean.TRUE);
|
||||||
|
}
|
||||||
continue; // continue if there was an error and we're tolerant.
|
continue; // continue if there was an error and we're tolerant.
|
||||||
}
|
}
|
||||||
NamedList<NamedList> secondPhaseResult = (NamedList<NamedList>) srsp.getSolrResponse().getResponse().get("secondPhase");
|
NamedList<NamedList> secondPhaseResult = (NamedList<NamedList>) srsp.getSolrResponse().getResponse().get("secondPhase");
|
||||||
|
|
|
@ -510,6 +510,7 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {
|
||||||
assertTrue("Expected to find shardAddress in the up shard info",info.get("shardAddress") != null);
|
assertTrue("Expected to find shardAddress in the up shard info",info.get("shardAddress") != null);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
assertEquals("Expected to find the partialResults header set if a shard is down", Boolean.TRUE, rsp.getHeader().get("partialResults"));
|
||||||
assertTrue("Expected to find error in the down shard info",info.get("error") != null);
|
assertTrue("Expected to find error in the down shard info",info.get("error") != null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -518,4 +519,9 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void validateControlData(QueryResponse control) throws Exception {
|
||||||
|
super.validateControlData(control);
|
||||||
|
assertNull("Expected the partialResults header to be null", control.getHeader().get("partialResults"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue