From 64dee0264b799d4a22d34d7edb988b18531c9d6e Mon Sep 17 00:00:00 2001 From: Mark Robert Miller Date: Mon, 14 Jan 2013 17:08:50 +0000 Subject: [PATCH] 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. git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1432993 13f79535-47bb-0310-9956-ffa450edef68 --- solr/CHANGES.txt | 3 +++ solr/core/src/java/org/apache/solr/handler/SnapPuller.java | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) 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>()); // 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);