octopus
octopus copied to clipboard
Octopus crashes when calling unprepared_statement
Hi there,
I have fully replicated Postgres Master-Slave databases.
Octopus generates errors when somewhere in a Rails model I use connection.unprepared_statement
Let's say for example I have the following method: (Not really useful here but it's just an example ;))
def self.default
connection.unprepared_statement do
find_by(default: true)
end
end
I get the following error :
ActiveRecord::StatementInvalid:
ERROR: bind message supplies 1 parameters, but prepared statement "a97" requires 0
…/gems/ar-octopus-0.8.6/lib/octopus/abstract_adapter.rb: 15:in `instrument'
…/ruby/2.2.0/gems/ar-octopus-0.8.6/lib/octopus/proxy.rb: 479:in `block in send_queries_to_slave'
…/ruby/2.2.0/gems/ar-octopus-0.8.6/lib/octopus/proxy.rb: 509:in `using_shard'
…/ruby/2.2.0/gems/ar-octopus-0.8.6/lib/octopus/proxy.rb: 478:in `send_queries_to_slave'
…/ruby/2.2.0/gems/ar-octopus-0.8.6/lib/octopus/proxy.rb: 449:in `send_queries_to_selected_slave'
…/ruby/2.2.0/gems/ar-octopus-0.8.6/lib/octopus/proxy.rb: 301:in `method_missing'
…efy/releases/20160512074322/app/models/organization.rb: 31:in `block in default'
…/ruby/2.2.0/gems/ar-octopus-0.8.6/lib/octopus/proxy.rb: 303:in `method_missing'
…efy/releases/20160512074322/app/models/organization.rb: 30:in `default'
It seems that the connection proxy does not correctly delegates the unprepared_statement
call to the database adapter.
Thank you for your help!
Did you solve this?
Unfortunately no... Not sure if it is still an issue as I switch to something else