You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Michael McCandless (JIRA)" <ji...@apache.org> on 2008/08/05 12:08:44 UTC

[jira] Updated: (LUCENE-1335) Correctly handle concurrent calls to addIndexes, optimize, commit

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

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: https://issues.apache.org/jira/browse/LUCENE-1335
>             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:
>     http://mail-archives.apache.org/mod_mbox/lucene-java-dev/200807.mbox/%3Cc7b302c50807111018j58b6d08djd56b5889f6b3780d@mail.gmail.com%3E

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org