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 Bug
    • Status: Closed
    • Priority: Critical 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.

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

        Activity

          People

          • Assignee:
            Michael McCandless
            Reporter:
            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

                Development