From 82b61e4811fc94650e7ef00e9afc318ac1e642de Mon Sep 17 00:00:00 2001 From: Rolf Schmidt Date: Fri, 3 Dec 2021 11:13:40 +0100 Subject: [PATCH] Fixes #3877 - Missing ticket updates on high load in MariaDB/MySQL environments. --- config/initializers/db_preferences.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/config/initializers/db_preferences.rb b/config/initializers/db_preferences.rb index b4ade9b1a..265b0d552 100644 --- a/config/initializers/db_preferences.rb +++ b/config/initializers/db_preferences.rb @@ -6,6 +6,13 @@ when 'mysql2' Rails.application.config.db_case_sensitive = false Rails.application.config.db_like = 'LIKE' Rails.application.config.db_null_byte = true + + # Because of missing ticket updates in high load environments + # we changed the transaction isolation level equally to postgres + # to READ COMMITTED which fixed the problem entirely #3877 + ActiveRecord::ConnectionAdapters::Mysql2Adapter.set_callback :checkout, :before do |conn| + conn.execute('SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED') + end when 'postgresql' Rails.application.config.db_4bytes_utf8 = true Rails.application.config.db_case_sensitive = true