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

IndexUpgrader doesn't upgrade an index if it has zero segments

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.10.4, 5.2.1
    • 4.10.5, 5.3, 6.0
    • core/index
    • None
    • New

    Description

      IndexUpgrader uses merges to do its job. Therefore, if you use it to upgrade an index with no segments, it will do nothing - it won't even update the version numbers in the segments file, meaning that later versions of Lucene will fail to open the index, despite the fact that you "upgraded" it.

      The suggested workaround when this was raised on the mailing list in January seems to be to use filesystem magic to look at the files, figure out whether there are any segments, and write a new empty index if there are none.

      This sounds easy, but there are probably traps. For instance, there might be files in the directory which don't really belong to the index. Earlier versions of Lucene used to have a FilenameFilter which was usable to distinguish one from the other, but that seems to have disappeared, making it less obvious how to do this.

      This issue is presumed to exist in 3.x as well, I just haven't encountered it yet because the only empty indices I have hit have been later versions.

      Attachments

        1. LUCENE-6658.patch
          2 kB
          Uwe Schindler
        2. LUCENE-6658.patch
          3 kB
          Uwe Schindler
        3. LUCENE-6658.patch
          4 kB
          Uwe Schindler
        4. empty.4.10.4.zip
          0.4 kB
          Uwe Schindler
        5. LUCENE-6658.patch
          4 kB
          Uwe Schindler

        Activity

          People

            uschindler Uwe Schindler
            trejkaz Trejkaz
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: