makara
makara copied to clipboard
Queries with inline views dont hit slave
sql queries with inline views are redirected to master because they do not match the SQL_SLAVE_MATCHERS
here https://github.com/taskrabbit/makara/blob/master/lib/active_record/connection_adapters/makara_abstract_adapter.rb#L112
Example:
with users as (
select id, name from users where active is true
)
select * from users
this query will be redirected to master, whereas it can be queried on slave. Is there a reason for that that i am missing ?
the /A
means "start of string" - so there's probably a new regex (or set of them) to write to handle the with
case.
This seems to be addressed like the day before it was reported ><; with 7b1295f3fb5a394d03849f45128c91f94ffbd96f
Seems to work for me anyway.