instacart / makara

A Read-Write Proxy for Connections; Also provides an ActiveRecord adapter.

Home Page:http://tech.taskrabbit.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Makara Harshly Handling a Validation Error

tmedford opened this issue · comments

Why does Makara harshly handle a validation error. A connection should not be blacklisting based on validation.

image

image

image

+1

Any update on this.

@tmedford I'm sorry, I'm not sure I follow. Harshly handled errors don't cause a blacklisted connection, gracefully handled errors do:
https://github.com/taskrabbit/makara/blob/7f6e9d0c1a8be6ff73b630f2092894a6556ff046/lib/makara/error_handler.rb#L26-L36

@rosa Then why do we see a error log message in logs?

@tmedford because it's an error, and it's raised as such. What you see in your logs comes from here:

def harshly(e) 
   ::Makara::Logging::Logger.log("Harshly handling: #{e}\n#{e.backtrace.join("\n\t")}") 
   raise e 
end

But no connection is blacklisted as result of it.

@rosa - How to handle blacking issue
'Makara::Errors::AllConnectionsBlacklisted: [Makara/slave] All connections are blacklisted -> No error details'

  makara:
      id: postgresql
      sticky: true
      blacklist_duration: 5
      master_ttl: 5
      master_strategy: round_robin
      slave_strategy: failover # Keep the same until it is blacklisted
      # list your connections with the override values (they're merged into the top-level config)
      # be sure to provide the role if primary, role is assumed to be a replica if not provided
      connections:
        - role: master
          name: master
          host: <%= ENV['DB_HOST'] %>
          disable_blacklist: true
        #### implicit role: slave
        - name: replica1
          host: <%= ENV['DB_HOST_REPLICA_1'] %>
        - name: replica2
          host: <%= ENV['DB_HOST_REPLICA_2'] %>
        - name: replica3
          host: <%= ENV['DB_HOST_REPLICA_3'] %>