lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (JIRA)" <>
Subject [jira] Updated: (LUCENE-1335) Correctly handle concurrent calls to addIndexes, optimize, commit
Date Tue, 05 Aug 2008 10:08:44 GMT


Michael McCandless updated LUCENE-1335:

    Attachment: LUCENE-1335.patch

Attached patch.  Here're the changes:

  * Only one addIndexes can run at once, so call to 2nd or more
    addIndexes just blocks until the one is done.

  * close() and rollback() wait for any running addIndexes to finish
    and then blocks new addIndexes calls

  * commit() waits for any running addIndexes, or any already running
    commit, to finish, then quickly takes a snapshot of the segments
    and syncs the files referenced by that snapshot.  While syncing is
    happening addIndexes are then allowed to run again.

  * optimize() is allowed to run concurrently with addIndexes; the two
    simply wait for their respective merges to finish.

I think we should not make any API promises about what it means when
these methods (commit, close, rollback, optimize, addIndexes) are
called concurrently from different threads, except that the methods
all work correctly, IndexWriter won't throw an errant exception, and
your index won't become corrupt.

I made one additional change which is technically a break in backwards
compatibility, but I think (?) a minor acceptable one: I no longer
allow the same Directory to be passed into addIndexes* more than once.
This was necessary because we identify a SegmentInfo by its
Directory/name pair, and passing in the same Directory allowed dup
SegmentInfo instances to enter SegmentInfos, which is dangerous.

I'll wait a few days before committing.

> Correctly handle concurrent calls to addIndexes, optimize, commit
> -----------------------------------------------------------------
>                 Key: LUCENE-1335
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.3, 2.3.1
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 2.4
>         Attachments: LUCENE-1335.patch
> Spinoff from here:

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