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

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1418789 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2012-12-09 00:12:03 +00:00
parent 6a11fd8db6
commit 452a32f314

View File

@ -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);