You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by ma...@apache.org on 2010/01/19 18:50:23 UTC
svn commit: r900866 - in /lucene/solr/branches/cloud/src:
java/org/apache/solr/cloud/ java/org/apache/solr/handler/component/
test/org/apache/solr/cloud/
Author: markrmiller
Date: Tue Jan 19 17:50:12 2010
New Revision: 900866
URL: http://svn.apache.org/viewvc?rev=900866&view=rev
Log:
just makes Slices a List<Slice> for now
Removed:
lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/Slices.java
Modified:
lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudState.java
lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkController.java
lucene/solr/branches/cloud/src/java/org/apache/solr/handler/component/QueryComponent.java
lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/ZkControllerTest.java
Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudState.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudState.java?rev=900866&r1=900865&r2=900866&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudState.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudState.java Tue Jan 19 17:50:12 2010
@@ -24,25 +24,25 @@
// effectively immutable
public class CloudState {
- private Map<String,Slices> collectionStates = new HashMap<String,Slices>();
- private List<String> nodes = null;
+ private Map<String,List<Slice>> collectionStates = new HashMap<String,List<Slice>>();
+ private List<String> liveNodes = null;
- // nocommit
- public void addSlices(String collection, Slices slices) {
+ public CloudState(List<String> liveNodes) {
+ this.liveNodes = liveNodes;
+ }
+
+ // nocommit : only call before publishing
+ public void addSlices(String collection, List<Slice> slices) {
collectionStates.put(collection, slices);
}
// nocommit
- public Slices getSlices(String collection) {
- return collectionStates.get(collection);
+ public List<Slice> getSlices(String collection) {
+ return Collections.unmodifiableList(collectionStates.get(collection));
}
public List<String> getNodes() {
- return Collections.unmodifiableList(nodes);
- }
-
- // nocommit
- public void setNodes(List<String> nodes) {
- this.nodes = nodes;
+ return Collections.unmodifiableList(liveNodes);
}
+
}
Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkController.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkController.java?rev=900866&r1=900865&r2=900866&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkController.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkController.java Tue Jan 19 17:50:12 2010
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -392,15 +393,14 @@
log.info("Updating cloud state from ZooKeeper... :" + zkClient.keeper);
// build immutable CloudInfo
- CloudState cloudInfo = new CloudState();
- List<String> liveNodes = getLiveNodes();
- cloudInfo.setNodes(liveNodes);
+ CloudState cloudInfo = new CloudState(getLiveNodes());
+
List<String> collections = getCollectionNames();
// nocommit : load all collection info
for (String collection : collections) {
String shardIdPaths = COLLECTIONS_ZKNODE + "/" + collection + SHARDS_ZKNODE;
List<String> shardIdNames = zkClient.getChildren(shardIdPaths, null);
- Slices slices = new Slices();
+ List<Slice> slices = new ArrayList<Slice>();
for(String shardIdZkPath : shardIdNames) {
Map<String,ZkNodeProps> shardsMap = readShards(shardIdPaths + "/" + shardIdZkPath);
Slice slice = new Slice(shardsMap);
Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/handler/component/QueryComponent.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/handler/component/QueryComponent.java?rev=900866&r1=900865&r2=900866&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/handler/component/QueryComponent.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/handler/component/QueryComponent.java Tue Jan 19 17:50:12 2010
@@ -41,7 +41,6 @@
import org.apache.solr.util.SolrPluginUtils;
import org.apache.solr.cloud.CloudState;
import org.apache.solr.cloud.Slice;
-import org.apache.solr.cloud.Slices;
import org.apache.solr.cloud.ZkNodeProps;
@@ -151,7 +150,7 @@
cloudState = req.getCore().getCoreDescriptor().getCoreContainer().getZooKeeperController().getCloudState();
}
String sliceStr = rb.slices[i];
- Slices slices = cloudState.getSlices(sliceStr);
+ List<Slice> slices = cloudState.getSlices(sliceStr);
if (slices==null || slices.size() == 0) {
// TODO: we could treat this as "all servers down" for a slice if partial results are enabled.
Modified: lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/ZkControllerTest.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/ZkControllerTest.java?rev=900866&r1=900865&r2=900866&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/ZkControllerTest.java (original)
+++ lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/ZkControllerTest.java Tue Jan 19 17:50:12 2010
@@ -21,6 +21,7 @@
import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
+import java.util.List;
import junit.framework.TestCase;
@@ -76,7 +77,7 @@
"localhost", "8983", "/solr");
zkController.updateCloudState();
CloudState cloudInfo = zkController.getCloudState();
- Slices slices = cloudInfo.getSlices("collection1");
+ List<Slice> slices = cloudInfo.getSlices("collection1");
assertNotNull(slices);