<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>So I've taken on this sub-task from Sanne (ISPN-1169), and here is the deal:</div><div><br></div><div>BCHM analyses whether or not to evict stuff every time an operation (put, get, replace) is run, based on the configured eviction policy (LIRS, LRU or NONE). &nbsp;It does so by calling evictionStrategy.execute(), which returns a Set of hash entries removed from the BCHM.</div><div><br></div><div><a href="https://github.com/infinispan/infinispan/blob/master/core/src/main/java/org/infinispan/util/concurrent/BoundedConcurrentHashMap.java#L341">https://github.com/infinispan/infinispan/blob/master/core/src/main/java/org/infinispan/util/concurrent/BoundedConcurrentHashMap.java#L341</a></div><div><br></div><div>Note that execute() actually removes entries from the BCHM, so after execute() is called, these entries are no longer in the BCHM!</div><div><br></div><div>This is set is then sent to the EvictionManager&nbsp;</div><div><br></div><div><a href="https://github.com/infinispan/infinispan/blob/master/core/src/main/java/org/infinispan/eviction/EvictionManager.java#L61">https://github.com/infinispan/infinispan/blob/master/core/src/main/java/org/infinispan/eviction/EvictionManager.java#L61</a></div><div><br></div><div>which in turn passivates the evicted entries:</div><div><br></div><div><a href="https://github.com/infinispan/infinispan/blob/master/core/src/main/java/org/infinispan/eviction/EvictionManagerImpl.java#L189">https://github.com/infinispan/infinispan/blob/master/core/src/main/java/org/infinispan/eviction/EvictionManagerImpl.java#L189</a></div><div><br></div><div>So we have a window where the entry is neither accessible from memory or from a cache store, since it is "in-fly".</div><div><br></div><div>My proposed fix is to:</div><div><br></div><div>1) Make sure the PassivationManager is passed in to the DataContainer, and available to any EvictionStrategy</div><div>2) EvictionStrategies ensure passivation occurs *before* removing an entry from the BCHM</div><div>3) The additional window of a reader thread in the ActivationInterceptor determining that an entry is in memory and bypasses activation, only to find that the entry has been removed from the BCHM by the time it gets to it, should not be a problem since when testing the DataContainer in the ActivationInterceptor, the entry is placed in the caller's InvocationContext so a handle on the entry is there.</div><div><br></div><div>Does anyone have any concerns with this? &nbsp;Vladimir, does this adversely affect the BCHM/EvictionStrategy design?</div><div><br></div><div>Cheers</div><div>Manik</div><br><div><div>On 8 Jun 2011, at 19:15, Vladimir Blagojevic wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On 11-06-08 12:10 PM, Sanne Grinovero wrote:<br><blockquote type="cite">Yes, we're on the same channel now. That's exactly what I meant<br></blockquote><blockquote type="cite">yesterday on IRC when mentioning the BoundedCHM, and what I meant<br></blockquote><blockquote type="cite">above with "we should acquire it before it's actually evicted".<br></blockquote><blockquote type="cite">But this issue is getting complex, I've split it in 4 different<br></blockquote><blockquote type="cite">problems and I'm going to solve the first three soon, the BoundedCHM<br></blockquote><blockquote type="cite">is the fourth and I'm not sure I'll fix that today.<br></blockquote>Sanne,<br><br>Sounds good, please consult us when it comes to changing BCHM!<br><br>Cheers.<br>_______________________________________________<br>infinispan-dev mailing list<br><a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/infinispan-dev<br></div></blockquote></div><br><div>
<div><div>--</div><div>Manik Surtani</div><div><a href="mailto:manik@jboss.org">manik@jboss.org</a></div><div><a href="http://twitter.com/maniksurtani">twitter.com/maniksurtani</a></div><div><br></div><div>Lead, Infinispan</div><div><a href="http://www.infinispan.org">http://www.infinispan.org</a></div><div><br></div></div><br class="Apple-interchange-newline">
</div>
<br></body></html>