Apache Lucene open-source search software
SOLR-4916: Fix bugs & usage of NullIndexOutput
Uwe Schindler748cb61e824f
diff --git a/solr/core/src/java/org/apache/solr/store/hdfs/HdfsDirectory.java b/solr/core/src/java/org/apache/solr/store/hdfs/HdfsDirectory.javaindex 47c0230352c..a4ef9155799 100644--- a/solr/core/src/java/org/apache/solr/store/hdfs/HdfsDirectory.java+++ b/solr/core/src/java/org/apache/solr/store/hdfs/HdfsDirectory.java@@ -45,7 +45,6 @@ public class HdfsDirectory extends Directory {private static final String LF_EXT = ".lf";protected static final String SEGMENTS_GEN = "segments.gen";- protected static final IndexOutput NULL_WRITER = new NullIndexOutput();protected Path hdfsDirPath;protected Configuration configuration;@@ -79,7 +78,7 @@ public class HdfsDirectory extends Directory {public IndexOutput createOutput(String name, IOContext context)throws IOException {if (SEGMENTS_GEN.equals(name)) {- return NULL_WRITER;+ return new NullIndexOutput();}HdfsFileWriter writer = new HdfsFileWriter(getFileSystem(), new Path(hdfsDirPath, name));diff --git a/solr/core/src/java/org/apache/solr/store/hdfs/NullIndexOutput.java b/solr/core/src/java/org/apache/solr/store/hdfs/NullIndexOutput.javaindex 02953859623..044687c41d4 100644--- a/solr/core/src/java/org/apache/solr/store/hdfs/NullIndexOutput.java+++ b/solr/core/src/java/org/apache/solr/store/hdfs/NullIndexOutput.java@@ -49,6 +49,7 @@ public class NullIndexOutput extends IndexOutput {@Overridepublic void writeByte(byte b) throws IOException {pos++;+ updateLength();}@Override