Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-9264

Remove SimpleFSDirectory in favor of NIOFsDirectory

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 9.0
    • None
    • None
    • New

    Description

      SimpleFSDirectory looks to duplicate what's already offered by NIOFsDirectory. The only difference is that SimpleFSDirectory is using non-positional reads on the FileChannel (i.e., reads that are stateful, changing the current position), and SimpleFSDirectory therefore has to externally synchronize access to the read method.

      On Windows, positional reads are not supported, which is why FileChannel is already internally using synchronization to guarantee only access by one thread at a time for positional reads (see read(ByteBuffer dst, long position) in FileChannelImpl, and FileDispatcher.needsPositionLock, which returns true on Windows) and the JDK implementation for Windows is emulating positional reads by using non-positional ones, see http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/windows/native/sun/nio/ch/FileDispatcherImpl.c#l139.

      This means that on Windows, there should be no difference between NIOFsDirectory and SimpleFSDirectory in terms of performance (it should be equally poor as both implementations only allow one thread at a time to read). On Linux/Mac, NIOFsDirectory is superior to SimpleFSDirectory, however, as positional reads (pread) can be done concurrently.

      My proposal is to remove SimpleFSDirectory and replace its uses with NIOFsDirectory, given how similar these two directory implementations are (SimpleFSDirectory isn't really simpler).

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ywelsch Yannick Welsch
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 50m
                  50m