lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r903663 - in /lucene/solr/branches/cloud/src: java/org/apache/solr/core/CoreContainer.java java/org/apache/solr/core/CoreDescriptor.java test/org/apache/solr/cloud/BasicDistributedZkTest.java
Date Wed, 27 Jan 2010 14:42:20 GMT
Author: markrmiller
Date: Wed Jan 27 14:42:20 2010
New Revision: 903663

URL: http://svn.apache.org/viewvc?rev=903663&view=rev
Log:
fix cloud descriptor shardid default

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

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=903663&r1=903662&r2=903663&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 Wed Jan 27
14:42:20 2010
@@ -32,6 +32,7 @@
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathExpressionException;
 
+import org.apache.solr.cloud.CloudDescriptor;
 import org.apache.solr.cloud.ZkSolrResourceLoader;
 import org.apache.solr.cloud.ZkController;
 import org.apache.solr.cloud.ZooKeeperException;
@@ -387,9 +388,6 @@
           if(testShardIdOverride != null && name.equals("")) {
             p.getCloudDescriptor().setShardId(testShardIdOverride);
           } else if(zooKeeperController != null) {
-            if(opt == null) {
-              opt = "SHARDID:" + zooKeeperController.getNodeName() + "_" + name;
-            }
             p.getCloudDescriptor().setShardId(opt);
           }
           opt = DOMUtil.getAttr(node, "role", null);

Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/core/CoreDescriptor.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/core/CoreDescriptor.java?rev=903663&r1=903662&r2=903663&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/core/CoreDescriptor.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/core/CoreDescriptor.java Wed Jan 27
14:42:20 2010
@@ -37,15 +37,19 @@
   private final CoreContainer coreContainer;
   private Properties coreProperties;
   
-  // nocommit : only filled when using ZooKeeper
-  private CloudDescriptor cloudDesc = new CloudDescriptor();
+  private CloudDescriptor cloudDesc;
 
   public CoreDescriptor(CoreContainer coreContainer, String name, String instanceDir) {
     this.coreContainer = coreContainer;
     this.name = name;
     
-    // cloud collection defaults to core name
-    this.cloudDesc.setCollectionName(name == "" ? coreContainer.getDefaultCoreName() : name);
+    if(coreContainer.getZooKeeperController() != null) {
+      this.cloudDesc = new CloudDescriptor();
+      // cloud collection defaults to core name
+      cloudDesc.setCollectionName(name == "" ? coreContainer.getDefaultCoreName() : name);
+      this.cloudDesc.setShardId("SHARDID:" + coreContainer.getZooKeeperController().getNodeName()
+ "_" + name);
+    }
+    
     if (name == null) {
       throw new RuntimeException("Core needs a name");
     }
@@ -183,4 +187,8 @@
   public CloudDescriptor getCloudDescriptor() {
     return cloudDesc;
   }
+  
+  public void setCloudDescriptor(CloudDescriptor cloudDesc) {
+    this.cloudDesc = cloudDesc;
+  }
 }

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=903663&r1=903662&r2=903663&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
Wed Jan 27 14:42:20 2010
@@ -132,6 +132,7 @@
 
     h.getCoreContainer().getCore(h.getCoreContainer().getDefaultCoreName()).close();
     CoreDescriptor dcore= new CoreDescriptor( h.getCoreContainer(), "testcore", "testcore");
+
     SolrCore core = h.getCoreContainer().create(dcore);
     h.getCoreContainer().register(core, false);
 



Mime
View raw message