Tommy Becker created SAMZA-812:
----------------------------------

             Summary: CachedStore flushes too often
                 Key: SAMZA-812
                 URL: https://issues.apache.org/jira/browse/SAMZA-812
             Project: Samza
          Issue Type: Bug
          Components: kv
    Affects Versions: 0.10.0, 0.9.1
            Reporter: Tommy Becker


The CachedStore wrapper class flushes on every put or putAll that dirties the 
cache. This seems rooted in a misunderstanding of 
LinkedHashMap.removeEldestEntry. This method is called on every put() or 
putAll() to the map, and the implementation in CachedStore flushes the dirty 
entries without first checking if the cache is at capacity. Interestingly, 
fixing this issue reveals another in 
org.apache.samza.storage.kv.TestKeyValueStores#putAndGet. This test 
unintentionally relies on the inefficient behavior in CachedStore to handle 
array keys. Specifically, even though different array instances can never get 
cache hits due to pass-by-reference semantics in the cache, the existing 
flushing behavior causes the arrays to get prematurely written to the store 
which has pass-by-value semantics.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to