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

IndexWriter.commit() does not update the index version

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: None
    • Component/s: core/index
    • Labels:
      None
    • Lucene Fields:
      Patch Available

      Description

      IndexWriter.commit() can update the index version and generation but the update of version is lost.
      As result added documents are not seen by IndexReader.reopen().
      (There might be other side effects that I am not aware of).
      The fix is 1 line - update also the version in SegmentsInfo.updateGeneration().
      (Finding this line involved more lines though... )

        Issue Links

          Activity

          Hide
          doronc Doron Cohen added a comment -

          Committed.

          Show
          doronc Doron Cohen added a comment - Committed.
          Hide
          mikemccand Michael McCandless added a comment -

          Does SegmentInfos really need both "version" and "generation"? Is "generation" sufficient?

          I believe they are in fact redundant. I tested this with a small change to just return generation when getVersion is called and all tests pass. I'll open a new issue.

          Show
          mikemccand Michael McCandless added a comment - Does SegmentInfos really need both "version" and "generation"? Is "generation" sufficient? I believe they are in fact redundant. I tested this with a small change to just return generation when getVersion is called and all tests pass. I'll open a new issue.
          Hide
          ningli Ning Li added a comment -

          Does SegmentInfos really need both "version" and "generation"? Is "generation" sufficient?

          Show
          ningli Ning Li added a comment - Does SegmentInfos really need both "version" and "generation"? Is "generation" sufficient?
          Hide
          doronc Doron Cohen added a comment -

          Oh good, less migration to do.
          Mmm.. so it is not related to Daniel's "Document ID shuffling under 2.3.x" in the user list.

          Show
          doronc Doron Cohen added a comment - Oh good, less migration to do. Mmm.. so it is not related to Daniel's "Document ID shuffling under 2.3.x" in the user list.
          Hide
          mikemccand Michael McCandless added a comment -

          Good catch Doron, thanks!

          This only affects trunk (2.4).

          Show
          mikemccand Michael McCandless added a comment - Good catch Doron, thanks! This only affects trunk (2.4).
          Hide
          doronc Doron Cohen added a comment -

          Patch with a fix + a test that demonstrates the bug.
          All core tests pass. Will run all tests later on.

          Show
          doronc Doron Cohen added a comment - Patch with a fix + a test that demonstrates the bug. All core tests pass. Will run all tests later on.

            People

            • Assignee:
              doronc Doron Cohen
              Reporter:
              doronc Doron Cohen
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development