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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira