[ 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/[EMAIL > PROTECTED] -- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]