Skip to content

Apache Lucene open-source search software

SOLR-7324: IndexFetcher does not need to call isIndexStale if full copy is already needed

Varun Thackerb13658aa5d48
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index b38b2cc7b92..276076ce212 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -368,6 +368,9 @@ Optimizations
* SOLR-7239: improved performance of min & max in StatsComponent, as well as situations
where local params disable all stats (hossman)
+ * SOLR-7324: IndexFetcher does not need to call isIndexStale if full copy is already needed
+ (Stephan Lagraulet via Varun Thacker)
+
Other Changes
----------------------
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 cbe07df7284..16057f842e1 100644
--- a/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java
+++ b/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java
@@ -362,8 +362,10 @@ public class IndexFetcher {
indexDir = core.getDirectoryFactory().get(indexDirPath, DirContext.DEFAULT, core.getSolrConfig().indexConfig.lockType);
try {
-
- if (isIndexStale(indexDir)) {
+
+ //We will compare all the index files from the master vs the index files on disk to see if there is a mismatch
+ //in the metadata. If there is a mismatch for the same index file then we download the entire index again.
+ if (!isFullCopyNeeded && isIndexStale(indexDir)) {
isFullCopyNeeded = true;
}