while using the Masochism plugin for Master-Slave database setup
(http://github.com/technoweenie/masochism/tree/master) I discovered a
with starting transactions in the ConnectionProxy:
79 def transaction(start_db_transaction = true, &block)
80 with_master(start_db_transaction) do
81 master.transaction(start_db_transaction, &block)
Despite there is a problem in Masochism itself I discovered there is
for me) a strange behavior in the AbstractAdapter within ActiveRecord:
158 def decrement_open_transactions
159 @open_transactions -= 1
In some cases there is the decrement_open_transactions method called
connections with an uninitialized @open_transactions variable (the
nil). I tracked this down to the initialize method in the same class.
other initializations the @open_transactions variable is not
37 def initialize(connection, logger = nil) #:nodoc:
38 @connection, @logger = connection, logger
39 @runtime = 0
40 @last_verification = 0
41 @query_cache_enabled = false
Is there a reason to init the variable via the attribute accessor?
149 def open_transactions
150 @open_transactions ||= 0
Thanks in advance!