Thanks for checking back here...
I ran this directory on Linux and hit a number of test failures, from
two bugs in the directory impl. First,
NativeUnixIndexInput.fileLength() failed to include bytes still in the
buffer; second, on clone, if the current II was positioned at EOF
and EOF was on a (512 byte) page boundary then we'd hit
a false IOE. I fixed those...
I also changed NativeUnixDir to take a delegate Dir which we fall back
to when we don't want to use direct IO; this enabled removing of
open_normal since we just use the "normal" java Dir impls for this.
To run all tests on Linux I do this:
ant test-core -Dtests.directory=NativeUnixDirectory
(Change the path to your full path... or maybe use relative path but
that could be dangerous since tests may change the CWD... not sure).
It also requires a temporary ctor in the directory taking only File
and using FSDirectory.open for the delegate directory.
Finally I added another setting, minBytesDirect: if the file to open
(in openInput), or expected merge size (in createOutput), is smaller
than this, then we don't use direct IO.
To test this... I temporarily fixed the dir to always use direct IO,
and tests (eventually: ~75 minutes!) passed, except for some Solr tests which look
like timeout problems. I temporarily dropped the default
buffer size to 4 KB (from 256 KB) else the JVM ran out of direct
I'll test on OS X as well...