SOLR-5134: Fix CHANGES and close

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1513859 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2013-08-14 13:02:22 +00:00
parent ea5e5616f0
commit b03231693d
3 changed files with 11 additions and 7 deletions

View File

@ -126,7 +126,8 @@ Optimizations
* SOLR-5044: Admin UI - Note on Core-Admin about directories while creating
core (steffkes)
* SOLR-5134: Have HdfsIndexOutput extend BufferedIndexOutput. (Mark Miller)
* SOLR-5134: Have HdfsIndexOutput extend BufferedIndexOutput.
(Mark Miller, Uwe Schindler)
Other Changes
----------------------

View File

@ -34,8 +34,8 @@ import org.apache.lucene.store.IOContext;
import org.apache.lucene.store.IndexInput;
import org.apache.lucene.store.IndexOutput;
import org.apache.lucene.store.NoLockFactory;
import org.apache.lucene.util.IOUtils;
import org.apache.solr.store.blockcache.CustomBufferedIndexInput;
import org.apache.solr.util.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -63,7 +63,7 @@ public class HdfsDirectory extends Directory {
fileSystem.mkdirs(hdfsDirPath);
}
} catch (Exception e) {
IOUtils.closeQuietly(fileSystem);
org.apache.solr.util.IOUtils.closeQuietly(fileSystem);
throw new RuntimeException("Problem creating directory: " + hdfsDirPath,
e);
}
@ -225,12 +225,14 @@ public class HdfsDirectory extends Directory {
@Override
public void close() throws IOException {
IOException priorE = null;
try {
super.close();
} catch (Throwable t) {
LOG.error("Error while closing", t);
} catch (IOException ioe) {
priorE = ioe;
} finally {
IOUtils.closeWhileHandlingException(priorE, writer);
}
writer.close();
}
@Override

View File

@ -17,6 +17,7 @@ package org.apache.solr.store.hdfs;
* limitations under the License.
*/
import java.io.Closeable;
import java.io.IOException;
import java.util.EnumSet;
@ -31,7 +32,7 @@ import org.apache.lucene.store.DataOutput;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HdfsFileWriter extends DataOutput {
public class HdfsFileWriter extends DataOutput implements Closeable {
public static Logger LOG = LoggerFactory.getLogger(HdfsFileWriter.class);
public static final String HDFS_SYNC_BLOCK = "solr.hdfs.sync.block";