lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r903654 - in /lucene/solr/branches/cloud/src: java/org/apache/solr/cloud/ZkController.java java/org/apache/solr/core/CoreContainer.java java/org/apache/solr/core/SolrCore.java test/org/apache/solr/cloud/BasicDistributedZkTest.java
Date Wed, 27 Jan 2010 14:12:32 GMT
Author: markrmiller
Date: Wed Jan 27 14:12:31 2010
New Revision: 903654

URL: http://svn.apache.org/viewvc?rev=903654&view=rev
Log:
move cloud core registration from SolrCore to CoreContainer#register and a couple other minor
comment updates

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
    lucene/solr/branches/cloud/src/java/org/apache/solr/core/SolrCore.java
    lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicDistributedZkTest.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=903654&r1=903653&r2=903654&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 Wed Jan 27
14:12:31 2010
@@ -60,6 +60,8 @@
  * notes: loads everything on init, creates what's not there - further updates
  * are prompted with Watches.
  * 
+ * TODO: exceptions during shutdown on attempts to update cloud state
+ * 
  */
 public final class ZkController {
 

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=903654&r1=903653&r2=903654&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 Wed Jan 27
14:12:31 2010
@@ -517,6 +517,24 @@
       core.setName(name);
     }
 
+    if (zooKeeperController != null) {
+      try {
+        zooKeeperController.register(core, true);
+      } catch (InterruptedException e) {
+        // Restore the interrupted status
+        Thread.currentThread().interrupt();
+        log.error("", e);
+        throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "",
+            e);
+      } catch (KeeperException e) {
+        log.error("", e);
+        throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "",
+            e);
+      } catch (IOException e) {
+        log.error("", e);
+        throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "", e);
+      }
+    }
 
     if( old == null || old == core) {
       log.info( "registering core: "+name );

Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/core/SolrCore.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/core/SolrCore.java?rev=903654&r1=903653&r2=903654&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/core/SolrCore.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/core/SolrCore.java Wed Jan 27 14:12:31
2010
@@ -32,7 +32,6 @@
 import org.apache.solr.common.util.SimpleOrderedMap;
 import org.apache.solr.handler.admin.ShowFileRequestHandler;
 import org.apache.solr.handler.component.*;
-import org.apache.solr.highlight.DefaultSolrHighlighter;
 import org.apache.solr.highlight.SolrHighlighter;
 import org.apache.solr.request.*;
 import org.apache.solr.response.BinaryResponseWriter;
@@ -295,8 +294,6 @@
   List<SolrEventListener> firstSearcherListeners;
   List<SolrEventListener> newSearcherListeners;
 
-  private ZkController zooKeeperComponent;
-
 
   /**
    * NOTE: this function is not thread safe.  However, it is safe to call within the
@@ -534,28 +531,6 @@
     if (schema==null) {
       schema = new IndexSchema(config, IndexSchema.DEFAULT_SCHEMA_FILE, null);
     }
-    if (cd != null) {
-      zooKeeperComponent = cd.getCoreContainer().getZooKeeperController();
-      if (zooKeeperComponent != null) {
-        // load ZooKeeper - nocommit: somehow fall back to local configs?
-        try {
-          zooKeeperComponent.register(this, true);
-        } catch (InterruptedException e) {
-          // Restore the interrupted status
-          Thread.currentThread().interrupt();
-          log.error("", e);
-          throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
-              "", e);
-        } catch (KeeperException e) {
-          log.error("", e);
-          throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
-              "", e);
-        } catch (IOException e) {
-          log.error("", e);
-          throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "", e);
-        }
-      }
-    }
 
     //Initialize JMX
     if (config.jmxConfig.enabled) {
@@ -718,10 +693,7 @@
       return;
     }
     log.info(logid+" CLOSING SolrCore " + this);
-    // nocommit : if ZooKeeper, unregister core
-    if(zooKeeperComponent != null) {
-      zooKeeperComponent.unregister(this);
-    }
+
     try {
       infoRegistry.clear();
     } catch (Exception e) {

Modified: lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java?rev=903654&r1=903653&r2=903654&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
(original)
+++ lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
Wed Jan 27 14:12:31 2010
@@ -22,6 +22,7 @@
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.apache.solr.core.CoreDescriptor;
+import org.apache.solr.core.SolrCore;
 
 /**
  * nocommit: 
@@ -131,7 +132,8 @@
 
     h.getCoreContainer().getCore(h.getCoreContainer().getDefaultCoreName()).close();
     CoreDescriptor dcore= new CoreDescriptor( h.getCoreContainer(), "testcore", "testcore");
-    h.getCoreContainer().create(dcore);
+    SolrCore core = h.getCoreContainer().create(dcore);
+    h.getCoreContainer().register(core, false);
 
     // these queries should be exactly ordered and scores should exactly match
     query("q","*:*", "sort",i1+" desc");
@@ -235,6 +237,5 @@
     
     super.printLayout();
 
-    // Thread.sleep(10000000000L);
   }
 }



Mime
View raw message