You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2011/10/06 14:50:39 UTC

svn commit: r1179604 - /lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/cloud/ZkController.java

Author: markrmiller
Date: Thu Oct  6 12:50:39 2011
New Revision: 1179604

URL: http://svn.apache.org/viewvc?rev=1179604&view=rev
Log:
SOLR-2806: If only one config set is in zk and a collection node does not explicitly have a config name set on its node, use the one config set.
SOLR-2805: Add a main method to ZkController so that it's easier to script config upload with SolrCloud

Modified:
    lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/cloud/ZkController.java

Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/cloud/ZkController.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/cloud/ZkController.java?rev=1179604&r1=1179603&r2=1179604&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/cloud/ZkController.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/cloud/ZkController.java Thu Oct  6 12:50:39 2011
@@ -89,6 +89,18 @@ public final class ZkController {
 
   private AssignShard assignShard;
 
+  public static void main(String[] args) throws Exception {
+    ZkController zkController = new ZkController(args[0], 15000, 5000, args[1], args[2], args[3], new CurrentCoreDescriptorProvider() {
+      
+      @Override
+      public List<CoreDescriptor> getCurrentDescriptors() {
+        // do nothing
+        return null;
+      }
+    });
+    
+    zkController.uploadConfigDir(new File(args[4]), args[5]);
+  }
 
 
   /**
@@ -671,6 +683,14 @@ public final class ZkController {
                   break;
                 }
               }
+              // if there is only one conf, use that
+              List<String> configNames = zkClient.getChildren(CONFIGS_ZKNODE, null);
+              if (configNames.size() == 1) {
+                // no config set named, but there is only 1 - use it
+                log.info("Only one config set found in zk - using it:" + configNames.get(0));
+                collectionProps.put(CONFIGNAME_PROP,  configNames.get(0));
+                break;
+              }
               log.info("Could not find collection configName - pausing for 2 seconds and trying again - try: " + retry);
               Thread.sleep(2000);
             }