SOLR-5133: HdfsUpdateLog can fail to close a FileSystem instance if init is called more than once.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1513822 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2013-08-14 11:57:20 +00:00
parent 6edd62d433
commit 2e12d5635e
2 changed files with 16 additions and 8 deletions

View File

@ -116,6 +116,10 @@ Bug Fixes
* SOLR-5119: Managed schema problems after adding fields via Schema Rest API.
(Nils Kübler, Steve Rowe)
* SOLR-5133: HdfsUpdateLog can fail to close a FileSystem instance if init
is called more than once. (Mark Miller)
Optimizations
----------------------

View File

@ -42,22 +42,18 @@ import org.apache.solr.util.IOUtils;
/** @lucene.experimental */
public class HdfsUpdateLog extends UpdateLog {
private FileSystem fs;
private Path tlogDir;
private String confDir;
private volatile FileSystem fs;
private volatile Path tlogDir;
private final String confDir;
public HdfsUpdateLog() {
this.confDir = null;
}
public HdfsUpdateLog(String confDir) {
this.confDir = confDir;
}
public FileSystem getFs() {
return fs;
}
// HACK
// while waiting for HDFS-3107, instead of quickly
// dropping, we slowly apply
@ -117,6 +113,14 @@ public class HdfsUpdateLog extends UpdateLog {
}
}
try {
if (fs != null) {
fs.close();
}
} catch (IOException e) {
throw new SolrException(ErrorCode.SERVER_ERROR, e);
}
try {
fs = FileSystem.newInstance(new Path(dataDir).toUri(), getConf());
} catch (IOException e) {