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

DirectoryReader.openIfChanged(oldReader, commit) incorrectly assumes given commit point has deletes/field updates

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 4.6.1
    • Fix Version/s: 6.2, 7.0
    • Component/s: core/index
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      StandardDirectoryReader assumes that the segments from commit point have deletes, when they may not, yet the original SegmentReader for the segment that we are trying to reuse does. This is evident when running attached JUnit test case with asserts enabled (default):

      java.lang.AssertionError
      	at org.apache.lucene.index.StandardDirectoryReader.open(StandardDirectoryReader.java:188)
      	at org.apache.lucene.index.StandardDirectoryReader.doOpenIfChanged(StandardDirectoryReader.java:326)
      	at org.apache.lucene.index.StandardDirectoryReader$2.doBody(StandardDirectoryReader.java:320)
      	at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:702)
      	at org.apache.lucene.index.StandardDirectoryReader.doOpenFromCommit(StandardDirectoryReader.java:315)
      	at org.apache.lucene.index.StandardDirectoryReader.doOpenNoWriter(StandardDirectoryReader.java:311)
      	at org.apache.lucene.index.StandardDirectoryReader.doOpenIfChanged(StandardDirectoryReader.java:262)
      	at org.apache.lucene.index.DirectoryReader.openIfChanged(DirectoryReader.java:183)
      

      or, if asserts are disabled then it falls through into NPE:

      java.lang.NullPointerException
      	at java.io.File.<init>(File.java:305)
      	at org.apache.lucene.store.NIOFSDirectory.openInput(NIOFSDirectory.java:80)
      	at org.apache.lucene.codecs.lucene40.BitVector.<init>(BitVector.java:327)
      	at org.apache.lucene.codecs.lucene40.Lucene40LiveDocsFormat.readLiveDocs(Lucene40LiveDocsFormat.java:90)
      	at org.apache.lucene.index.SegmentReader.<init>(SegmentReader.java:131)
      	at org.apache.lucene.index.StandardDirectoryReader.open(StandardDirectoryReader.java:194)
      	at org.apache.lucene.index.StandardDirectoryReader.doOpenIfChanged(StandardDirectoryReader.java:326)
      	at org.apache.lucene.index.StandardDirectoryReader$2.doBody(StandardDirectoryReader.java:320)
      	at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:702)
      	at org.apache.lucene.index.StandardDirectoryReader.doOpenFromCommit(StandardDirectoryReader.java:315)
      	at org.apache.lucene.index.StandardDirectoryReader.doOpenNoWriter(StandardDirectoryReader.java:311)
      	at org.apache.lucene.index.StandardDirectoryReader.doOpenIfChanged(StandardDirectoryReader.java:262)
      	at org.apache.lucene.index.DirectoryReader.openIfChanged(DirectoryReader.java:183)
      

        Attachments

        1. CommitReuseTest.java
          3 kB
          Vitaly Funstein
        2. LUCENE-5931.patch
          2 kB
          Michael McCandless
        3. LUCENE-5931.patch
          9 kB
          Robert Muir
        4. LUCENE-5931.patch
          10 kB
          Michael McCandless
        5. LUCENE-5931.patch
          18 kB
          Michael McCandless
        6. LUCENE-5931.patch
          17 kB
          Michael McCandless

          Activity

            People

            • Assignee:
              mikemccand Michael McCandless
              Reporter:
              vfunstein Vitaly Funstein
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: