problem with Direct IO seek() leading to EOFException [LUCENE-5071]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
I think this actually affects 3.1.0 and up, but I was too lazy to type all those out and just included release versions for brevity.
DirectIOLinuxIndexInput in 3.6.2 and NativeUnixIndexInput in 4.3.1 have in issue with the seek() method. If we seek() to the end of a file (can happen when merger is doing a clone()) whose length is a multiple of 512, then we will unnecessarily call refill(), which will throw an EOFException.
Quick fix is to surround refill() with this condition:
if (pos < length()) {
refill();
}
---
Migrated from [LUCENE-5071](https://issues.apache.org/jira/browse/LUCENE-5071) by Stephen Macke
Environment:
```
Linux kernel 3.2.0-48-generic
jdk 1.6.0_43
```
Contributor guide
Research direction
Inspect DirectIOLinuxIndexInput in 3.6.2 and NativeUnixIndexInput in 4.3.1, focusing on seek() and refill(). Reproduce the EOF seek with a file whose length is a multiple of 512; done means seeking to the file end no longer throws EOFException during the clone-related case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100