Return-Path: Delivered-To: apmail-lucene-solr-commits-archive@minotaur.apache.org Received: (qmail 52535 invoked from network); 14 Jan 2010 00:16:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 14 Jan 2010 00:16:17 -0000 Received: (qmail 87070 invoked by uid 500); 14 Jan 2010 00:16:16 -0000 Delivered-To: apmail-lucene-solr-commits-archive@lucene.apache.org Received: (qmail 86999 invoked by uid 500); 14 Jan 2010 00:16:16 -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 86990 invoked by uid 99); 14 Jan 2010 00:16:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jan 2010 00:16:16 +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, 14 Jan 2010 00:16:08 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id CB9942388897; Thu, 14 Jan 2010 00:15:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r899007 - in /lucene/solr/branches/cloud/src: java/org/apache/solr/cloud/ test/org/apache/solr/cloud/ Date: Thu, 14 Jan 2010 00:15:48 -0000 To: solr-commits@lucene.apache.org From: markrmiller@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100114001548.CB9942388897@eris.apache.org> Author: markrmiller Date: Thu Jan 14 00:15:48 2010 New Revision: 899007 URL: http://svn.apache.org/viewvc?rev=899007&view=rev Log: minor name refactoring and updates Added: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudState.java - copied, changed from r898977, lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudInfo.java lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CollectionState.java - copied, changed from r898977, lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CollectionInfo.java Removed: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudInfo.java lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CollectionInfo.java Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ShardsWatcher.java lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/SolrZkClient.java lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkController.java lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/ZkControllerTest.java Copied: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudState.java (from r898977, lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudInfo.java) URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudState.java?p2=lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudState.java&p1=lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudInfo.java&r1=898977&r2=899007&rev=899007&view=diff ============================================================================== --- lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudInfo.java (original) +++ lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudState.java Thu Jan 14 00:15:48 2010 @@ -20,15 +20,15 @@ import java.util.HashMap; import java.util.Map; -public class CloudInfo { - private Map collectionInfos = new HashMap(); +public class CloudState { + private Map collectionStates = new HashMap(); //nocommit - public void addCollectionInfo(String collection, CollectionInfo collectionInfo) { - collectionInfos.put(collection, collectionInfo); + public void addCollectionInfo(String collection, CollectionState collectionInfo) { + collectionStates.put(collection, collectionInfo); } - public CollectionInfo getCollectionInfo(String collection) { - return collectionInfos.get(collection); + public CollectionState getCollectionInfo(String collection) { + return collectionStates.get(collection); } } Copied: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CollectionState.java (from r898977, lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CollectionInfo.java) URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CollectionState.java?p2=lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CollectionState.java&p1=lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CollectionInfo.java&r1=898977&r2=899007&rev=899007&view=diff ============================================================================== --- lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CollectionInfo.java (original) +++ lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CollectionState.java Thu Jan 14 00:15:48 2010 @@ -34,10 +34,10 @@ * Information about the Collection. * */ -public final class CollectionInfo { +public final class CollectionState { protected static final Logger log = LoggerFactory - .getLogger(CollectionInfo.class); + .getLogger(CollectionState.class); static final String SHARD_LIST_PROP = "shard_list"; static final String URL_PROP = "url"; @@ -51,7 +51,7 @@ - public CollectionInfo(Map shards, List nodes) { + public CollectionState(Map shards, List nodes) { //nocommit: defensive copy? this.shards = shards; this.updateTime = System.currentTimeMillis(); Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ShardsWatcher.java URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ShardsWatcher.java?rev=899007&r1=899006&r2=899007&view=diff ============================================================================== --- lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ShardsWatcher.java (original) +++ lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ShardsWatcher.java Thu Jan 14 00:15:48 2010 @@ -52,7 +52,7 @@ // nocommit : rewatch controller.getZkClient().exists(event.getPath(), this); - // TODO: need to load whole state? + // nocommit : just see what has changed controller.readCloudInfo(); } catch (KeeperException e) { Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/SolrZkClient.java URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/SolrZkClient.java?rev=899007&r1=899006&r2=899007&view=diff ============================================================================== --- lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/SolrZkClient.java (original) +++ lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/SolrZkClient.java Thu Jan 14 00:15:48 2010 @@ -25,7 +25,6 @@ import org.apache.commons.io.FileUtils; import org.apache.solr.cloud.ZkClientConnectionStrategy.ZkUpdate; -import org.apache.solr.common.SolrException; import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.Watcher; 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=899007&r1=899006&r2=899007&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 Jan 14 00:15:48 2010 @@ -23,7 +23,6 @@ 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.HashSet; @@ -82,7 +81,7 @@ private SolrZkClient zkClient; - private volatile CloudInfo cloudInfo; + private volatile CloudState cloudInfo; private String zkServerAddress; @@ -175,7 +174,7 @@ // now watch the shards node try { - zkClient.exists(shardsZkPath, shardWatcher); + zkClient.getChildren(shardsZkPath, shardWatcher); } catch (KeeperException e) { log.error("ZooKeeper Exception", e); throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, @@ -214,7 +213,7 @@ /** * @return information about the cluster from ZooKeeper */ - public CloudInfo getCloudInfo() { + public CloudState getCloudInfo() { return cloudInfo; } @@ -400,7 +399,7 @@ log.info("Updating cloud state from ZooKeeper... :" + zkClient.keeper); // build immutable CloudInfo - CloudInfo cloudInfo = new CloudInfo(); + CloudState cloudInfo = new CloudState(); List collections = getCollectionNames(); // nocommit : load all collection info for (String collection : collections) { @@ -410,7 +409,7 @@ List nodes = zkClient.getChildren(shardsZkPath, null); Map shards = readShardsInfo(collection, shardsZkPath, nodes); - CollectionInfo collectionInfo = new CollectionInfo(shards, nodes); + CollectionState collectionInfo = new CollectionState(shards, nodes); cloudInfo.addCollectionInfo(collection, collectionInfo); } @@ -561,14 +560,14 @@ ByteArrayOutputStream baos = new ByteArrayOutputStream(); // nocommit: could do xml Properties props = new Properties(); - props.put(CollectionInfo.URL_PROP, shardUrl); + props.put(CollectionState.URL_PROP, shardUrl); String shardList = cloudDesc.getShardList(); - props.put(CollectionInfo.SHARD_LIST_PROP, shardList == null ? "" + props.put(CollectionState.SHARD_LIST_PROP, shardList == null ? "" : shardList); - props.put(CollectionInfo.ROLE_PROP, cloudDesc.getRole()); + props.put(CollectionState.ROLE_PROP, cloudDesc.getRole()); props.store(baos, PROPS_DESC); 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=899007&r1=899006&r2=899007&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 Thu Jan 14 00:15:48 2010 @@ -84,8 +84,8 @@ zkController = new ZkController(ZOO_KEEPER_ADDRESS, TIMEOUT, "localhost", "8983", "/solr"); zkController.readCloudInfo(); - CloudInfo cloudInfo = zkController.getCloudInfo(); - CollectionInfo collectionInfo = cloudInfo.getCollectionInfo("collection1"); + CloudState cloudInfo = zkController.getCloudInfo(); + CollectionState collectionInfo = cloudInfo.getCollectionInfo("collection1"); assertNotNull(collectionInfo); @@ -174,8 +174,8 @@ ByteArrayOutputStream baos = new ByteArrayOutputStream(); // nocommit: could do xml Properties props = new Properties(); - props.put(CollectionInfo.URL_PROP, url); - props.put(CollectionInfo.SHARD_LIST_PROP, shardList); + props.put(CollectionState.URL_PROP, url); + props.put(CollectionState.SHARD_LIST_PROP, shardList); props.store(baos, ZkController.PROPS_DESC); zkClient.create(shardsPath + ZkController.CORE_ZKPREFIX,