mirror of https://github.com/apache/lucene.git
SOLR-5150: HdfsIndexInput may not fully read requested bytes.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1523693 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
61dd81d787
commit
479234e7e3
|
@ -262,6 +262,8 @@ Bug Fixes
|
||||||
can fail if some nodes of the deleted shard were down and had incorrect logging.
|
can fail if some nodes of the deleted shard were down and had incorrect logging.
|
||||||
(Christine Poerschke, shalin)
|
(Christine Poerschke, shalin)
|
||||||
|
|
||||||
|
* SOLR-5150: HdfsIndexInput may not fully read requested bytes. (Mark Miller, Patrick Hunt)
|
||||||
|
|
||||||
Optimizations
|
Optimizations
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class HdfsDirectory extends BaseDirectory {
|
||||||
}
|
}
|
||||||
|
|
||||||
private IndexInput openInput(String name, int bufferSize) throws IOException {
|
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);
|
hdfsDirPath, name), BUFFER_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,16 +165,16 @@ public class HdfsDirectory extends BaseDirectory {
|
||||||
return configuration;
|
return configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class HdfsNormalIndexInput extends CustomBufferedIndexInput {
|
static class HdfsIndexInput extends CustomBufferedIndexInput {
|
||||||
public static Logger LOG = LoggerFactory
|
public static Logger LOG = LoggerFactory
|
||||||
.getLogger(HdfsNormalIndexInput.class);
|
.getLogger(HdfsIndexInput.class);
|
||||||
|
|
||||||
private final Path path;
|
private final Path path;
|
||||||
private final FSDataInputStream inputStream;
|
private final FSDataInputStream inputStream;
|
||||||
private final long length;
|
private final long length;
|
||||||
private boolean clone = false;
|
private boolean clone = false;
|
||||||
|
|
||||||
public HdfsNormalIndexInput(String name, FileSystem fileSystem, Path path,
|
public HdfsIndexInput(String name, FileSystem fileSystem, Path path,
|
||||||
int bufferSize) throws IOException {
|
int bufferSize) throws IOException {
|
||||||
super(name);
|
super(name);
|
||||||
this.path = path;
|
this.path = path;
|
||||||
|
@ -187,12 +187,12 @@ public class HdfsDirectory extends BaseDirectory {
|
||||||
@Override
|
@Override
|
||||||
protected void readInternal(byte[] b, int offset, int length)
|
protected void readInternal(byte[] b, int offset, int length)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
inputStream.read(getFilePointer(), b, offset, length);
|
inputStream.readFully(getFilePointer(), b, offset, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void seekInternal(long pos) throws IOException {
|
protected void seekInternal(long pos) throws IOException {
|
||||||
inputStream.seek(pos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -210,7 +210,7 @@ public class HdfsDirectory extends BaseDirectory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IndexInput clone() {
|
public IndexInput clone() {
|
||||||
HdfsNormalIndexInput clone = (HdfsNormalIndexInput) super.clone();
|
HdfsIndexInput clone = (HdfsIndexInput) super.clone();
|
||||||
clone.clone = true;
|
clone.clone = true;
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue