Lucene - Core
  1. Lucene - Core
  2. LUCENE-2045

FNFE hit when creating an empty index and infoStream is on

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.9.3, 3.0.2, 3.1, 4.0-ALPHA
    • Component/s: core/index
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      Shai just reported this on the dev list. Simple test:

      Directory dir = new RAMDirectory();
      IndexWriter writer = new IndexWriter(dir, new SimpleAnalyzer(), MaxFieldLength.UNLIMITED);
      writer.setInfoStream(System.out);
      writer.addDocument(new Document());
      writer.commit();
      writer.close();
      

      hits this:

      Exception in thread "main" java.io.FileNotFoundException: _0.prx
          at org.apache.lucene.store.RAMDirectory.fileLength(RAMDirectory.java:149)
          at org.apache.lucene.index.DocumentsWriter.segmentSize(DocumentsWriter.java:1150)
          at org.apache.lucene.index.DocumentsWriter.flush(DocumentsWriter.java:587)
          at org.apache.lucene.index.IndexWriter.doFlushInternal(IndexWriter.java:3572)
          at org.apache.lucene.index.IndexWriter.doFlush(IndexWriter.java:3483)
          at org.apache.lucene.index.IndexWriter.flush(IndexWriter.java:3474)
          at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1940)
          at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1894)
      

      Turns out it's just silly – this is actually an issue I've already fixed on the flex (LUCENE-1458) branch. DocumentsWriter has its own method to enumerate the flushed files and compute their size, but really it shouldn't do that – it should use SegmentInfo's method, instead.

        Activity

        Hide
        Michael McCandless added a comment -

        Thanks Shai!

        Show
        Michael McCandless added a comment - Thanks Shai!
        Hide
        Michael McCandless added a comment -

        Reopening for possible future 2.9.2 backport.

        Show
        Michael McCandless added a comment - Reopening for possible future 2.9.2 backport.
        Hide
        Uwe Schindler added a comment -

        To get rid of this issue (marked as fix for 3.0) – merge this to 2.9 in revision: 834829

        Show
        Uwe Schindler added a comment - To get rid of this issue (marked as fix for 3.0) – merge this to 2.9 in revision: 834829
        Hide
        Michael McCandless added a comment -

        Thanks Uwe!

        Show
        Michael McCandless added a comment - Thanks Uwe!
        Hide
        Michael McCandless added a comment -

        backport

        Show
        Michael McCandless added a comment - backport
        Hide
        Michael McCandless added a comment -

        Oh, already fixed on 2.9.x, 3.0.x.

        Show
        Michael McCandless added a comment - Oh, already fixed on 2.9.x, 3.0.x.

          People

          • Assignee:
            Michael McCandless
            Reporter:
            Michael McCandless
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development