You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here you can see that reads are from slave when using model methods... but not connection itself:
production >> SlaveUtils.read_from_slave { User.first }
[slave/1] User Load (0.6ms) SELECT `users`.* FROM `users` ORDER BY `users`.`id` ASC LIMIT 1
production >> SlaveUtils.read_from_slave { User.connection.select_all('show processlist') }
[master/1] (1.4ms) show processlist
production >>
``
The text was updated successfully, but these errors were encountered:
This is unrelated to using model methods vs connection methods. You're comparing two different SQL statements. Makara decides which queries to send where based on whether they need the primary db or can use a replica. The SHOW query falls back to the primary connection since it doesn't match any of the regexps.
To verify: If you do a SELECT on the connection first, it'll pick a replica connection and a subsequent SHOW PROCESSLIST should stick to the same connection.
Here you can see that reads are from slave when using model methods... but not connection itself:
The text was updated successfully, but these errors were encountered: