lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Busch (JIRA)" <>
Subject [jira] Commented: (LUCENE-887) Interruptible segment merges
Date Fri, 01 Jun 2007 17:17:15 GMT


Michael Busch commented on LUCENE-887:

> Actually the leftover files from the aborted merge *should* be deleted
> in the finally clause in mergeSegments, on hitting the original
> IndexWriterInterruptedException.  Ie once shutdown is complete, your
> index should have none of the partially written files left, I think?

Oh yes, you're right.

> Hmm, here's another possible issue .. thread safety sure is difficult.

It is!

> Say there are 2 addDocument calls in-flight, and the first one tries
> to flush buffered docs but hits the IndexWRiterInterruptException.
> You catch this, clear the interrupt flag but before you then call
> flushRAMSegments(false) the other addDocument thread get scheduled and
> enters the synchronized block in addDocument and then kicks off a
> flush with a merge.  I think at this point the merge would happily run
> to completion because the interrupt flag got cleared?

Hmm... yes I understand. Actually do we even have to call
flushAfterInterrupt() in the catch clause of addDocument()? The 
IndexWriterInterruptException is only thrown in case shutdown() has
been called, and in that case shutdown() waits anyways for all 
in-flight addDocument() calls to complete and flushes the buffered docs
then. Right? Or maybe I'm completely confused now... ;-)

> Interruptible segment merges
> ----------------------------
>                 Key: LUCENE-887
>                 URL:
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Index
>            Reporter: Michael Busch
>            Priority: Minor
>         Attachments:
> Adds the ability to IndexWriter to interrupt an ongoing merge. This might be necessary
when Lucene is e. g. running as a service and has to stop indexing within a certain period
of time due to a shutdown request.
> A solution would be to add a new method shutdown() to IndexWriter which satisfies the
following two requirements:
> - if a merge is happening, abort it
> - flush the buffered docs but do not trigger a merge 
> See also discussions about this feature on java-dev:

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