lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r993109 - in /lucene/solr/branches/branch-1.4: CHANGES.txt src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java src/java/org/apache/solr/handler/ReplicationHandler.java
Date Mon, 06 Sep 2010 17:43:02 GMT
Author: yonik
Date: Mon Sep  6 17:43:02 2010
New Revision: 993109

URL: http://svn.apache.org/viewvc?rev=993109&view=rev
Log:
SOLR-2100: fix saveCommitPoint

Modified:
    lucene/solr/branches/branch-1.4/CHANGES.txt
    lucene/solr/branches/branch-1.4/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java
    lucene/solr/branches/branch-1.4/src/java/org/apache/solr/handler/ReplicationHandler.java

Modified: lucene/solr/branches/branch-1.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/branches/branch-1.4/CHANGES.txt?rev=993109&r1=993108&r2=993109&view=diff
==============================================================================
--- lucene/solr/branches/branch-1.4/CHANGES.txt (original)
+++ lucene/solr/branches/branch-1.4/CHANGES.txt Mon Sep  6 17:43:02 2010
@@ -54,6 +54,11 @@ Bug Fixes
 * SOLR-2036: Avoid expensive fieldCache ram estimation for the
   admin stats page. (yonik)
 
+* SOLR-2100: The replication handler backup command didn't save the commit
+  point and hence could fail when a newer commit caused the older commit point
+  to be removed before it was finished being copied.  This did not affect
+  normal master/slave replication.  (Peter Sturge via yonik)
+
 
 ================== Release 1.4.1 ==================
 Release Date:  See http://lucene.apache.org/solr for the official release date.

Modified: lucene/solr/branches/branch-1.4/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/branch-1.4/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java?rev=993109&r1=993108&r2=993109&view=diff
==============================================================================
--- lucene/solr/branches/branch-1.4/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java
(original)
+++ lucene/solr/branches/branch-1.4/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java
Mon Sep  6 17:43:02 2010
@@ -107,6 +107,7 @@ public class IndexDeletionPolicyWrapper 
     AtomicInteger reserveCount = savedCommits.get(indexCommitVersion);
     if (reserveCount == null) reserveCount = new AtomicInteger();
     reserveCount.incrementAndGet();
+    savedCommits.put(indexCommitVersion, reserveCount);
   }
 
   /** Release a previously saved commit point */
@@ -167,7 +168,7 @@ public class IndexDeletionPolicyWrapper 
       Long version = delegate.getVersion();
       Long reserve = reserves.get(version);
       if (reserve != null && System.currentTimeMillis() < reserve) return;
-      if(savedCommits.contains(version)) return;
+      if(savedCommits.containsKey(version)) return;
       delegate.delete();
     }
 

Modified: lucene/solr/branches/branch-1.4/src/java/org/apache/solr/handler/ReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/branch-1.4/src/java/org/apache/solr/handler/ReplicationHandler.java?rev=993109&r1=993108&r2=993109&view=diff
==============================================================================
--- lucene/solr/branches/branch-1.4/src/java/org/apache/solr/handler/ReplicationHandler.java
(original)
+++ lucene/solr/branches/branch-1.4/src/java/org/apache/solr/handler/ReplicationHandler.java
Mon Sep  6 17:43:02 2010
@@ -278,8 +278,6 @@ public class ReplicationHandler extends 
     try {
       IndexDeletionPolicyWrapper delPolicy = core.getDeletionPolicy();
       IndexCommit indexCommit = delPolicy.getLatestCommit();
-      // race?
-      delPolicy.setReserveDuration(indexCommit.getVersion(), reserveCommitDuration);
       if(indexCommit == null) {
         indexCommit = req.getSearcher().getReader().getIndexCommit();
       }
@@ -791,14 +789,14 @@ public class ReplicationHandler extends 
       }
       List backup = master.getAll("backupAfter");
       boolean backupOnCommit = backup.contains("commit");
-      boolean backupOnOptimize = backup.contains("optimize");
+      boolean backupOnOptimize = !backupOnCommit && backup.contains("optimize");
       List replicateAfter = master.getAll(REPLICATE_AFTER);
       replicateOnCommit = replicateAfter.contains("commit");
-      replicateOnOptimize = replicateAfter.contains("optimize");
+      replicateOnOptimize = !replicateOnCommit && replicateAfter.contains("optimize");
 
       // if we only want to replicate on optimize, we need the deletion policy to
       // save the last optimized commit point.
-      if (replicateOnOptimize && !replicateOnCommit) {
+      if (replicateOnOptimize) {
         IndexDeletionPolicyWrapper wrapper = core.getDeletionPolicy();
         IndexDeletionPolicy policy = wrapper == null ? null : wrapper.getWrappedDeletionPolicy();
         if (policy instanceof SolrDeletionPolicy) {
@@ -825,7 +823,7 @@ public class ReplicationHandler extends 
           IndexReader reader = s==null ? null : s.get().getReader();
           if (reader!=null && reader.getIndexCommit() != null && reader.getIndexCommit().getGeneration()
!= 1L) {
             try {
-              if(!replicateOnCommit && replicateOnOptimize){
+              if(replicateOnOptimize){
                 Collection<IndexCommit> commits = IndexReader.listCommits(reader.directory());
                 for (IndexCommit ic : commits) {
                   if(ic.isOptimized()){



Mime
View raw message