This project is archived and is in readonly mode.
has_many collection(force_reload=TRUE) hits cache under lock!
-
Will Bryant
- Assigned user set to josh
- Tag changed from 2.1.1, activerecord, collection, has_many, lock, transaction to 2.1.1, 2.3.x, activerecord, collection, has_many, lock, query_cache, transaction
This affects one of my projects too - we're not using clear, but we are locking and using (true) to check for the current record - very bad thing happened when it used the cached result...
Patch attached. Josh, does this look OK to you?
It's surprising that this hasn't come up before - but from examining the projects I have access to it seems most times when people use (true) they've already dirtied the cache by executing a CUD operation on another instance, so the cache doesn't get used anyway. On a more positive note, that means that the performance impact of punching through the cache for force_reload=true is pretty minimal for most apps - they already don't cache most calls.
This patch is against 2-3-stable.
-
Repository
- State changed from new to resolved
(from [b1bbf90dffbc412670286154d9c7749d4388806b]) When passing force_reload = true to an association, don't use the query cache [#1827 has_many collection(force_reload=TRUE) hits cache under lock! state:resolved]
Signed-off-by: Joshua Peek josh@joshpeek.com
http://github.com/rails/rails/commit/b1bbf90dffbc412670286154d9c774... -
Repository
(from [bf6af5f71917b5615edb5905729b22772133eea4]) When passing force_reload = true to an association, don't use the query cache [#1827 has_many collection(force_reload=TRUE) hits cache under lock! state:resolved]
Signed-off-by: Joshua Peek josh@joshpeek.com
http://github.com/rails/rails/commit/bf6af5f71917b5615edb5905729b22...
