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

Shai Erera commented on LUCENE-4575:
------------------------------------

bq. I thought we were going to rename ensureOpen's confusing boolean param?

Right, but for some reason I thought that you're going to do that :). I'll do 
it in the next patch.

bq. IW.setCommitData should be sync'd I think, eg to ensure visibility across 
threads of the changes to sis.userData?

Ok

bq. Hmm ... I think there's a thread hazard here, during commit

I think you're right. Not sure how practical, because I believe that usually 
the commit thread will also be the one that calls setCommitData, but it is 
possible.
I agree that calling that setCommitData in finishCommit is redundant, but 
perhaps we can solve it more elegantly by either:

# Not storing the setCommitData in infos, but rather in a private IW member. 
Then in startCommit set it on the cloned infos. It's essentially how it's done 
today, only now the commit data will be copied from a member.
# Stick w/ current API commit(commitData) and prepareCommit(commitData), and 
just make sure that commit goes through even if changeCount == 
previousChangeCount, but commitUserData != null.

Option #2 means that there's no API break, no synchronization is needed on 
setCommitData and practically everything remains the same. We can still remove 
the redundant .setCommitData in finishCommit regadless.

bq. should we add an IW.getCommitData?

I think that that'd be great ! Today the only way to do it is if you refresh a 
reader (expensive). I think that the code in finishCommit ensures that we can 
always pull the commitData from segmentInfos?
                
> Allow IndexWriter to commit, even just commitData
> -------------------------------------------------
>
>                 Key: LUCENE-4575
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4575
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: core/index
>            Reporter: Shai Erera
>            Priority: Minor
>         Attachments: LUCENE-4575.patch, LUCENE-4575.patch
>
>
> Spinoff from here 
> http://lucene.472066.n3.nabble.com/commit-with-only-commitData-td4022155.html.
> In some cases, it is valuable to be able to commit changes to the index, even 
> if the changes are just commitData. Such data is sometimes used by 
> applications to register in the index some global application 
> information/state.
> The proposal is:
> * Add a setCommitData() API and separate it from commit() and prepareCommit() 
> (simplify their API)
> * When that API is called, flip on the dirty/changes bit, so that this gets 
> committed even if no other changes were made to the index.
> I will work on a patch a post.

--
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