[
https://hibernate.onjira.com/browse/HHH-7256?page=com.atlassian.jira.plug...
]
Steve Ebersole commented on HHH-7256:
-------------------------------------
Moving updating of stats to the cache providers is not a good solution. First you are
duplicating that code, potentially fragmenting it. Second, stats is a critical thing
relied on by many applications; this suggestion makes them dependent that integration code
updates stats properly.
The reasoning you gave was because you thought Hibernate was "guessing" at what
the cache provider is doing internally. But my point is that we are not guessing. All
put methods expect the cache provider to return whether or not a put actually happens as
well as an argument indicating "minimal puts setting" for the current call
context. In the particular case we are discussing, the Infinispan integration is just
returning the wrong value.
Infinispan second level cache should react to minimal puts in
putFromLoad impl
------------------------------------------------------------------------------
Key: HHH-7256
URL:
https://hibernate.onjira.com/browse/HHH-7256
Project: Hibernate ORM
Issue Type: Improvement
Components: caching (L2)
Reporter: Galder Zamarreno
Assignee: Galder Zamarreno
Fix For: 4.1.3
When entities are loaded multiple times, it could happen that two consecutive
Cache.putForExternalRead() operations are called with the second not affecting the cache
if a an entry is already present.
However, from a cache put statistics will increase, resulting potentially in a huge
number when in reality, the number of actual cache updates has been pretty small. The
minimalPuts parameter is there to avoid this, implying that maybe a check if the key is
present should be added since PFER does not return a boolean or similar.
Although adding that check looks something obvious, it's something that we're
probably reluctant to do, because since caches are configured with storeAsBinary=true, it
could lead to unmarshalling, slowing things down.
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira