Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/namespace/traversal_hierarchy.rb')
-rw-r--r--app/models/namespace/traversal_hierarchy.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/app/models/namespace/traversal_hierarchy.rb b/app/models/namespace/traversal_hierarchy.rb
index d2de85b5dd4..86fb562f4f4 100644
--- a/app/models/namespace/traversal_hierarchy.rb
+++ b/app/models/namespace/traversal_hierarchy.rb
@@ -39,9 +39,16 @@ class Namespace
AND namespaces.traversal_ids::bigint[] <> cte.traversal_ids
SQL
- Namespace.transaction do
- @root.lock!("FOR NO KEY UPDATE")
- Namespace.connection.exec_query(sql)
+ # Hint: when a user is created, it also creates a Namespaces::UserNamespace in
+ # `ensure_namespace_correct`. This method is then called within the same
+ # transaction of the user INSERT.
+ Gitlab::Database::QueryAnalyzers::PreventCrossDatabaseModification.temporary_ignore_tables_in_transaction(
+ %w[namespaces], url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/424279'
+ ) do
+ Namespace.transaction do
+ @root.lock!("FOR NO KEY UPDATE")
+ Namespace.connection.exec_query(sql)
+ end
end
rescue ActiveRecord::Deadlocked
db_deadlock_counter.increment(source: 'Namespace#sync_traversal_ids!')