lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r1209234 - in /lucene/dev/branches/solrcloud/solr: core/src/java/org/apache/solr/cloud/ core/src/java/org/apache/solr/update/ core/src/java/org/apache/solr/update/processor/ core/src/test-files/solr/conf/ core/src/test/org/apache/solr/cloud...
Date Thu, 01 Dec 2011 20:55:45 GMT
Author: markrmiller
Date: Thu Dec  1 20:55:44 2011
New Revision: 1209234

URL: http://svn.apache.org/viewvc?rev=1209234&view=rev
Log:
change replay to specify LEADER_SEEN=true and other minor test tweaks

Modified:
    lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/cloud/RecoveryStrat.java
    lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/FSUpdateLog.java
    lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
    lucene/dev/branches/solrcloud/solr/core/src/test-files/solr/conf/solrconfig-distrib-update.xml
    lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/RecoveryZkTest.java
    lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java

Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/cloud/RecoveryStrat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/cloud/RecoveryStrat.java?rev=1209234&r1=1209233&r2=1209234&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/cloud/RecoveryStrat.java
(original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/cloud/RecoveryStrat.java
Thu Dec  1 20:55:44 2011
@@ -22,6 +22,7 @@ import java.util.concurrent.Future;
 
 import org.apache.lucene.search.MatchAllDocsQuery;
 import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
 import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.core.SolrCore;
@@ -73,6 +74,15 @@ public class RecoveryStrat {
             // wait for replay
             future.get();
           }
+          System.out.println("replay done");
+          EmbeddedSolrServer server = new EmbeddedSolrServer(core);
+          server.commit();
+          
+          RefCounted<SolrIndexSearcher> searcher = core.getSearcher(true, true,
+              null);
+          System.out.println("DOCS AFTER REPLAY:"
+              + searcher.get().search(new MatchAllDocsQuery(), 1).totalHits);
+          searcher.decref();
           if (recoveryListener != null) recoveryListener.finishedRecovery();
           onFinish.run();
         } catch (SolrServerException e) {
@@ -114,12 +124,7 @@ public class RecoveryStrat {
       // nocommit: require /update?
       
       CommonsHttpSolrServer server = new CommonsHttpSolrServer(leaderUrl);
-      
-      ModifiableSolrParams params = new ModifiableSolrParams();
-      
-      params.set("commit", true);
-      params.set("qt", "/update");
-      server.query(params);
+      server.commit(false, false);
       
       // use rep handler directly, so we can do this sync rather than async
       

Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/FSUpdateLog.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/FSUpdateLog.java?rev=1209234&r1=1209233&r2=1209234&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/FSUpdateLog.java
(original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/FSUpdateLog.java
Thu Dec  1 20:55:44 2011
@@ -18,17 +18,16 @@
 package org.apache.solr.update;
 
 import org.apache.lucene.util.BytesRef;
-import org.apache.solr.client.solrj.SolrRequest;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.params.ModifiableSolrParams;
-import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.core.PluginInfo;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.request.LocalSolrQueryRequest;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.response.SolrQueryResponse;
+import org.apache.solr.update.processor.DistributedUpdateProcessor;
 import org.apache.solr.update.processor.DistributedUpdateProcessorFactory;
 import org.apache.solr.update.processor.RunUpdateProcessorFactory;
 import org.apache.solr.update.processor.UpdateRequestProcessor;
@@ -610,7 +609,8 @@ public class FSUpdateLog extends UpdateL
 
         tlogReader = translog.getReader();
 
-        SolrParams params = new ModifiableSolrParams();
+        ModifiableSolrParams params = new ModifiableSolrParams();
+        params.set(DistributedUpdateProcessor.SEEN_LEADER, true);
         SolrQueryRequest req = new LocalSolrQueryRequest(uhandler.core, params);
         SolrQueryResponse rsp = new SolrQueryResponse();
 

Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java?rev=1209234&r1=1209233&r2=1209234&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
(original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
Thu Dec  1 20:55:44 2011
@@ -244,8 +244,9 @@ public class DistributedUpdateProcessor 
     if (shards != null) {
       cmdDistrib.distribAdd(cmd, shards);
     } else {
-      // At a minimum, local updates must be protected by synchronization
-      // super.processAdd(cmd);
+      // nocommit: At a minimum, local updates must be protected by synchronization
+      // right now we count on versionAdd to do the local add
+      //super.processAdd(cmd);
     }
     
     

Modified: lucene/dev/branches/solrcloud/solr/core/src/test-files/solr/conf/solrconfig-distrib-update.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test-files/solr/conf/solrconfig-distrib-update.xml?rev=1209234&r1=1209233&r2=1209234&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test-files/solr/conf/solrconfig-distrib-update.xml
(original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test-files/solr/conf/solrconfig-distrib-update.xml
Thu Dec  1 20:55:44 2011
@@ -41,6 +41,10 @@
 	<requestHandler name="/replication" class="solr.ReplicationHandler">
 
     </requestHandler>
+    
+    <query>
+    	<maxWarmingSearchers>4</maxWarmingSearchers>
+    </query>
 
     <requestHandler name="/update"     class="solr.XmlUpdateRequestHandler"          />
 

Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/RecoveryZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/RecoveryZkTest.java?rev=1209234&r1=1209233&r2=1209234&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/RecoveryZkTest.java
(original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/cloud/RecoveryZkTest.java
Thu Dec  1 20:55:44 2011
@@ -35,7 +35,7 @@ import org.junit.Ignore;
 /**
  *
  */
-@Ignore
+@Ignore("this test still fails sometimes - it seems usually due to replay failing")
 public class RecoveryZkTest extends FullDistributedZkTest {
 
   
@@ -70,14 +70,17 @@ public class RecoveryZkTest extends Full
     
     class StopableThread extends Thread {
       private volatile boolean stop = false;
+      private int startI;
       
-      {
+      
+      public StopableThread(int startI) {
+        this.startI = startI;
         setDaemon(true);
       }
       
       @Override
       public void run() {
-        int i = 0;
+        int i = startI;
         while (true && !stop) {
           try {
             indexr(id, i++, i1, 50, tlong, 50, t1,
@@ -94,10 +97,10 @@ public class RecoveryZkTest extends Full
       
     };
     
-    StopableThread indexThread = new StopableThread();
+    StopableThread indexThread = new StopableThread(0);
     indexThread.start();
     
-    StopableThread indexThread2 = new StopableThread();
+    StopableThread indexThread2 = new StopableThread(10000);
     
     indexThread2.start();
 
@@ -112,12 +115,15 @@ public class RecoveryZkTest extends Full
     // wait a moment - lets allow some docs to be indexed so replication time is non 0
     Thread.sleep(4000);
 
+    final CountDownLatch recoveryLatch = new CountDownLatch(1);
+
+    
     // bring shard replica up
     replica.start();
     
-    final CountDownLatch recoveryLatch = new CountDownLatch(1);
     RecoveryStrat recoveryStrat = ((SolrDispatchFilter) replica.getDispatchFilter().getFilter()).getCores()
         .getZkController().getRecoveryStrat();
+    
     recoveryStrat.setRecoveryListener(new RecoveryListener() {
       
       @Override
@@ -134,8 +140,8 @@ public class RecoveryZkTest extends Full
     
     
     // wait for recovery to finish
-    // if it takes over 30 seconds, assume we didnt get our listener attached before
-    // recover finished
+    // if it takes over n seconds, assume we didnt get our listener attached before
+    // recover started - it should be done before n though
     recoveryLatch.await(30, TimeUnit.SECONDS);
     
     // stop indexing threads
@@ -145,8 +151,10 @@ public class RecoveryZkTest extends Full
     indexThread.join();
     indexThread2.join();
     
-    commit();
     
+    System.out.println("commit");
+    commit();
+
     // test that leader and replica have same doc count
     
     long client1Docs = shardToClient.get("shard1").get(0).query(new SolrQuery("*:*")).getResults().getNumFound();
@@ -154,7 +162,7 @@ public class RecoveryZkTest extends Full
     
     assertTrue(client1Docs > 0);
     assertEquals(client1Docs, client2Docs);
-    Thread.sleep(2000);
+ 
     // TODO: right now the control and distrib are usually off by a few docs...
     //query("q", "*:*", "distrib", true, "sort", i1 + " desc");
   }
@@ -169,6 +177,13 @@ public class RecoveryZkTest extends Full
     ureq.process(cloudClient);
   }
   
+  protected void indexr(Object... fields) throws Exception {
+    SolrInputDocument doc = new SolrInputDocument();
+    addFields(doc, fields);
+    addFields(doc, "rnd_b", true);
+    indexDoc(doc);
+  }
+  
   @Override
   public void tearDown() throws Exception {
     super.tearDown();

Modified: lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java?rev=1209234&r1=1209233&r2=1209234&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
(original)
+++ lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
Thu Dec  1 20:55:44 2011
@@ -51,7 +51,7 @@ public class ZkStateReader {
   public static final String RECOVERING = "recovering";
   public static final String ACTIVE = "active";
   
-  private volatile CloudState cloudState = new CloudState();
+  private volatile CloudState cloudState;
 
   private static final long CLOUD_UPDATE_DELAY = Long.parseLong(System.getProperty("CLOUD_UPDATE_DELAY",
"5000"));
 
@@ -192,7 +192,6 @@ public class ZkStateReader {
                 CloudState clusterState = new CloudState(liveNodesSet, cloudState.getCollectionStates());
                 // update volatile
                 cloudState = clusterState;
-                System.out.println("UPDATE CLUSTER STATE TO:" + cloudState);
               }
             } catch (KeeperException e) {
               if (e.code() == KeeperException.Code.SESSIONEXPIRED
@@ -216,7 +215,6 @@ public class ZkStateReader {
     liveNodeSet.addAll(liveNodes);
     clusterState = CloudState.load(zkClient, liveNodeSet);
     this.cloudState = clusterState;
-    System.out.println("UPDATE CLUSTER STATE TO:" + cloudState);
   }
   
   



Mime
View raw message