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

Makara::Errors::AllConnectionsBlacklisted #78

Closed
nikhilvs opened this issue Apr 7, 2015 · 5 comments
Closed

Makara::Errors::AllConnectionsBlacklisted #78

nikhilvs opened this issue Apr 7, 2015 · 5 comments

Comments

@nikhilvs
Copy link

nikhilvs commented Apr 7, 2015

Issue looks like similar to #36 , but in our case we are not stopping any of our slave or master database.

Stack trace from new relic is as follows :

….1/bundler/gems/makara-1ac718c7650c/lib/makara/
pool.rb: 95:in provide' …1/bundler/gems/makara-1ac718c7650c/lib/makara/ proxy.rb: 69:inmethod_missing'
/usr/lib/ruby/1.9.1/
monitor.rb: 211:in mon_synchronize' /usr/lib/ruby/1.9.1/ monitor.rb: 211:inmon_synchronize'
…_adapters/abstract/
connection_specification_changes.rb: 47:in retrieve_connection' …_adapters/abstract/ connection_specification_changes.rb: 29:inconnection'

What might have gone wrong in this case ?

Environment details
makara version : 'v0.2.2'
Rails version : 3.2.14
Ruby version : ruby 1.9.3p484

@mnelson
Copy link
Contributor

mnelson commented Apr 7, 2015

That error occurs when all connections had a failure related to connectivity within the blacklist duration. If you weren't using makara, it would be equivalent to seeing a connection error in newrelic. Are you able to provide the full trace and a summary of your database.yml?

@nikhilvs
Copy link
Author

nikhilvs commented Apr 7, 2015

Our database.yml looks like this :

  adapter: 'makara_mysql2'
  encoding: utf8
  database: <%= ENV['RDS_DB_NAME'] %>
  username: <%= ENV['RDS_USERNAME'] %>
  password: <%= ENV['RDS_PASSWORD'] %>
  host: <%= ENV['RDS_HOSTNAME'] %>
  port: <%= ENV['RDS_PORT'] %>
  pool: <%= ENV['DB_POOL'] %>
  reaping_frequency: <%= ENV['REAPING_FREQUENCY'] %>
  timeout: 5000

  makara:
    blacklist_duration: 5
    master_ttl: 5
    sticky: true
    rescue_connection_failures: false

    connections:
      - role: master
        host: <%= ENV['RDS_HOSTNAME'] %>
        name: master-database
      - role: slave
        host: <%= ENV['DB_SLAVE1'] %>
        name: read-slave1
        weight: 5
      - role: slave
        host: <%= ENV['DB_SLAVE2'] %>
        name: read-slave2
        weight: 5

@joelr
Copy link

joelr commented Apr 13, 2015

I get the same error when I only have one connection defined in the connection list, even when the connection is valid...

eg

    connections:
      - role: master
        host: <%= ENV['DATABASE_HOST'] %>
        adapter: mysql2
<% unless ENV['DATABASE_SLAVE_HOST'].blank? %>
      - role: slave
        host: <%= ENV['DATABASE_SLAVE_HOST'] %>
        adapter: mysql2
        database: <%= ENV['DATABASE_SLAVE_DATABASE'] %>
        username: <%= ENV['DATABASE_SLAVE_USERNAME'] %>
        password: <%= ENV['DATABASE_SLAVE_PASSWORD'] %>
<% end %>

I wanted the slave to be optional, but it seems to fail with Makara::Errors::AllConnectionsBlacklisted unless > 1 connection is defined, is this a known issue?

@ic
Copy link

ic commented Apr 13, 2015

Same problem as @joelr. It would be great if Makara could behave as a "standard" adapter when there is only a master defined.

One practical example is to set up a staging environment with the same adapter as production (i.e. Makara), but with only a single DB for saving cost. This allows to test easily (except, yes, this settings does not allow to test fail-overs!).

@joelr: One dangerous workaround is to set a single machine as both master and slave. I did not check the source code yet, so please be aware this should be temporary (or confirmed as an OK workaround). A brief look at pool.rb tells me that it should be ok, but pretty costly (e.g. each send_to_all is executed twice by the DB, etc).

@bleonard
Copy link
Contributor

bleonard commented Jan 8, 2016

I'm going to combine this with this one (#101) -- I think they are both saying that master is special and especially if there is only one, there is something interesting that should happen where it works like "normal" - more investigating on that that means but "merging" them.

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

5 participants