You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Rahul Goswami <ra...@gmail.com> on 2021/10/24 04:04:33 UTC

Any downsides to using RAFDirectory instead of SimpleFSDirectory ?

Hello,
I posted this question on the java-lucene group but not sure if my email
was noticed/made it through. Hence posting here. Apologies if this is
against the guidelines/best practices.

I am running Solr on a Windows server and mmap doesn't quite work well
there, so I have been using SimpleFS.

It was working well for the most part, but we recently encountered
ClosedChannelException due to the file descriptor getting closed during IO.
From the java doc of SimpleFSDirectory...

https://lucene.apache.org/core/7_7_2/core/org/apache/lucene/store/SimpleFSDirectory.html
*NOTE:* Accessing this class either directly or indirectly from a thread
while it's interrupted can close the underlying file descriptor immediately
if at the same time the thread is blocked on IO. The file descriptor will
remain closed and subsequent access to SimpleFSDirectory
<https://lucene.apache.org/core/7_7_2/core/org/apache/lucene/store/SimpleFSDirectory.html>
will
throw a ClosedChannelException
<https://docs.oracle.com/javase/8/docs/api/java/nio/channels/ClosedChannelException.html?is-external=true>.
If your application uses either Thread.interrupt()
<https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html?is-external=true#interrupt-->
 or Future.cancel(boolean)
<https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Future.html?is-external=true#cancel-boolean->
you
should use the legacy RAFDirectory from the Lucene misc module in favor of
SimpleFSDirectory
<https://lucene.apache.org/core/7_7_2/core/org/apache/lucene/store/SimpleFSDirectory.html>
.


We eventually found the culprit interrupting call, but it led me to
thinking if RAFDirectory is in general a worthy replacement for SimpleFS.
Are there any downsides to RAFDirectory (vs SimpleFS) due to which it is
considered legacy?

Thanks.,
Rahul