Project

General

Profile

Defect #39437 » 0002-switch-tx-isolation-level-to-READ-COMMITTED-for-MySQ.patch

Jens Krämer, 2023-10-30 10:43

View differences:

config/initializers/09-mysql-tx-isolation.rb
# MySQL / MariaDB default to a tx isolation level of "REPEATABLE READ". This
# patch sets the tx isolation level to "READ COMMITTED" for the duration of the
# connection.
#
# Reason: Repeatable Read semantics break the current implementation of the
# issue nested set model on MySQL when parallel modifications to the same tree
# happen.
#
module Mysql2ReadCommittedIsolation
private
def configure_connection
super.tap do
execute("SET SESSION tx_isolation='READ-COMMITTED'")
end
end
end
ActiveRecord::ConnectionAdapters::Mysql2Adapter.prepend Mysql2ReadCommittedIsolation
(2-2/4)