[
https://issues.apache.org/jira/browse/LUCENE-3416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13099160#comment-13099160
]
Shay Banon commented on LUCENE-3416:
------------------------------------
> this make no sense to me. If you don't want to set this concurrently how does
> a lock protect you from this? I mean you if you have two threads accessing
> this you have either A B or B A. but this would happen without a lock too. if
> you want to have the changes to take effect immediately you need to either
> lock on each read on this var or make it volatile which is almost equivalent
> (a mem barrier).
No, thats not correct. setMaxMergeWriteMBPerSec (not the method I added, the
other one) is a complex method, and I think Mike wanted to protect from two
threads setting the value concurrently. As for reading the value, I think Mike
logic was that its not that importnat the have "immediate" visibility of the
change to require a volatile field (which is understandable). So, since
setMaxMergeWriteMBPerSec is synchronized, the method added in this patch has to
be as well.
> My concern here was related to make this var volatile which would be a
> cacheline invalidation each time you read the var. I think we should get rid
> of the synchronized.
Reading a volatile var in x86 is not a cache invalidation, though it does come
with a cost. Its not relevant here based on what I explained before (and second
guessing Mike :) )
> Allow to pass an instance of RateLimiter to FSDirectory allowing to rate
> limit merge IO across several directories / instances
> ------------------------------------------------------------------------------------------------------------------------------
>
> Key: LUCENE-3416
> URL: https://issues.apache.org/jira/browse/LUCENE-3416
> Project: Lucene - Java
> Issue Type: Improvement
> Components: core/store
> Reporter: Shay Banon
> Assignee: Simon Willnauer
> Attachments: LUCENE-3416.patch
>
>
> This can come in handy when running several Lucene indices in the same VM,
> and wishing to rate limit merge across all of them.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]