You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2012/02/24 19:19:25 UTC

svn commit: r1293371 - /lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/SnapPuller.java

Author: markrmiller
Date: Fri Feb 24 18:19:25 2012
New Revision: 1293371

URL: http://svn.apache.org/viewvc?rev=1293371&view=rev
Log:
take care of small bug around NRT and replication

Modified:
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/SnapPuller.java

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/SnapPuller.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/SnapPuller.java?rev=1293371&r1=1293370&r2=1293371&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/SnapPuller.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/SnapPuller.java Fri Feb 24 18:19:25 2012
@@ -495,10 +495,24 @@ public class SnapPuller {
   private void doCommit() throws IOException {
     SolrQueryRequest req = new LocalSolrQueryRequest(solrCore,
         new ModifiableSolrParams());
+    // reboot the writer on the new index and get a new searcher
+    solrCore.getUpdateHandler().newIndexWriter();
+    
     try {
-      
-      // reboot the writer on the new index and get a new searcher
-      solrCore.getUpdateHandler().newIndexWriter();
+      // first try to open an NRT searcher so that the new 
+      // IndexWriter is registered with the reader
+      Future[] waitSearcher = new Future[1];
+      solrCore.getSearcher(true, false, waitSearcher, true);
+      if (waitSearcher[0] != null) {
+        try {
+         waitSearcher[0].get();
+       } catch (InterruptedException e) {
+         SolrException.log(LOG,e);
+       } catch (ExecutionException e) {
+         SolrException.log(LOG,e);
+       }
+     }
+
       // update our commit point to the right dir
       solrCore.getUpdateHandler().commit(new CommitUpdateCommand(req, false));