From 72ee0f64d4eaad9f81ff9730ebfbc466548586e4 Mon Sep 17 00:00:00 2001 From: Ishan Chattopadhyaya Date: Tue, 17 Apr 2018 10:48:36 +0530 Subject: [PATCH] SOLR-11920: Adding a file exists check before skipping a file for replication --- solr/core/src/java/org/apache/solr/handler/IndexFetcher.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 3c6859bc66a..9fde19c93da 100644 --- a/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java +++ b/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java @@ -1037,8 +1037,9 @@ public class IndexFetcher { boolean alwaysDownload = filesToAlwaysDownloadIfNoChecksums(filename, size, compareResult); LOG.debug("Downloading file={} size={} checksum={} alwaysDownload={}", filename, size, file.get(CHECKSUM), alwaysDownload); if (!compareResult.equal || downloadCompleteIndex || alwaysDownload) { - if (downloadCompleteIndex && doDifferentialCopy && compareResult.equal && compareResult.checkSummed) { - File localFile = new File(indexDirPath, filename); + File localFile = new File(indexDirPath, filename); + if (downloadCompleteIndex && doDifferentialCopy && compareResult.equal && compareResult.checkSummed + && localFile.exists()) { LOG.info("Don't need to download this file. Local file's path is: {}, checksum is: {}", localFile.getAbsolutePath(), file.get(CHECKSUM)); // A hard link here should survive the eventual directory move, and should be more space efficient as