mirror of https://github.com/apache/lucene.git
SOLR-4210: Fix it
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1451987 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fa0094035d
commit
43f384e57f
|
@ -16,13 +16,15 @@ rm -f example/example.log
|
||||||
|
|
||||||
ant example dist
|
ant example dist
|
||||||
|
|
||||||
|
rm -r example/solr-webapp/*
|
||||||
|
unzip example/webapps/solr.war -d example/solr-webapp/webapp
|
||||||
|
|
||||||
cp -r -f example example2
|
cp -r -f example example2
|
||||||
cp -r -f example example3
|
cp -r -f example example3
|
||||||
cp -r -f example example4
|
cp -r -f example example4
|
||||||
cp -r -f example example5
|
cp -r -f example example5
|
||||||
cp -r -f example example6
|
cp -r -f example example6
|
||||||
|
|
||||||
unzip example/webapps/solr.war -d example/solr-webapp
|
|
||||||
java -classpath "example/solr-webapp/webapp/WEB-INF/lib/*" org.apache.solr.cloud.ZkCLI -cmd bootstrap -zkhost 127.0.0.1:9983 -solrhome example/solr -runzk 8983
|
java -classpath "example/solr-webapp/webapp/WEB-INF/lib/*" org.apache.solr.cloud.ZkCLI -cmd bootstrap -zkhost 127.0.0.1:9983 -solrhome example/solr -runzk 8983
|
||||||
|
|
||||||
cd example
|
cd example
|
||||||
|
|
|
@ -405,8 +405,10 @@ public class SolrDispatchFilter implements Filter
|
||||||
private String getRemotCoreUrl(CoreContainer cores, String collectionName) {
|
private String getRemotCoreUrl(CoreContainer cores, String collectionName) {
|
||||||
ClusterState clusterState = cores.getZkController().getClusterState();
|
ClusterState clusterState = cores.getZkController().getClusterState();
|
||||||
Collection<Slice> slices = clusterState.getSlices(collectionName);
|
Collection<Slice> slices = clusterState.getSlices(collectionName);
|
||||||
|
boolean byCoreName = false;
|
||||||
if (slices == null) {
|
if (slices == null) {
|
||||||
|
// look by core name
|
||||||
|
byCoreName = true;
|
||||||
Set<String> collections = clusterState.getCollections();
|
Set<String> collections = clusterState.getCollections();
|
||||||
for (String collection : collections) {
|
for (String collection : collections) {
|
||||||
slices = new ArrayList<Slice>();
|
slices = new ArrayList<Slice>();
|
||||||
|
@ -427,14 +429,19 @@ public class SolrDispatchFilter implements Filter
|
||||||
ZkCoreNodeProps coreNodeProps = new ZkCoreNodeProps(nodeProps);
|
ZkCoreNodeProps coreNodeProps = new ZkCoreNodeProps(nodeProps);
|
||||||
if (liveNodes.contains(coreNodeProps.getNodeName())
|
if (liveNodes.contains(coreNodeProps.getNodeName())
|
||||||
&& coreNodeProps.getState().equals(ZkStateReader.ACTIVE)) {
|
&& coreNodeProps.getState().equals(ZkStateReader.ACTIVE)) {
|
||||||
|
if (byCoreName && !collectionName.equals(coreNodeProps.getCoreName())) {
|
||||||
|
// if it's by core name, make sure they match
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (coreNodeProps.getBaseUrl().equals(cores.getZkController().getBaseUrl())) {
|
||||||
|
// don't count a local core
|
||||||
|
continue;
|
||||||
|
}
|
||||||
String coreUrl = coreNodeProps.getCoreUrl();
|
String coreUrl = coreNodeProps.getCoreUrl();
|
||||||
if (coreUrl.endsWith("/")) {
|
if (coreUrl.endsWith("/")) {
|
||||||
coreUrl = coreUrl.substring(0, coreUrl.length() - 1);
|
coreUrl = coreUrl.substring(0, coreUrl.length() - 1);
|
||||||
}
|
}
|
||||||
if (coreNodeProps.getBaseUrl().equals(cores.getZkController().getBaseUrl())) {
|
|
||||||
// don't count a local core
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return coreUrl;
|
return coreUrl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue