Remove mark_transaction_written_if_write
This was only needed for the deprecation cycle for aborted/incomplete transactions committing -> rolling back.
This commit is contained in:
parent
746d115b9a
commit
b95354efca
@ -325,13 +325,6 @@ def transaction(requires_new: nil, isolation: nil, joinable: true, &block)
|
||||
:commit_transaction, :rollback_transaction, :materialize_transactions,
|
||||
:disable_lazy_transactions!, :enable_lazy_transactions!, to: :transaction_manager
|
||||
|
||||
def mark_transaction_written_if_write(sql) # :nodoc:
|
||||
transaction = current_transaction
|
||||
if transaction.open?
|
||||
transaction.written ||= write_query?(sql)
|
||||
end
|
||||
end
|
||||
|
||||
def transaction_open?
|
||||
current_transaction.open?
|
||||
end
|
||||
|
@ -84,7 +84,6 @@ def add_record(record, _ = true); end
|
||||
|
||||
class Transaction # :nodoc:
|
||||
attr_reader :connection, :state, :savepoint_name, :isolation_level
|
||||
attr_accessor :written
|
||||
|
||||
def initialize(connection, isolation: nil, joinable: true, run_commit_callbacks: false)
|
||||
@connection = connection
|
||||
@ -338,7 +337,7 @@ def within_new_transaction(isolation: nil, joinable: true)
|
||||
# @connection still holds an open or invalid transaction, so we must not
|
||||
# put it back in the pool for reuse.
|
||||
@connection.throw_away! unless transaction.state.rolledback?
|
||||
elsif Thread.current.status == "aborting" || (!completed && transaction.written)
|
||||
elsif Thread.current.status == "aborting" || !completed
|
||||
# The transaction is still open but the block returned earlier.
|
||||
#
|
||||
# The block could return early because of a timeout or because the thread is aborting,
|
||||
|
@ -636,7 +636,6 @@ def extended_type_map_key
|
||||
|
||||
def raw_execute(sql, name, async: false)
|
||||
materialize_transactions
|
||||
mark_transaction_written_if_write(sql)
|
||||
|
||||
log(sql, name, async: async) do
|
||||
ActiveSupport::Dependencies.interlock.permit_concurrent_loads do
|
||||
|
@ -168,7 +168,6 @@ def exec_stmt_and_free(sql, name, binds, cache_stmt: false, async: false)
|
||||
check_if_write_query(sql)
|
||||
|
||||
materialize_transactions
|
||||
mark_transaction_written_if_write(sql)
|
||||
|
||||
# make sure we carry over any changes to ActiveRecord.default_timezone that have been
|
||||
# made since we established the connection
|
||||
|
@ -12,7 +12,6 @@ def explain(arel, binds = [])
|
||||
# Queries the database and returns the results in an Array-like object
|
||||
def query(sql, name = nil) # :nodoc:
|
||||
materialize_transactions
|
||||
mark_transaction_written_if_write(sql)
|
||||
|
||||
log(sql, name) do
|
||||
ActiveSupport::Dependencies.interlock.permit_concurrent_loads do
|
||||
@ -41,7 +40,6 @@ def execute(sql, name = nil)
|
||||
check_if_write_query(sql)
|
||||
|
||||
materialize_transactions
|
||||
mark_transaction_written_if_write(sql)
|
||||
|
||||
log(sql, name) do
|
||||
ActiveSupport::Dependencies.interlock.permit_concurrent_loads do
|
||||
|
@ -757,7 +757,6 @@ def execute_and_clear(sql, name, binds, prepare: false, async: false)
|
||||
|
||||
def exec_no_cache(sql, name, binds, async: false)
|
||||
materialize_transactions
|
||||
mark_transaction_written_if_write(sql)
|
||||
|
||||
# make sure we carry over any changes to ActiveRecord.default_timezone that have been
|
||||
# made since we established the connection
|
||||
@ -773,7 +772,6 @@ def exec_no_cache(sql, name, binds, async: false)
|
||||
|
||||
def exec_cache(sql, name, binds, async: false)
|
||||
materialize_transactions
|
||||
mark_transaction_written_if_write(sql)
|
||||
update_typemap_for_default_timezone
|
||||
|
||||
stmt_key = prepare_statement(sql, binds)
|
||||
|
@ -25,7 +25,6 @@ def execute(sql, name = nil) # :nodoc:
|
||||
check_if_write_query(sql)
|
||||
|
||||
materialize_transactions
|
||||
mark_transaction_written_if_write(sql)
|
||||
|
||||
log(sql, name) do
|
||||
ActiveSupport::Dependencies.interlock.permit_concurrent_loads do
|
||||
@ -39,7 +38,6 @@ def exec_query(sql, name = nil, binds = [], prepare: false, async: false) # :nod
|
||||
check_if_write_query(sql)
|
||||
|
||||
materialize_transactions
|
||||
mark_transaction_written_if_write(sql)
|
||||
|
||||
type_casted_binds = type_casted_binds(binds)
|
||||
|
||||
@ -123,7 +121,6 @@ def execute_batch(statements, name = nil)
|
||||
check_if_write_query(sql)
|
||||
|
||||
materialize_transactions
|
||||
mark_transaction_written_if_write(sql)
|
||||
|
||||
log(sql, name) do
|
||||
ActiveSupport::Dependencies.interlock.permit_concurrent_loads do
|
||||
|
Loading…
Reference in New Issue
Block a user