lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsmi...@apache.org
Subject lucene-solr:solr-5750: SOLR-5750: RestoreCore should use IndexFetcher.filesToAlwaysDownloadIfNoChecksums
Date Mon, 02 May 2016 04:47:46 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/solr-5750 b073d6252 -> 7b7119dc3


SOLR-5750: RestoreCore should use IndexFetcher.filesToAlwaysDownloadIfNoChecksums


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/7b7119dc
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/7b7119dc
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/7b7119dc

Branch: refs/heads/solr-5750
Commit: 7b7119dc35f39b4d0e9b820b5b3193a776fb7b6c
Parents: b073d62
Author: David Smiley <dsmiley@apache.org>
Authored: Mon May 2 00:47:40 2016 -0400
Committer: David Smiley <dsmiley@apache.org>
Committed: Mon May 2 00:47:40 2016 -0400

----------------------------------------------------------------------
 .../org/apache/solr/handler/IndexFetcher.java   | 23 ++------------------
 .../org/apache/solr/handler/RestoreCore.java    |  4 ++--
 2 files changed, 4 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/7b7119dc/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java b/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java
index 8cdf132..224cc64 100644
--- a/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java
+++ b/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java
@@ -101,26 +101,7 @@ import org.slf4j.LoggerFactory;
 
 import static org.apache.solr.common.params.CommonParams.JAVABIN;
 import static org.apache.solr.common.params.CommonParams.NAME;
-import static org.apache.solr.handler.ReplicationHandler.ALIAS;
-import static org.apache.solr.handler.ReplicationHandler.CHECKSUM;
-import static org.apache.solr.handler.ReplicationHandler.CMD_DETAILS;
-import static org.apache.solr.handler.ReplicationHandler.CMD_GET_FILE;
-import static org.apache.solr.handler.ReplicationHandler.CMD_GET_FILE_LIST;
-import static org.apache.solr.handler.ReplicationHandler.CMD_INDEX_VERSION;
-import static org.apache.solr.handler.ReplicationHandler.COMMAND;
-import static org.apache.solr.handler.ReplicationHandler.COMPRESSION;
-import static org.apache.solr.handler.ReplicationHandler.CONF_FILES;
-import static org.apache.solr.handler.ReplicationHandler.CONF_FILE_SHORT;
-import static org.apache.solr.handler.ReplicationHandler.EXTERNAL;
-import static org.apache.solr.handler.ReplicationHandler.FILE;
-import static org.apache.solr.handler.ReplicationHandler.FILE_STREAM;
-import static org.apache.solr.handler.ReplicationHandler.GENERATION;
-import static org.apache.solr.handler.ReplicationHandler.INTERNAL;
-import static org.apache.solr.handler.ReplicationHandler.MASTER_URL;
-import static org.apache.solr.handler.ReplicationHandler.OFFSET;
-import static org.apache.solr.handler.ReplicationHandler.SIZE;
-import static org.apache.solr.handler.ReplicationHandler.TLOG_FILE;
-import static org.apache.solr.handler.ReplicationHandler.TLOG_FILES;
+import static org.apache.solr.handler.ReplicationHandler.*;
 
 /**
  * <p> Provides functionality of downloading changed index files as well as config
files and a timer for scheduling fetches from the
@@ -890,7 +871,7 @@ public class IndexFetcher {
     return bytesDownloaded;
   }
   
-  private boolean filesToAlwaysDownloadIfNoChecksums(String filename,
+  static boolean filesToAlwaysDownloadIfNoChecksums(String filename,
       long size, CompareResult compareResult) {
     // without checksums to compare, we always download .si, .liv, segments_N,
     // and any very small files

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/7b7119dc/solr/core/src/java/org/apache/solr/handler/RestoreCore.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/RestoreCore.java b/solr/core/src/java/org/apache/solr/handler/RestoreCore.java
index fcda176..34109c6 100644
--- a/solr/core/src/java/org/apache/solr/handler/RestoreCore.java
+++ b/solr/core/src/java/org/apache/solr/handler/RestoreCore.java
@@ -86,8 +86,8 @@ public class RestoreCore implements Callable<Boolean> {
           }
           long length = indexInput.length();
           IndexFetcher.CompareResult compareResult = IndexFetcher.compareFile(indexDir, filename,
length, checksum);
-          if (!compareResult.equal || (!compareResult.checkSummed && (filename.endsWith(".si")
-              || filename.endsWith(".liv") || filename.startsWith("segments_")))) {
+          if (!compareResult.equal ||
+              (IndexFetcher.filesToAlwaysDownloadIfNoChecksums(filename, length, compareResult)))
{
             restoreIndexDir.copyFrom(backupDir, filename, filename, IOContext.READONCE);
           } else {
             //prefer local copy


Mime
View raw message