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

Exception in DocumentsWriter.ThreadState.init leads to corruption

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3.2, 2.4
    • Component/s: core/index
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      If an exception is hit in the init method, DocumentsWriter incorrectly
      increments numDocsInRAM when in fact the document is not added.

      Spinoff of this thread:

      http://markmail.org/message/e76hgkgldxhakuaa

      The root cause that led to the exception in init was actually due to
      incorrect use of Lucene's APIs (one thread still modifying the
      Document while IndexWriter.addDocument is adding it) but still we
      should protect against any exceptions coming out of init.

      1. LUCENE-1198.patch
        5 kB
        Michael McCandless

        Activity

        Hide
        mikemccand Michael McCandless added a comment -

        Attached patch. I added a unit test showing the issue. To do this, I
        added this method to IndexWriter:

        boolean testPoint(String name)

        Then in DocumentsWriter.ThreadState.init I added this:

        assert writer.testPoint("DocumentsWriter.ThreadState.init start");

        Then, tests can subclass IndexWriter and do interesting things at each
        of these test points. We can add further test points over time...

        Then I fixed the issue and the tests (& all tests) pass. I'll commit
        in a day or two.

        Show
        mikemccand Michael McCandless added a comment - Attached patch. I added a unit test showing the issue. To do this, I added this method to IndexWriter: boolean testPoint(String name) Then in DocumentsWriter.ThreadState.init I added this: assert writer.testPoint("DocumentsWriter.ThreadState.init start"); Then, tests can subclass IndexWriter and do interesting things at each of these test points. We can add further test points over time... Then I fixed the issue and the tests (& all tests) pass. I'll commit in a day or two.
        Hide
        hossman Hoss Man added a comment -

        targeted for 2.3.2 bug fix release

        Show
        hossman Hoss Man added a comment - targeted for 2.3.2 bug fix release

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development