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

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 3.5
    • Fix Version/s: 3.6, 4.0-ALPHA
    • Component/s: None
    • Labels:
      None
    • Environment:
    • Lucene Fields:
      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. TestCrashCausesCorruptIndex.java
          11 kB
          Ken McCracken
        2. LUCENE-3627_initial_proposal.txt
          14 kB
          Ken McCracken
        3. LUCENE-3627.patch
          10 kB
          Michael McCandless

          Activity

            People

            • Assignee:
              mikemccand Michael McCandless
              Reporter:
              ken.mccracken Ken McCracken
            • Votes:
              2 Vote for this issue
              Watchers:
              2 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