Infinispan: 2L QueryCache don't considers cached queries which belong to current transaction

Description

When looking for a cached Query in 2L-cache,
QueryResultsRegionImpl(BaseRegion) does temporary suspend the current transaction.
QueryResultsRegionImpl(BaseRegion).suspendAndGet(Object, FlagAdapter, boolean) line: 205

In this way only committed queries from already closed transactions are considered to be hit.
Cached queries put by the current transaction are totally ignored!
This is in my opinion a bug, because it changes behavior and degrades the efficiency of the 2L QueryCache
in respect to other 2L-implementations (for example EHCache).
Furthermore there is no reason to ignore cached queries deriving from current transaction:
the up-to-date-ness is checked anyway by the StandardQueryCache.isUpToDate() call.

Proposed solution:
simply not suspend current transaction when looking for cached querys,
then queries put by the current transaction are automatically considered as candidates for a hit.

Environment

3.5.0.Beta3, SQLServerr2008, integration with JTA

Activity

Show:
Galder Zamarreno
February 11, 2010, 10:20 AM

I believe the code that you're refering was there from the JBoss Cache days where get operations acquired locks, so I suspect that the aim to suspend the transaction was so that locks acquired as a result of the get were not held during the transaction. So, the decision was taken to suspend the tx and execute the get. I believe we should be able to execute a get() without suspending a tx. I'm double checking this with the person who wrote the original code.

Galder Zamarreno
February 12, 2010, 2:23 PM

Fixed by removing transaction suspend calls on get() cos Infinispan does not acquire locks on get().

Steve Ebersole
March 21, 2011, 7:08 PM

Bulk closing stale resolved issues

Assignee

Galder Zamarreno

Reporter

Guenther Demetz

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

Priority

Major
Configure