Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-7165

CACHE_MODE_LOCAL is unsafe with L1 enabled

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Minor Minor
    • None
    • 8.2.4.Final, 9.0.0.Alpha4
    • Core
    • None

      The CACHE_MODE_LOCAL javadoc says:

      In distributed mode, the modifications performed
      during an operation in a non-owner node are going to L1,
      if it is enabled, otherwise the operation is a no-op in
      that node.

      I see 2 problems with this:

      1. Remote get-triggered L1 writes go through an L1Synchronizer to ensure stale entries don't overwrite newer ones. CACHE_MODE_LOCAL ones don't have any synchronization, so they could overwrite an existing value with a newer one. To be fair, when reading values from an external source and inserting it in the cache, keeping the cache in sync is kind of tricky even with regular writes.
      2. Remote get-triggered L1 writes also register on one or more of the key owners as an "L1 requestor", so the owner knows whether it should broadcast an invalidation message when the value changes. (That's in the default configuration; with invalidationThreshold > 1, the owner will only send unicast invalidations to the individual requestors.) CACHE_MODE_LOCAL writes do not register on any owner, so their values may never be invalidated.

      We should change CACHE_MODE_LOCAL to never write to L1. If the application wants to write an entry to the local node regardless of ownership, it should use SKIP_OWNERSHIP_CHECK too, and it should be aware that the cache will not perform the regular L1 invalidation for that entry.

      Note that putForExternalRead() doesn't use CACHE_MODE_LOCAL, so it shouldn't be affected.

            Unassigned Unassigned
            dberinde@redhat.com Dan Berindei (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: