Skip to content

Apache Lucene open-source search software

SOLR-3911: sync properties files after write so that they are written out before the directory is closed.

Mark Robert Miller452a32f31419
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 1e5ad0c2a09..8b9ef7bf8b8 100644
--- a/solr/core/src/java/org/apache/solr/handler/SnapPuller.java
+++ b/solr/core/src/java/org/apache/solr/handler/SnapPuller.java
@@ -110,6 +110,8 @@ import org.slf4j.LoggerFactory;
* @since solr 1.4
*/
public class SnapPuller {
+ private static final String INDEX_PEROPERTIES = "index.peroperties";
+
private static final Logger LOG = LoggerFactory.getLogger(SnapPuller.class.getName());
private final String masterUrl;
@@ -570,6 +572,7 @@ public class SnapPuller {
OutputStream outFile = new PropertiesOutputStream(out);
try {
props.store(outFile, "Replication details");
+ dir.sync(Collections.singleton(REPLICATION_PROPERTIES));
} finally {
IOUtils.closeQuietly(outFile);
}
@@ -863,6 +866,7 @@ public class SnapPuller {
try {
os = new PropertiesOutputStream(out);
p.store(os, "index properties");
+ dir.sync(Collections.singleton(INDEX_PEROPERTIES));
} catch (Exception e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
"Unable to write index.properties", e);