Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Octopus doesn't work with Rails' schema cache #562

Open
nebel95 opened this issue Jan 11, 2021 · 1 comment
Open

Octopus doesn't work with Rails' schema cache #562

nebel95 opened this issue Jan 11, 2021 · 1 comment

Comments

@nebel95
Copy link

nebel95 commented Jan 11, 2021

I am using Rails 5 + Unicorn + Octopus with 3 Postresql database shards (all of them share the same schema). Everything seems to work well but I cannot seem to get schema cache to work, my database shards are always hit by queries like below when a web worker is started (I think the correct behavior should be no query at all):

SELECT a.attname
FROM
  (SELECT indrelid,
          indkey,
          generate_subscripts(indkey, $1) idx
   FROM pg_index
   WHERE indrelid = $2::regclass
     AND indisprimary ) i
JOIN pg_attribute a ON a.attrelid = i.indrelid
AND a.attnum = i.indkey[i.idx]
ORDER BY i.idx;

Is this a bug with octopus or am I doing something wrong here? I have schema cache enabled with config.active_record.use_schema_cache_dump = true in my Rails config file. Below is my Unicorn config:

preload_app true

after_fork do |server, worker|
  # START OF OCTOPUS SPECIFIC CONFIG
  ActiveRecord::Base.connection_proxy.initialize_shards(Octopus.config)
  # END OF OCTOPUS SPECIFIC CONFIG
end
@samerzmd
Copy link

We are facing the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants