Return-Path: Delivered-To: apmail-lucene-solr-commits-archive@minotaur.apache.org Received: (qmail 77617 invoked from network); 11 Feb 2010 17:17:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Feb 2010 17:17:33 -0000 Received: (qmail 23323 invoked by uid 500); 11 Feb 2010 17:17:31 -0000 Delivered-To: apmail-lucene-solr-commits-archive@lucene.apache.org Received: (qmail 23266 invoked by uid 500); 11 Feb 2010 17:17:31 -0000 Mailing-List: contact solr-commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-dev@lucene.apache.org Delivered-To: mailing list solr-commits@lucene.apache.org Received: (qmail 23082 invoked by uid 99); 11 Feb 2010 17:17:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Feb 2010 17:17:30 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Feb 2010 17:17:23 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 28F6823888DD; Thu, 11 Feb 2010 17:17:03 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r909080 - in /lucene/solr/branches/cloud/src/java/org/apache/solr: cloud/ZkController.java core/CoreContainer.java Date: Thu, 11 Feb 2010 17:16:49 -0000 To: solr-commits@lucene.apache.org From: yonik@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100211171703.28F6823888DD@eris.apache.org> Author: yonik Date: Thu Feb 11 17:16:35 2010 New Revision: 909080 URL: http://svn.apache.org/viewvc?rev=909080&view=rev Log: start to unify coreadmin collection params with bootstrap params Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkController.java lucene/solr/branches/cloud/src/java/org/apache/solr/core/CoreContainer.java 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=909080&r1=909079&r2=909080&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 Thu Feb 11 17:16:35 2010 @@ -60,6 +60,7 @@ private final static Pattern URL_POST = Pattern.compile("https?://(.*)"); private final static Pattern URL_PREFIX = Pattern.compile("(https?://).*"); + // package private for tests static final String SHARDS_ZKNODE = "/shards"; static final String CONFIGS_ZKNODE = "/configs"; @@ -68,6 +69,8 @@ public static final String URL_PROP = "url"; public static final String NODE_NAME = "node_name"; + public final static String COLLECTION_PARAM_PREFIX="collection."; + public final static String CONFIGNAME_PROP="configName"; private SolrZkClient zkClient; @@ -482,7 +485,7 @@ if(data != null) { props.load(data); - configName = props.get("configName"); + configName = props.get(CONFIGNAME_PROP); } if (configName != null && !zkClient.exists(CONFIGS_ZKNODE + "/" + configName)) { @@ -808,28 +811,39 @@ try { ZkNodeProps collectionProps = new ZkNodeProps(); - // TODO: if bootstrap_confname isn't set, and there isn't already a conf in zk, just use that? - String defaultConfigName = System.getProperty("bootstrap_confname", "configuration1"); + // TODO: if collection.configName isn't set, and there isn't already a conf in zk, just use that? + String defaultConfigName = System.getProperty(COLLECTION_PARAM_PREFIX+CONFIGNAME_PROP, "configuration1"); // params passed in - currently only done via core admin (create core commmand). if (params != null) { Iterator iter = params.getParameterNamesIterator(); while (iter.hasNext()) { String paramName = iter.next(); - if (paramName.startsWith("collection.")) { - collectionProps.put(paramName.substring("collection.".length()), params.get(paramName)); + if (paramName.startsWith(COLLECTION_PARAM_PREFIX)) { + collectionProps.put(paramName.substring(COLLECTION_PARAM_PREFIX.length()), params.get(paramName)); } } // if the config name wasn't passed in, use the default - if (!collectionProps.containsKey("configName")) - collectionProps.put("configName", defaultConfigName); + if (!collectionProps.containsKey(CONFIGNAME_PROP)) + collectionProps.put(CONFIGNAME_PROP, defaultConfigName); } else if(System.getProperty("bootstrap_confdir") != null) { // if we are bootstrapping a collection, default the config for // a new collection to the collection we are bootstrapping log.info("Setting config for collection:" + collection + " to " + defaultConfigName); - collectionProps.put("configName", defaultConfigName); + + Properties sysProps = System.getProperties(); + for (String sprop : System.getProperties().stringPropertyNames()) { + if (sprop.startsWith(COLLECTION_PARAM_PREFIX)) { + collectionProps.put(sprop.substring(COLLECTION_PARAM_PREFIX.length()), sysProps.getProperty(sprop)); + } + } + + // if the config name wasn't passed in, use the default + if (!collectionProps.containsKey(CONFIGNAME_PROP)) + collectionProps.put(CONFIGNAME_PROP, defaultConfigName); + } else { // check for configName log.info("Looking for collection configName"); @@ -838,7 +852,7 @@ if (zkClient.exists(collectionPath)) { collectionProps = new ZkNodeProps(); collectionProps.load(zkClient.getData(collectionPath, null, null)); - if (collectionProps.containsKey("configName")) { + if (collectionProps.containsKey(CONFIGNAME_PROP)) { break; } } 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=909080&r1=909079&r2=909080&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 Thu Feb 11 17:16:35 2010 @@ -134,7 +134,7 @@ if(!dir.isDirectory()) { throw new IllegalArgumentException("bootstrap_confdir must be a directory of configuration files"); } - String confName = System.getProperty("bootstrap_confname", "configuration1"); + String confName = System.getProperty(ZkController.COLLECTION_PARAM_PREFIX+ZkController.CONFIGNAME_PROP, "configuration1"); zkController.uploadConfigDir(dir, confName); } } catch (InterruptedException e) {