lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (JIRA)" <>
Subject [jira] Commented: (LUCENE-1703) Add a waitForMerges() method to IndexWriter
Date Sat, 20 Jun 2009 23:22:07 GMT


Michael McCandless commented on LUCENE-1703:

bq. If we change the default to not wait, then I don't think matchVersion will matter. Since
I'll need to update my code anyway, I don't think I'd care whether I call waitForMerges(),
or matchVersion, even though the latter is called only once and the change is required in
just one place. matchVersion, IMO, is required in more complicated cases, like that ACRONYM
issue, which my code really has no control over.

But we can't suddenly not wait, if you call optimize(), right?  (That's too severe a change
in runtime behavior) Ie, we'd have to rename it to something else, and deprecate the old one.

Actually... I'm no longer so sure we should make this change to the default.  I think the
current default (optimize(), addIndexes*(), expungeDeletes(), etc., all wait until they're
"done") is actually a good default?

> Add a waitForMerges() method to IndexWriter
> -------------------------------------------
>                 Key: LUCENE-1703
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>    Affects Versions: 2.4
>            Reporter: Tim Smith
>         Attachments:,
> It would be very useful to have a waitForMerges() method on the IndexWriter.
> Right now, the only way i can see to achieve this is to call IndexWriter.close()
> ideally, there would be a method on the IndexWriter to wait for merges without actually
closing the index.
> This would make it so that background merges (or optimize) can be waited for without
closing the IndexWriter, and then reopening a new IndexWriter
> the close() reopen IndexWriter method can be problematic if the close() fails as the
write lock won't be released
> this could then result in the following sequence:
> * close() - fails
> * force unlock the write lock (per close() documentation)
> * new IndexWriter() (acquires write lock)
> * finalize() on old IndexWriter releases the write lock
> * Index is now not locked, and another IndexWriter pointing to the same directory could
be opened
> If you don't force unlock the write lock, opening a new IndexWriter will fail until garbage
collection calls finalize() the old IndexWriter
> If the waitForMerges() method is available, i would likely never need to close() the
IndexWriter until right before the process being shutdown, so this issue would not occur (worst
case scenario, the waitForMerges() fails)

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message