SOLR-10741: Factor out createSliceShardsStr method from HttpShardHandler.prepDistributed.

(Domenico Fabio Marino via Christine Poerschke)
This commit is contained in:
Christine Poerschke 2017-05-26 10:51:41 +01:00
parent 4106e1b51a
commit e7099e4bf5
2 changed files with 18 additions and 11 deletions

View File

@ -263,6 +263,9 @@ Other Changes
* SOLR-10659: Remove ResponseBuilder.getSortSpec use in SearchGroupShardResponseProcessor. * SOLR-10659: Remove ResponseBuilder.getSortSpec use in SearchGroupShardResponseProcessor.
(Judith Silverman via Christine Poerschke) (Judith Silverman via Christine Poerschke)
* SOLR-10741: Factor out createSliceShardsStr method from HttpShardHandler.prepDistributed.
(Domenico Fabio Marino via Christine Poerschke)
================== 6.6.0 ================== ================== 6.6.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release. Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

View File

@ -449,17 +449,7 @@ public class HttpShardHandler extends ShardHandler {
} }
} }
// And now recreate the | delimited list of equivalent servers // And now recreate the | delimited list of equivalent servers
final StringBuilder sliceShardsStr = new StringBuilder(); rb.shards[i] = createSliceShardsStr(shardUrls);
boolean first = true;
for (String shardUrl : shardUrls) {
if (first) {
first = false;
} else {
sliceShardsStr.append('|');
}
sliceShardsStr.append(shardUrl);
}
rb.shards[i] = sliceShardsStr.toString();
} }
} }
String shards_rows = params.get(ShardParams.SHARDS_ROWS); String shards_rows = params.get(ShardParams.SHARDS_ROWS);
@ -472,6 +462,20 @@ public class HttpShardHandler extends ShardHandler {
} }
} }
private static String createSliceShardsStr(final List<String> shardUrls) {
final StringBuilder sliceShardsStr = new StringBuilder();
boolean first = true;
for (String shardUrl : shardUrls) {
if (first) {
first = false;
} else {
sliceShardsStr.append('|');
}
sliceShardsStr.append(shardUrl);
}
return sliceShardsStr.toString();
}
private void addSlices(Map<String,Slice> target, ClusterState state, SolrParams params, String collectionName, String shardKeys, boolean multiCollection) { private void addSlices(Map<String,Slice> target, ClusterState state, SolrParams params, String collectionName, String shardKeys, boolean multiCollection) {
DocCollection coll = state.getCollection(collectionName); DocCollection coll = state.getCollection(collectionName);