lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r1210663 - in /lucene/dev/branches/solrcloud/solr: core/src/java/org/apache/solr/cloud/ core/src/test/org/apache/solr/cloud/ solrj/src/java/org/apache/solr/client/solrj/impl/ solrj/src/java/org/apache/solr/common/cloud/
Date Mon, 05 Dec 2011 22:03:39 GMT
Author: markrmiller
Date: Mon Dec  5 22:03:39 2011
New Revision: 1210663

URL: http://svn.apache.org/viewvc?rev=1210663&view=rev
Log:
fix screwy solrzkclient.setData code that was causing cluster state update problems 

Modified:
    lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/cloud/Overseer.java
    lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/cloud/ZkController.java
    lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/AbstractZkTestCase.java
    lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/FullDistributedZkTest.java
    lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
    lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
    lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java

Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/cloud/Overseer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/cloud/Overseer.java?rev=1210663&r1=1210662&r2=1210663&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/cloud/Overseer.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/cloud/Overseer.java Mon
Dec  5 22:03:39 2011
@@ -323,7 +323,6 @@ public class Overseer implements NodeSta
    */
   private void publishCloudState() {
     try {
-      System.out.println("publish:" + cloudState.getCollections());
       CloudStateUtility.update(zkClient, cloudState, null);
     } catch (KeeperException e) {
       log.error("Could not publish cloud state.", e);

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=1210663&r1=1210662&r2=1210663&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
Mon Dec  5 22:03:39 2011
@@ -622,7 +622,7 @@ public final class ZkController {
     for(File file : files) {
       if (!file.getName().startsWith(".")) {
         if (!file.isDirectory()) {
-          zkClient.setData(zkPath + "/" + file.getName(), file);
+          zkClient.makePath(zkPath + "/" + file.getName(), file);
         } else {
           uploadToZK(file, zkPath + "/" + file.getName());
         }

Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/AbstractZkTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/AbstractZkTestCase.java?rev=1210663&r1=1210662&r2=1210663&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/AbstractZkTestCase.java
(original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/AbstractZkTestCase.java
Mon Dec  5 22:03:39 2011
@@ -96,9 +96,10 @@ public abstract class AbstractZkTestCase
     zkClient.close();
   }
 
-  private static void putConfig(SolrZkClient zkConnection, String name)
+  private static void putConfig(SolrZkClient zkClient, String name)
       throws Exception {
-    zkConnection.setData("/configs/conf1/" + name, getFile("solr"
+
+    zkClient.makePath("/configs/conf1/" + name, getFile("solr"
         + File.separator + "conf" + File.separator + name));
   }
 

Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/FullDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/FullDistributedZkTest.java?rev=1210663&r1=1210662&r2=1210663&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/FullDistributedZkTest.java
(original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/FullDistributedZkTest.java
Mon Dec  5 22:03:39 2011
@@ -51,12 +51,10 @@ import org.apache.solr.servlet.SolrDispa
 import org.apache.zookeeper.KeeperException;
 import org.junit.Before;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 
 /**
  *
  */
-@Ignore("Trying to figure out an issue")
 public class FullDistributedZkTest extends AbstractDistributedZkTestCase {
   
   static final String DISTRIB_UPDATE_CHAIN = "distrib-update-chain";

Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java?rev=1210663&r1=1210662&r2=1210663&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
(original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
Mon Dec  5 22:03:39 2011
@@ -63,10 +63,10 @@ public class OverseerTest extends SolrTe
    
       props.put("num_shards", "3");
       ZkNodeProps zkProps = new ZkNodeProps(props);
-      zkClient.setData("/collections/collection1", zkProps.store());
+      zkClient.makePath("/collections/collection1", zkProps.store());
       props.put("num_shards", "1");
       zkProps = new ZkNodeProps(props);
-      zkClient.setData("/collections/collection2", zkProps.store());
+      zkClient.makePath("/collections/collection2", zkProps.store());
       ZkNodeProps z = new ZkNodeProps(props);
       
       CoreDescriptor desc = new CoreDescriptor(null, "core1", "");

Modified: lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java?rev=1210663&r1=1210662&r2=1210663&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
(original)
+++ lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
Mon Dec  5 22:03:39 2011
@@ -49,7 +49,6 @@ public class CloudSolrServer extends Sol
   private String defaultCollection;
   private LBHttpSolrServer lbServer;
   Random rand = new Random();
-  static AtomicInteger cnt = new AtomicInteger(0);
 
   /**
    * @param zkHost The address of the zookeeper quorum containing the cloud state
@@ -95,10 +94,6 @@ public class CloudSolrServer extends Sol
       synchronized (this) {
         if (zkStateReader == null) {
           try {
-            if (cnt.incrementAndGet() > 1) {
-              throw new IllegalStateException();
-            }
-            System.out.println("SHOULD ONLY HAPPEN ONCE");
             ZkStateReader zk = new ZkStateReader(zkHost, zkConnectTimeout,
                 zkClientTimeout, true);
             zk.createClusterStateWatchersAndUpdate();

Modified: lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java?rev=1210663&r1=1210662&r2=1210663&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
(original)
+++ lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
Mon Dec  5 22:03:39 2011
@@ -273,6 +273,16 @@ public class SolrZkClient {
     makePath(path, null, CreateMode.PERSISTENT);
   }
   
+  public void makePath(String path, File file) throws IOException,
+      KeeperException, InterruptedException {
+    if (log.isInfoEnabled()) {
+      log.info("Write to ZooKeepeer " + file.getAbsolutePath() + " to " + path);
+    }
+    
+    String data = FileUtils.readFileToString(file);
+    makePath(path, data.getBytes("UTF-8"));
+  }
+  
   public void makePath(String path, CreateMode createMode) throws KeeperException,
       InterruptedException {
     makePath(path, null, createMode);
@@ -398,15 +408,7 @@ public class SolrZkClient {
    */
   public void setData(String path, byte[] data) throws KeeperException,
       InterruptedException {
-
-    makePath(path);
-
-    Object exists = exists(path, null);
-    if (exists != null) {
-      setData(path, data, -1);
-    } else {
-      create(path, data, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-    }
+    setData(path, data, -1);
   }
 
   /**



Mime
View raw message