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

Remove write access from SegmentReader and possibly move to separate class or IndexWriter/BufferedDeletes/...

    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.0-ALPHA
    • None
    • core/index
    • None
    • New

    Description

      After LUCENE-3606 is finished, there are some TODOs:

      SegmentReader still contains (package-private) all delete logic including crazy copyOnWrite for validDocs Bits. It would be good, if SegmentReader itsself could be read-only like all other IndexReaders.

      There are two possibilities to do this:

      1. the simple one: Subclass SegmentReader and make a RWSegmentReader that is only used by IndexWriter/BufferedDeletes/... DirectoryReader will only use the read-only SegmentReader. This would move all TODOs to a separate class. It's reopen/clone method would always create a RO-SegmentReader (for NRT).
      2. Remove all write and commit stuff from SegmentReader completely and move it to IndexWriter's readerPool (it must be in readerPool as deletions need a not-changing view on an index snapshot).

      Unfortunately the code is so complicated and I have no real experience in those internals of IndexWriter so I did not want to do it with LUCENE-3606, I just separated the code in SegmentReader and marked with TODO. Maybe Mike McCandless can help

      Attachments

        1. LUCENE-3631.patch
          111 kB
          Michael McCandless
        2. LUCENE-3631.patch
          111 kB
          Michael McCandless
        3. LUCENE-3631-threadlocals.patch
          5 kB
          Uwe Schindler

        Activity

          People

            mikemccand Michael McCandless
            uschindler Uwe Schindler
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: