Use a global lock provided by @with_advisory_lock@ gem to work around deadlock issues when MySQL >= 5.7 (#39437).

Patch by Jens Krämer.

git-svn-id: https://svn.redmine.org/redmine/trunk@22458 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu
2023-11-18 14:39:28 +00:00
parent b7a190399f
commit aa9b681678
3 changed files with 52 additions and 39 deletions

View File

@@ -29,7 +29,7 @@ class IssueNestedSetConcurrencyTest < ActiveSupport::TestCase
self.use_transactional_tests = false
def setup
skip if sqlite? || mysql?
skip if sqlite?
User.current = nil
CustomField.delete_all
end
@@ -59,21 +59,6 @@ class IssueNestedSetConcurrencyTest < ActiveSupport::TestCase
end
end
def test_concurrent_subtasks_creation
root = Issue.generate!
assert_difference 'Issue.count', 30 do
threaded(3) do
10.times do
Issue.generate! :parent_issue_id => root.id
end
end
end
root.reload
assert_equal [1, 62], [root.lft, root.rgt]
children_bounds = root.children.sort_by(&:lft).map {|c| [c.lft, c.rgt]}.flatten
assert_equal (2..61).to_a, children_bounds
end
private
def threaded(count, &block)