Invalidations are not cleared when transaction rolls back

Description

With invalidation caches, Infinispan 2LC records information that an entity/collection is being invalidated in pending-puts cache before the transaction, starting from EntityRegionAccessStrategy.insert/update and then wipes that information after the transaction is committed from EntityRegionAccessStrategy.afterInsert/afterUpdate. However, when the transaction is rolled back, these after* methods are not called and the invalidation info leaks on the node that executes the transaction.

This does not cause several memory issues as the PutFromLoadValidator removes old invalidation records, but during this time the entry is not loaded from cache, which has a negative performance impact.

With transactional invalidation caches, Infinispan is registered as a synchronization and it could be possible to remove the invalidation info during roll back (it sends a command releasing the invalidation to other nodes), but on local node the Session is used as a session/transaction identifier, while remote nodes we use global transaction ID (Infinispan identifier for the transaction). The Session object is not available to Infinispan during rollback handling, therefore we would have to use global transaction ID for the local call to PutFromLoadValidator.beginInvalidatingKey - though, that means that this call would have to move inside the Infinispan interceptor stack.

Alternative is a registration of another synchronization explicitly from the insert/update call and ignore the after* methods, but that brings additional overhead to successful transactions.

Activity

Show:

Former user January 5, 2017 at 11:55 PM

Fixed in 5.1 branch as well.

Former user January 5, 2017 at 11:53 PM

Reopening to add 5.1.4 as a fix version.

Former user December 20, 2016 at 8:36 AM

Fixed in master.

Radim Vansa December 6, 2016 at 8:30 AM

Yes. I am working on a fix (regretably changing a lot of code), but it should be easy to backport it then.

Former user December 5, 2016 at 8:47 PM

, does this affect 5.1 or 5.0 branches?

Fixed

Details

Assignee

Reporter

Labels

Components

Fix versions

Affects versions

Priority

Created December 5, 2016 at 9:09 AM
Updated May 7, 2018 at 12:54 PM
Resolved January 5, 2017 at 11:53 PM