Skip to content

Apache Lucene open-source search software

SOLR-5150: HdfsIndexInput may not fully read requested bytes.

Mark Robert Miller479234e7e395
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 478f9b5f99c..8117e955a42 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -262,6 +262,8 @@ Bug Fixes
can fail if some nodes of the deleted shard were down and had incorrect logging.
(Christine Poerschke, shalin)
+* SOLR-5150: HdfsIndexInput may not fully read requested bytes. (Mark Miller, Patrick Hunt)
+
Optimizations
----------------------
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.java
index df1701b34bd..8e9fcb0f2e9 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
@@ -110,7 +110,7 @@ public class HdfsDirectory extends BaseDirectory {
}
private IndexInput openInput(String name, int bufferSize) throws IOException {
- return new HdfsNormalIndexInput(name, getFileSystem(), new Path(
+ return new HdfsIndexInput(name, getFileSystem(), new Path(
hdfsDirPath, name), BUFFER_SIZE);
}
@@ -165,16 +165,16 @@ public class HdfsDirectory extends BaseDirectory {
return configuration;
}
- static class HdfsNormalIndexInput extends CustomBufferedIndexInput {
+ static class HdfsIndexInput extends CustomBufferedIndexInput {
public static Logger LOG = LoggerFactory
- .getLogger(HdfsNormalIndexInput.class);
+ .getLogger(HdfsIndexInput.class);
private final Path path;
private final FSDataInputStream inputStream;
private final long length;
private boolean clone = false;
- public HdfsNormalIndexInput(String name, FileSystem fileSystem, Path path,
+ public HdfsIndexInput(String name, FileSystem fileSystem, Path path,
int bufferSize) throws IOException {
super(name);
this.path = path;
@@ -187,12 +187,12 @@ public class HdfsDirectory extends BaseDirectory {
@Override
protected void readInternal(byte[] b, int offset, int length)
throws IOException {
- inputStream.read(getFilePointer(), b, offset, length);
+ inputStream.readFully(getFilePointer(), b, offset, length);
}
@Override
protected void seekInternal(long pos) throws IOException {
- inputStream.seek(pos);
+
}
@Override
@@ -210,7 +210,7 @@ public class HdfsDirectory extends BaseDirectory {
@Override
public IndexInput clone() {
- HdfsNormalIndexInput clone = (HdfsNormalIndexInput) super.clone();
+ HdfsIndexInput clone = (HdfsIndexInput) super.clone();
clone.clone = true;
return clone;
}