nhibernate-core
nhibernate-core copied to clipboard
WIP - Do not try to invalidate query spaces for non cached persisters
Fixes #2129
The second commit is a code cleanup. It could be dropped if serialization changes are not desired.
Hi! Maybe I'm missing something here, and is just focusing on the title, but query space invalidation / time stamp updating is orthogonal to the cachability of entities.
Probably you're right. I need to check.
Hi! Maybe I'm missing something here, and is just focusing on the title, but query space invalidation / time stamp updating is orthogonal to the cachability of entities.
@gliljas are you saying that an entity could be cached in a query even when the entity is not cacheable?
Not the entity, but its identifiers could, as the query cache caches identifiers only, regardless of entity cacheability.
Exactly. A cached query stores identifiers (or value projections) and should be invalidated whenever one of the included queryspaces is invalidated. It's not particularly efficient, especially with distributed caches, but it's how works right now.
A working feature might be to only allow queries to be cached if all included queryspaces/persisters have caching enabled.
I'll extract some refactoring from this PR into another, because it is useful anyway. For this PR I/we would need to add tests to demonstrate the behavior.
A working feature might be to only allow queries to be cached if all included queryspaces/persisters have caching enabled.
I do not agree. Query caching is enabled on a query per query basis, by user code. I think we should trust the user knows what he does in such case, instead of disregarding his explicit instructions.
I'll extract some refactoring from this PR into another, because it is useful anyway. For this PR I/we would need to add tests to demonstrate the behavior.
@hazzik @fredericDelaporte
With NH 5.3 issue still exists
As a workaround with reflection we are changing NH UpdateTimestampsCache with our timestamp cache impl. that invalidates only cached entities.
There is a huge performance effect under concurrent request of dml operations.