[
https://issues.apache.org/jira/browse/LUCENE-5885?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Shai Erera updated LUCENE-5885:
-------------------------------
Attachment: LUCENE-5885.patch
Patch removes CMS.sync() and Closeable from MergeScheduler. Note that this
cannot be committed yet, since it depends on the fix Mike's working on on
LUCENE-5871. Currently, without that fix, when you call IW.close() and
commitOnClose=true, IW flushes, finishes merges and then commits. But that
commit may spawn merges itself, and so if we don't wait/abort them in
IW.rollbackInternal, some tests complain about still running merges, or hit
AlreadyClosedExceptions. With the fix on LUCENE-5871, that commit won't spawn
new merges, which is silly since IW is closing...
I'll wait for that fix before I assert this patch really works. I also didn't
add a CHANGES entry - the migration from CMS.sync() is to simply call
IW.waitForMerges(), which I think is better to do anyway.
> MergeScheduler should not implement Closeable
> ---------------------------------------------
>
> Key: LUCENE-5885
> URL: https://issues.apache.org/jira/browse/LUCENE-5885
> Project: Lucene - Core
> Issue Type: Bug
> Components: core/index
> Reporter: Shai Erera
> Attachments: LUCENE-5885.patch
>
>
> MergeScheduler implements Closeable and IndexWriter calls ms.close() when
> it's closed. But MergeScheduler can be shared between several writers, which
> means closing it by any particular writer is wrong. We should rather
> implement some ref-counting logic such that each IW will call incRef() in the
> ctor, and decRef() on close(), and MergeScheduler will truly close when the
> ref-count hits 0.
> As it is now, if you share a MergeScheduler between writers and close() does
> something terminating, I doubt if it really works.
> Also, when I look at ConcurrentMergeScheduler.close(), it calls sync() which
> joins all MergeThreads. But if that CMS instance is shared between few IWs,
> doesn't it mean that a single IW calling close() waits on MergeThreads that
> execute merges of other IWs!?!? This seems ... wrong?
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]