remove dead code

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1243779 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2012-02-14 04:18:56 +00:00
parent 67b2f88a9a
commit 48c78f2542
1 changed files with 0 additions and 144 deletions

View File

@ -203,150 +203,6 @@ public class QueryComponent extends SearchComponent
}
// TODO: this could go in a different component, or in SearchHandler
// check if this is a distributed request and set info on the response builder
void checkDistributed(ResponseBuilder rb) {
SolrQueryRequest req = rb.req;
SolrParams params = req.getParams();
rb.isDistrib = params.getBool("distrib", req.getCore().getCoreDescriptor()
.getCoreContainer().isZooKeeperAware());
String shards = params.get(ShardParams.SHARDS);
// for back compat, a shards param with URLs like localhost:8983/solr will mean that this
// search is distributed.
boolean hasShardURL = shards != null && shards.indexOf('/') > 0;
rb.isDistrib = hasShardURL | rb.isDistrib;
if (rb.isDistrib) {
// since the cost of grabbing cloud state is still up in the air, we grab it only
// if we need it.
CloudState cloudState = null;
Map<String,Slice> slices = null;
CoreDescriptor coreDescriptor = req.getCore().getCoreDescriptor();
CloudDescriptor cloudDescriptor = coreDescriptor.getCloudDescriptor();
ZkController zkController = coreDescriptor.getCoreContainer().getZkController();
if (shards != null) {
List<String> lst = StrUtils.splitSmart(shards, ",", true);
rb.shards = lst.toArray(new String[lst.size()]);
rb.slices = new String[rb.shards.length];
if (zkController != null) {
// figure out which shards are slices
for (int i=0; i<rb.shards.length; i++) {
if (rb.shards[i].indexOf('/') < 0) {
// this is a logical shard
rb.slices[i] = rb.shards[i];
rb.shards[i] = null;
}
}
}
} else if (zkController != null) {
// we weren't provided with a list of slices to query, so find the list that will cover the complete index
cloudState = zkController.getCloudState();
// This can be more efficient... we only record the name, even though we have the
// shard info we need in the next step of mapping slice->shards
// Stores the comma-separated list of specified collections.
// Eg: "collection1,collection2,collection3"
String collections = params.get("collection");
if (collections != null) {
// If there were one or more collections specified in the query, split
// each parameter and store as a seperate member of a List.
List<String> collectionList = StrUtils.splitSmart(collections, ",",
true);
// First create an empty HashMap to add the slice info to.
slices = new HashMap<String,Slice>();
// In turn, retrieve the slices that cover each collection from the
// cloud state and add them to the Map 'slices'.
for (int i = 0; i < collectionList.size(); i++) {
String collection = collectionList.get(i);
ClientUtils.appendMap(collection, slices, cloudState.getSlices(collection));
}
} else {
// If no collections were specified, default to the collection for
// this core.
slices = cloudState.getSlices(cloudDescriptor.getCollectionName());
}
// Store the logical slices in the ResponseBuilder and create a new
// String array to hold the physical shards (which will be mapped
// later).
rb.slices = slices.keySet().toArray(new String[slices.size()]);
rb.shards = new String[rb.slices.length];
/***
rb.slices = new String[slices.size()];
for (int i=0; i<rb.slices.length; i++) {
rb.slices[i] = slices.get(i).getName();
}
***/
}
//
// Map slices to shards
//
if (zkController != null) {
for (int i=0; i<rb.shards.length; i++) {
if (rb.shards[i] == null) {
if (cloudState == null) {
cloudState = zkController.getCloudState();
slices = cloudState.getSlices(cloudDescriptor.getCollectionName());
}
String sliceName = rb.slices[i];
Slice slice = slices.get(sliceName);
if (slice==null) {
// Treat this the same as "all servers down" for a slice, and let things continue
// if partial results are acceptable
rb.shards[i] = "";
continue;
// throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "no such shard: " + sliceName);
}
Map<String, ZkNodeProps> sliceShards = slice.getShards();
// For now, recreate the | delimited list of equivalent servers
Set<String> liveNodes = cloudState.getLiveNodes();
StringBuilder sliceShardsStr = new StringBuilder();
boolean first = true;
for (ZkNodeProps nodeProps : sliceShards.values()) {
ZkCoreNodeProps coreNodeProps = new ZkCoreNodeProps(nodeProps);
if (!liveNodes.contains(coreNodeProps.getNodeName())
|| !coreNodeProps.getState().equals(
ZkStateReader.ACTIVE)) continue;
if (first) {
first = false;
} else {
sliceShardsStr.append('|');
}
String url = coreNodeProps.getCoreUrl();
if (url.startsWith("http://"))
url = url.substring(7);
sliceShardsStr.append(url);
}
rb.shards[i] = sliceShardsStr.toString();
}
}
}
}
String shards_rows = params.get(ShardParams.SHARDS_ROWS);
if(shards_rows != null) {
rb.shards_rows = Integer.parseInt(shards_rows);
}
String shards_start = params.get(ShardParams.SHARDS_START);
if(shards_start != null) {
rb.shards_start = Integer.parseInt(shards_start);
}
}
/**
* Actually run the query