Skip to content

Apache Lucene open-source search software

SOLR-4303: On replication, if the generation of the master is lower than the slave we need to force a full copy of the index.

Mark Robert Miller64dee0264b79
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 3b526d6a104..8d39429a9d1 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -516,6 +516,9 @@ Bug Fixes
* SOLR-4217: post.jar no longer ignores -Dparams when -Durl is used.
(Alexandre Rafalovitch, ehatcher)
+* SOLR-4303: On replication, if the generation of the master is lower than the
+ slave we need to force a full copy of the index. (Mark Miller, Gregg Donovan)
+
Other Changes
----------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/SnapPuller.java b/solr/core/src/java/org/apache/solr/handler/SnapPuller.java
index 4852d646220..08877223f5d 100644
--- a/solr/core/src/java/org/apache/solr/handler/SnapPuller.java
+++ b/solr/core/src/java/org/apache/solr/handler/SnapPuller.java
@@ -370,8 +370,10 @@ public class SnapPuller {
filesDownloaded = Collections.synchronizedList(new ArrayList<Map<String, Object>>());
// if the generateion of master is older than that of the slave , it means they are not compatible to be copied
// then a new index direcory to be created and all the files need to be copied
- boolean isFullCopyNeeded = IndexDeletionPolicyWrapper.getCommitTimestamp(commit) >= latestVersion || forceReplication;
-
+ boolean isFullCopyNeeded = IndexDeletionPolicyWrapper
+ .getCommitTimestamp(commit) >= latestVersion
+ || commit.getGeneration() >= latestGeneration || forceReplication;
+
String tmpIdxDirName = "index." + new SimpleDateFormat(SnapShooter.DATE_FMT, Locale.ROOT).format(new Date());
tmpIndex = createTempindexDir(core, tmpIdxDirName);