[ 
https://issues.apache.org/jira/browse/LUCENE-4876?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13720476#comment-13720476
 ] 

Adrien Grand commented on LUCENE-4876:
--------------------------------------

bq. We keep clone() on IWC, and the rest of the objects, and tell users that 
it's their responsibility to call IWC.clone() before passing to IW? That's line 
a 1-liner change (well + clarifying the jdocs), that will make 99% of the users 
happy. The rest should just do new IW(dir, conf.clone()) ... that's simple 
enough?

Even though most users probably don't reuse their IndexWriterConfig objects, 
doing so should be safe and I'm a little scared of what could happen if a 
ConcurrentMergeScheduler was mistakenly shared by two different IndexWriters 
for example.

Maybe another option for this issue would be to replace all these objects 
(MergePolicy, MergeScheduler, etc.) in IndexWriterConfig by factories for these 
objects that accept an IndexWriter as an argument (and maybe other objects 
depending on the factory). This would make it clear that IndexWriter has its 
own instance of these objects and reusing IndexWriterConfig instances would 
still be safe. An interesting side-effect is that we wouldn't need these 
SetOnce<?> in DWPT, FlushPolicy, and MergePolicy anymore, and 
ConcurrentMergeScheduler.indexWriter could be made final.
                
> IndexWriterConfig.clone should clone the MergeScheduler
> -------------------------------------------------------
>
>                 Key: LUCENE-4876
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4876
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Adrien Grand
>            Assignee: Adrien Grand
>             Fix For: 4.3
>
>         Attachments: LUCENE-4876.patch, LUCENE-4876.patch, LUCENE-4876.patch
>
>
> ConcurrentMergeScheduler has a List<MergeThread> member to track the running 
> merging threads, so IndexWriterConfig.clone should clone the merge scheduler 
> so that both IndexWriterConfig instances are independant.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to