Skip to content

Apache Lucene open-source search software

SOLR-1126 -- Replicated files have incorrect timestamp

Shalin Shekhar Mangar354f78061379
diff --git a/CHANGES.txt b/CHANGES.txt
index c1ee9117de0..aad8eccf38b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -337,6 +337,8 @@ Bug Fixes
37. SOLR-1125: Use query analyzer rather than index analyzer for queryFieldType in QueryElevationComponent
(koji)
+
+38. SOLR-1126: Replicated files have incorrect timestamp (Jian Han Guo, Jeff Newburn, Noble Paul via shalin)
Other Changes
----------------------
diff --git a/src/java/org/apache/solr/handler/SnapPuller.java b/src/java/org/apache/solr/handler/SnapPuller.java
index 244aadbc4b0..4f2fd8a6d67 100644
--- a/src/java/org/apache/solr/handler/SnapPuller.java
+++ b/src/java/org/apache/solr/handler/SnapPuller.java
@@ -787,6 +787,9 @@ public class SnapPuller {
this.size = (Long) fileDetails.get(SIZE);
this.isConf = isConf;
this.saveAs = saveAs;
+ if(fileDetails.get(LAST_MODIFIED) != null){
+ lastmodified = (Long)fileDetails.get(LAST_MODIFIED);
+ }
indexVersion = latestVersion;
this.file = new File(snapDir, saveAs);
@@ -809,7 +812,7 @@ public class SnapPuller {
if (result == 0 || result == NO_CONTENT) {
// if the file is downloaded properly set the
// timestamp same as that in the server
- if (file.exists())
+ if (file.exists() && lastmodified > 0)
file.setLastModified(lastmodified);
return;
}