You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Uwe Schindler (JIRA)" <ji...@apache.org> on 2015/07/06 11:02:04 UTC

[jira] [Updated] (LUCENE-6658) IndexUpgrader doesn't upgrade an index if it has zero segments

     [ https://issues.apache.org/jira/browse/LUCENE-6658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-6658:
----------------------------------
    Attachment: LUCENE-6658.patch

Here is a patch to make IndexUpgrader force a commit (I had to use a trick: supplying empty commit metadata to provoke a change).

I have not yet added a test (I would need to create some older "empty" index...).

This patch could also be applied to 4.10.5, but I don't think we get a 3.6 anymore. [~trejkaz] - can you try this out and see if it helps. Maybe apply the patch also to older versions.

[~mikemccand]: Do you think this is good? Or is there a better solution to enforce a commit, so all metadata of empty index is rewritten?

> IndexUpgrader doesn't upgrade an index if it has zero segments
> --------------------------------------------------------------
>
>                 Key: LUCENE-6658
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6658
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/index
>    Affects Versions: 4.10.4, 5.2.1
>            Reporter: Trejkaz
>         Attachments: LUCENE-6658.patch
>
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org