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

CorruptIndexException on indexing after a failure occurs after segments file creation but before any bytes are written

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 3.5
    • 3.6, 4.0-ALPHA
    • None
    • None
    • New, Patch Available

    Description

      FSDirectory.createOutput(..) uses a RandomAccessFile to do its work. On my system the default FSDirectory.open(..) creates an NIOFSDirectory. If createOutput is called on a segments_* file and a crash occurs between RandomAccessFile creation (file system shows a segments_* file exists but has zero bytes) but before any bytes are written to the file, subsequent IndexWriters cannot proceed. The difficulty is that it does not know how to clear the empty segments_* file. None of the file deletions will happen on such a segment file because the opening bytes cannot not be read to determine format and version.

      An initial proposed patch file is attached below.

      Attachments

        1. LUCENE-3627.patch
          10 kB
          Michael McCandless
        2. LUCENE-3627_initial_proposal.txt
          14 kB
          Ken McCracken
        3. TestCrashCausesCorruptIndex.java
          11 kB
          Ken McCracken

        Activity

          People

            mikemccand Michael McCandless
            ken.mccracken Ken McCracken
            Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 48h
                48h
                Remaining:
                Remaining Estimate - 48h
                48h
                Logged:
                Time Spent - Not Specified
                Not Specified