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 * SOLR-5044: Admin UI - Note on Core-Admin about directories while creating
core (steffkes) core (steffkes)
* SOLR-5134: Have HdfsIndexOutput extend BufferedIndexOutput. (Mark Miller) * SOLR-5134: Have HdfsIndexOutput extend BufferedIndexOutput.
(Mark Miller, Uwe Schindler)
Other Changes 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.IndexInput;
import org.apache.lucene.store.IndexOutput; import org.apache.lucene.store.IndexOutput;
import org.apache.lucene.store.NoLockFactory; import org.apache.lucene.store.NoLockFactory;
import org.apache.lucene.util.IOUtils;
import org.apache.solr.store.blockcache.CustomBufferedIndexInput; import org.apache.solr.store.blockcache.CustomBufferedIndexInput;
import org.apache.solr.util.IOUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -63,7 +63,7 @@ public class HdfsDirectory extends Directory {
fileSystem.mkdirs(hdfsDirPath); fileSystem.mkdirs(hdfsDirPath);
} }
} catch (Exception e) { } catch (Exception e) {
IOUtils.closeQuietly(fileSystem); org.apache.solr.util.IOUtils.closeQuietly(fileSystem);
throw new RuntimeException("Problem creating directory: " + hdfsDirPath, throw new RuntimeException("Problem creating directory: " + hdfsDirPath,
e); e);
} }
@ -225,12 +225,14 @@ public class HdfsDirectory extends Directory {
@Override @Override
public void close() throws IOException { public void close() throws IOException {
IOException priorE = null;
try { try {
super.close(); super.close();
} catch (Throwable t) { } catch (IOException ioe) {
LOG.error("Error while closing", t); priorE = ioe;
} finally {
IOUtils.closeWhileHandlingException(priorE, writer);
} }
writer.close();
} }
@Override @Override

View File

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