lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r895056 - in /lucene/solr/branches/cloud/src: java/org/apache/solr/cloud/ webapp/web/admin/
Date Fri, 01 Jan 2010 19:20:27 GMT
Author: markrmiller
Date: Fri Jan  1 19:20:26 2010
New Revision: 895056

URL: http://svn.apache.org/viewvc?rev=895056&view=rev
Log:
tweaks

Modified:
    lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ShardInfo.java
    lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ShardInfoList.java
    lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZooKeeperConnection.java
    lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZooKeeperController.java
    lucene/solr/branches/cloud/src/webapp/web/admin/zookeeper.jsp

Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ShardInfo.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ShardInfo.java?rev=895056&r1=895055&r2=895056&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ShardInfo.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ShardInfo.java Fri Jan  1 19:20:26
2010
@@ -44,4 +44,9 @@
   public String getUrl() {
     return url;
   }
+  
+
+  enum Role {
+    MASTER, SLAVE
+  }
 }

Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ShardInfoList.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ShardInfoList.java?rev=895056&r1=895055&r2=895056&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ShardInfoList.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ShardInfoList.java Fri Jan 
1 19:20:26 2010
@@ -56,14 +56,10 @@
     // nocommit
     for (ShardInfo shard : shards) {
       System.out.println("getNode:" + shard.getUrl());
-      if (shard.getRole() != Role.MASTER) {
+      if (shard.getRole() != ShardInfo.Role.MASTER) {
         return shard.getUrl();
       }
     }
     throw new IllegalStateException("No slaves for shard");
   }
 }
-
-enum Role {
-  MASTER, SLAVE
-}

Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZooKeeperConnection.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZooKeeperConnection.java?rev=895056&r1=895055&r2=895056&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZooKeeperConnection.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZooKeeperConnection.java Fri
Jan  1 19:20:26 2010
@@ -1,5 +1,22 @@
 package org.apache.solr.cloud;
 
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 import java.io.IOException;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
@@ -22,8 +39,7 @@
   protected static final Logger log = LoggerFactory
       .getLogger(ZooKeeperConnection.class);
 
-  private String zooKeeperHost;
-
+  private String zkHost;
   private int zkClientTimeout;
   
   boolean connected = false;
@@ -32,8 +48,8 @@
 
   private volatile ZooKeeper keeper;
 
-  public ZooKeeperConnection(String zooKeeperHost, int zkClientTimeout) {
-    this.zooKeeperHost = zooKeeperHost;
+  public ZooKeeperConnection(String zkHost, int zkClientTimeout) {
+    this.zkHost = zkHost;
     this.zkClientTimeout = zkClientTimeout;
   }
 
@@ -42,7 +58,7 @@
     // nocommit
     log.info("Connecting to ZooKeeper...");
     
-    keeper = new ZooKeeper(zooKeeperHost, zkClientTimeout, cw);
+    keeper = new ZooKeeper(zkHost, zkClientTimeout, cw);
     cw.waitForConnected(CONNECT_TIMEOUT);
 
     // nocommit
@@ -50,7 +66,7 @@
   }
   
   public boolean connected() {
-    return keeper.getState() == ZooKeeper.States.CONNECTED;
+    return keeper != null && keeper.getState() == ZooKeeper.States.CONNECTED;
   }
 
   class CountdownWatcher implements Watcher {

Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZooKeeperController.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZooKeeperController.java?rev=895056&r1=895055&r2=895056&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZooKeeperController.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZooKeeperController.java Fri
Jan  1 19:20:26 2010
@@ -73,7 +73,7 @@
 
       try {
         // refresh watcher
-        controller.getKeeper().exists(event.getPath(), this);
+        controller.getKeeperConnection().exists(event.getPath(), this);
 
         // TODO: need to load whole state?
         controller.loadCollectionInfo();
@@ -99,10 +99,10 @@
   private static Logger log = LoggerFactory
       .getLogger(ZooKeeperController.class);
 
-  // nocommit : consider reconnects more closely
-  private volatile ZooKeeperConnection keeperConnection;
 
-  ZooKeeperConnection getKeeper() {
+  private ZooKeeperConnection keeperConnection;
+
+  ZooKeeperConnection getKeeperConnection() {
     return keeperConnection;
   }
 
@@ -116,7 +116,7 @@
 
   private ZooKeeperWriter zkWriter;
 
-  private String zooKeeperHost;
+  private String zkServerAddress;
 
 
   private String hostPort;
@@ -130,21 +130,21 @@
 
   /**
    * 
-   * @param zooKeeperHost ZooKeeper host address
+   * @param zkServerAddress ZooKeeper server host address
    * @param collection
    * @param hostUrl
    * @param hostPort
    * @param hostContext
    * @param zkClientTimeout
    */
-  public ZooKeeperController(String zooKeeperHost, String collection,
+  public ZooKeeperController(String zkServerAddress, String collection,
       String hostUrl, String hostPort, String hostContext, int zkClientTimeout) {
 
     this.collectionName = collection;
-    this.zooKeeperHost = zooKeeperHost;
+    this.zkServerAddress = zkServerAddress;
     this.hostPort = hostPort;
     this.hostContext = hostContext;
-    keeperConnection = new ZooKeeperConnection(zooKeeperHost, zkClientTimeout);
+    keeperConnection = new ZooKeeperConnection(zkServerAddress, zkClientTimeout);
  
     shardsZkPath = COLLECTIONS_ZKNODE + collectionName + SHARDS_ZKNODE;
 
@@ -267,7 +267,7 @@
    * @return
    */
   public String getZooKeeperHost() {
-    return zooKeeperHost;
+    return zkServerAddress;
   }
 
   // load and publish a new CollectionInfo

Modified: lucene/solr/branches/cloud/src/webapp/web/admin/zookeeper.jsp
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/webapp/web/admin/zookeeper.jsp?rev=895056&r1=895055&r2=895056&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/webapp/web/admin/zookeeper.jsp (original)
+++ lucene/solr/branches/cloud/src/webapp/web/admin/zookeeper.jsp Fri Jan  1 19:20:26 2010
@@ -391,6 +391,11 @@
           try {
             str = new String(data, "UTF-8");
           } catch (UnsupportedEncodingException e) {
+            // nocommit : does this make sense? isn't UTF-8
+            // gauranteed to be supported? I don't think this is thrown
+            // because its not UTF-8 is it? The results are unspecified
+            // when the bytes are not properly encoded.
+            
             // not UTF8
             StringBuilder sb = new StringBuilder(data.length * 2);
             for (int i = 0; i < data.length; i++) {



Mime
View raw message