apache / apache/lucene

NativeUnixDirectory is broken [LUCENE-5561]

Open
#6,623 6 comments 0 reactions 1 assignee Claimed by @mikemccand View on GitHub
legacy-jira-fix-version:4.9 legacy-jira-fix-version:6.0 legacy-jira-priority:Major type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

Several things:

- It assumed ByteBuffer.allocateDirect would be page-aligned, but
that's no longer true in Java 1.7

- It failed to throw FNFE if a file didn't exist (throw IOExc
instead)

- It didn't have a default ctor taking File (so it was hard to run
all tests against it)

- It didn't have a test case

- Some Javadocs problems

- I cutover to FilterDirectory

I tried to cutover to BufferedIndexOutput since this is essentially
all that NativeUnixIO is doing ... but it's not simple because BIO
sometimes flushes non-full (non-aligned) buffers even before the end
of the file (its writeBytes method).

I also factored out a BaseDirectoryTestCase, and tried to fold in
"generic" Directory tests, and added/cutover explicit tests for the
core directory impls.

---
Migrated from [LUCENE-5561](https://issues.apache.org/jira/browse/LUCENE-5561) by Michael McCandless (@mikemccand), updated May 09 2016
Attachments: [LUCENE-5561.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-5561/LUCENE-5561.patch) (versions: 2)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.