Uploaded image for project: 'Samza'
  1. Samza
  2. SAMZA-812

CachedStore flushes too often

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.10.0, 0.9.1
    • 0.10.0
    • kv
    • None

    Description

      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.

      Attachments

        Activity

          People

            twbecker Tommy Becker
            twbecker Tommy Becker
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: