Re: [Rails-core] Backport ActiveRecord query cache feature from 6.x to 5.2

2019-10-18 Thread Николай Марков
Ok, thanks for reply.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-core/797259ca-ce13-4325-8764-33a8484bdcff%40googlegroups.com.


Re: [Rails-core] Backport ActiveRecord query cache feature from 6.x to 5.2

2019-10-18 Thread Rafael Mendonça França
Hello!

With the release of Rails 6.0.0, Rails 5.2 became a security only release. No 
bug fixes or new features are going to be added to 5.2 unless it is for 
security reasons.

See https://edgeguides.rubyonrails.org/maintenance_policy.html#bug-fixes 


> On Oct 18, 2019, at 12:31, Николай Марков  wrote:
> 
> Hello!
> 
> TLDR: I would like to backport https://github.com/rails/rails/pull/35089 
>  ("Invalidate all query caches for 
> current thread") to 5.2-stable branch.
> The issue comes from this patch which enables query cache for all connection 
> pools - https://github.com/rails/rails/pull/28869 
> .
> 
> Longer text:
> I'm using active_record_slave 
>  to read some records from 
> slave database. It uses special abstract model which connects to slave 
> database using establish_connection and all reads go through this model by 
> default.
> 
> My case (consider this happens inside http request/response cycle):
> 
> fetch some record - it will be read from slave and this query will be cached
> delete that record - this query will go through AR::Base.connection_pool to 
> master database and this will clear the cache for this connection pool but 
> not for connection pool of the model for slave database.
> fetch the same record from step №1 using the same query - this will return 
> the record from cache, because all reads go to slave by default.
> AR.uncached cannot be used because it works only for AR::Base.connection_pool.
> 
> Can I make a backport?
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to rubyonrails-core+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-core/0cf6351a-a8f7-409e-a012-d6f9f11c6d96%40googlegroups.com
>  
> .

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-core/8CFD84E0-6E20-4053-8B10-4E8AAF5F08BB%40gmail.com.


[Rails-core] Backport ActiveRecord query cache feature from 6.x to 5.2

2019-10-18 Thread Николай Марков
Hello!

TLDR: I would like to backport https://github.com/rails/rails/pull/35089 
("Invalidate 
all query caches for current thread") to 5.2-stable branch.
The issue comes from this patch which enables query cache for all 
connection pools - https://github.com/rails/rails/pull/28869.

Longer text:

I'm using active_record_slave 
 to read some records 
from slave database. It uses special abstract model which connects to slave 
database using establish_connection and all reads go through this model by 
default.

My case (consider this happens inside http request/response cycle):

   1. fetch some record - it will be read from slave and this query will be 
   cached
   2. delete that record - this query will go through 
   AR::Base.connection_pool to master database and this will clear the 
   cache for this connection pool but not for connection pool of the model for 
   slave database.
   3. fetch the same record from step №1 using the same query - this will 
   return the record from cache, because all reads go to slave by default.

AR.uncached cannot be used because it works only for 
AR::Base.connection_pool.

Can I make a backport?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-core/0cf6351a-a8f7-409e-a012-d6f9f11c6d96%40googlegroups.com.