Apache Lucene open-source search software
SOLR-11920: Adding a file exists check before skipping a file for replication
Ishan Chattopadhyaya72ee0f64d4ea
diff --git a/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java b/solr/core/src/java/org/apache/solr/handler/IndexFetcher.javaindex 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