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

IndexWriter commits unnecessarily on fresh Directory


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


      I've noticed IndexWriter's ctor commits a first commit (empty one) if a fresh Directory is passed, w/ OpenMode.CREATE or CREATE_OR_APPEND. This seems unnecessarily, and kind of brings back an autoCommit mode, in a strange way ... why do we need that commit? Do we really expect people to open an IndexReader on an empty Directory which they just passed to an IW w/ create=true? If they want, they can simply call commit() right away on the IW they created.

      I ran into this when writing a test which committed N times, then compared the number of commits (via IndexReader.listCommits) and was surprised to see N+1 commits.

      Tried to change doCommit to false in IW ctor, but it got IndexFileDeleter jumping on me .. so the change might not be that simple. But I think it's manageable, so I'll try to attack it (and IFD specifically !) back .


        1. ASF.LICENSE.NOT.GRANTED--LUCENE-2386.patch
          60 kB
          Shai Erera
        2. ASF.LICENSE.NOT.GRANTED--LUCENE-2386.patch
          59 kB
          Shai Erera
        3. ASF.LICENSE.NOT.GRANTED--LUCENE-2386.patch
          61 kB
          Shai Erera
        4. ASF.LICENSE.NOT.GRANTED--LUCENE-2386.patch
          55 kB
          Shai Erera
        5. LUCENE-2386.patch
          56 kB
          Shai Erera
        6. LUCENE-2386.patch
          7 kB
          Shai Erera



            • Assignee:
              shaie Shai Erera
              shaie Shai Erera
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: