[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4550) query cache: Attention with configuring Update Timestamps Cache region: expired entries cause wrong result sets!
Guenther Demetz (JIRA)
noreply at atlassian.com
Tue Nov 10 02:05:09 EST 2009
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=34496#action_34496 ]
Guenther Demetz commented on HHH-4550:
--------------------------------------
Finally in the JavaDoc of class UpdateTimestampsCache I have found more less the advice I searched for:
/**
...
* It is important that the cache timeout of the underlying cache implementation be set
* to a higher value than the timeouts of any of the query caches. In fact, we
* recommend that the the underlying cache not be configured for expiry at all.
* Note, in particular, that an LRU cache expiry policy is never appropriate.
...
*/
public class UpdateTimestampsCache ...
Personally I think this hint should appear in every article speaking about configuring hibernate query cache.
> query cache: Attention with configuring Update Timestamps Cache region: expired entries cause wrong result sets!
> ----------------------------------------------------------------------------------------------------------------
>
> Key: HHH-4550
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4550
> Project: Hibernate Core
> Issue Type: Improvement
> Components: caching (L2)
> Affects Versions: 3.3.2
> Environment: 3.3.2 GA
> Reporter: Guenther Demetz
> Priority: Trivial
> Attachments: TestCaseQuryCache.jar
>
>
> When using hibernate's query cache (hibernate.cache.use_query_cache),
> then it's of fundamental importance to configure the Update Timestamps cache region in
> a way that his entries survive longer than the cached result sets in the Query cache region.
> Otherwise queries could return wrong (obsolete) result sets (See attached testcase).
> This is because the current UpdateTimestampsCache#isUpToDate implementation considers a result-set also as up-to-date,
> if there are no update-timestamps cached for the interested spaces (tables) at all.
> It if therefore important to notice that:
> 1- The Update-Timestamps-Cache-Region elements max-size should be configured higher than the number of tables you have
> on the db-schema, in manner that he can remember/hold the last update-timestamp for each table.
> 2- If you use any other eviction policy in the Update-Timestamps-Cache-Region, then you must assure
> that cached result sets in the Query-cache-region are evicted before relevant update-timestamps are going to be evicted.
> This fact should be clearly documented somewhere.
> Thanks
> G.D.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list