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 yo...@apache.org on 2010/02/23 00:29:40 UTC

svn commit: r915113 - in /lucene/solr/branches/cloud: example/solr/solr.xml src/java/org/apache/solr/core/CoreContainer.java src/test/org/apache/solr/cloud/BasicDistributedZkTest.java

Author: yonik
Date: Mon Feb 22 23:29:39 2010
New Revision: 915113

URL: http://svn.apache.org/viewvc?rev=915113&view=rev
Log:
persist collection + shard in solr.xml, change shardId to shard when used as a param for consistency

Modified:
    lucene/solr/branches/cloud/example/solr/solr.xml
    lucene/solr/branches/cloud/src/java/org/apache/solr/core/CoreContainer.java
    lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java

Modified: lucene/solr/branches/cloud/example/solr/solr.xml
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/example/solr/solr.xml?rev=915113&r1=915112&r2=915113&view=diff
==============================================================================
--- lucene/solr/branches/cloud/example/solr/solr.xml (original)
+++ lucene/solr/branches/cloud/example/solr/solr.xml Mon Feb 22 23:29:39 2010
@@ -29,12 +29,12 @@
     If 'null' (or absent), cores will not be manageable via request handler
   -->
   <cores adminPath="/admin/cores" defaultCoreName="collection1">
-    <core name="collection1" instanceDir="." shardId="shard1"/>
+    <core name="collection1" instanceDir="." shard="shard1"/>
     <!-- 
       SolrCloud related attributes on core:
         collection - The name of the collection this core belongs to. 
           Defaults to the name of the core.
-        shardId - which shard of the collection this core has.  Defaults
+        shard - which shard of the collection this core has.  Defaults
           to a name derived from host:port_webapp_corename.
         role - TBD
     -->

Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/core/CoreContainer.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/core/CoreContainer.java?rev=915113&r1=915112&r2=915113&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/core/CoreContainer.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/core/CoreContainer.java Mon Feb 22 23:29:39 2010
@@ -390,7 +390,7 @@
             p.setSchemaName(opt);
           }
           if (zkController != null) {
-            opt = DOMUtil.getAttr(node, "shardId", null);
+            opt = DOMUtil.getAttr(node, "shard", null);
             if (testShardIdOverride != null
                 && name.equals("")) {
               p.getCloudDescriptor().setShardId(testShardIdOverride);
@@ -954,6 +954,18 @@
     }
     opt = dcore.dataDir;
     if (opt != null) writeAttribute(w,"dataDir",opt);
+
+    CloudDescriptor cd = dcore.getCloudDescriptor();
+    if (cd != null) {
+      opt = cd.getShardId();
+      if (opt != null)
+        writeAttribute(w,"shard",opt);
+      // only write out the collection name if it's not the default (the core name)
+      opt = cd.getCollectionName();
+      if (opt != null && !opt.equals(dcore.name))
+        writeAttribute(w,"collection",opt);
+    }
+
     if (dcore.getCoreProperties() == null || dcore.getCoreProperties().isEmpty())
       w.write("/>\n"); // core
     else  {

Modified: lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java?rev=915113&r1=915112&r2=915113&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java (original)
+++ lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java Mon Feb 22 23:29:39 2010
@@ -70,7 +70,7 @@
       StringBuilder sb = new StringBuilder();
       for (int i=0; i<nServers; i++) {
         if (i>0) sb.append(',');
-        sb.append("shardId"+(i+3));
+        sb.append("shard"+(i+3));
       }
       params.set("shards",sb.toString());
       params.set("distrib","true");
@@ -80,13 +80,13 @@
   // TODO: there is an incorrect localhost:8983 shard registered
 
   protected void createServers(int numShards) throws Exception {
-    controlJetty = createJetty(testDir, "control", "control_shardId");
+    controlJetty = createJetty(testDir, "control", "control_shard");
     controlClient = createNewSolrServer(controlJetty.getLocalPort());
 
     StringBuilder sb = new StringBuilder();
     for (int i = 1; i <= numShards; i++) {
       if (sb.length() > 0) sb.append(',');
-      JettySolrRunner j = createJetty(testDir, "jetty" + i, "shardId" + (i + 2));
+      JettySolrRunner j = createJetty(testDir, "jetty" + i, "shard" + (i + 2));
       jettys.add(j);
       clients.add(createNewSolrServer(j.getLocalPort()));
       sb.append("localhost:").append(j.getLocalPort()).append(context);