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
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-03-08 15:20:17 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-03-08 15:20:17 +0300
commit6728ed6fe203d0613ee63c89a08a70fffb93405c (patch)
tree9eddfee7a854efd47d85899c1524fd4bd10ce8e4 /lib
parent60028378dd5e5e7844810e4a2aa2934a58f738ca (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/database.rb10
-rw-r--r--lib/gitlab/gon_helper.rb1
-rw-r--r--lib/gitlab/import_export/group/relation_tree_restorer.rb2
3 files changed, 12 insertions, 1 deletions
diff --git a/lib/gitlab/database.rb b/lib/gitlab/database.rb
index 9b32d285ec0..950119e155e 100644
--- a/lib/gitlab/database.rb
+++ b/lib/gitlab/database.rb
@@ -195,6 +195,16 @@ module Gitlab
MAX_TIMESTAMP_VALUE > timestamp ? timestamp : MAX_TIMESTAMP_VALUE.dup
end
+ def self.all_uncached(&block)
+ # Calls to #uncached only disable caching for the current connection. Since the load balancer
+ # can potentially upgrade from read to read-write mode (using a different connection), we specify
+ # up-front that we'll explicitly use the primary for the duration of the operation.
+ Gitlab::Database::LoadBalancing::Session.current.use_primary do
+ base_models = database_base_models.values
+ base_models.reduce(block) { |blk, model| -> { model.uncached(&blk) } }.call
+ end
+ end
+
def self.allow_cross_joins_across_databases(url:)
# this method is implemented in:
# spec/support/database/prevent_cross_joins.rb
diff --git a/lib/gitlab/gon_helper.rb b/lib/gitlab/gon_helper.rb
index d59be09f85e..f5d74ad1563 100644
--- a/lib/gitlab/gon_helper.rb
+++ b/lib/gitlab/gon_helper.rb
@@ -58,6 +58,7 @@ module Gitlab
push_frontend_feature_flag(:new_header_search, default_enabled: :yaml)
push_frontend_feature_flag(:bootstrap_confirmation_modals, default_enabled: :yaml)
push_frontend_feature_flag(:sandboxed_mermaid, default_enabled: :yaml)
+ push_frontend_feature_flag(:source_editor_toolbar, default_enabled: :yaml)
end
# Exposes the state of a feature flag to the frontend code.
diff --git a/lib/gitlab/import_export/group/relation_tree_restorer.rb b/lib/gitlab/import_export/group/relation_tree_restorer.rb
index fa994d06199..b44874f598c 100644
--- a/lib/gitlab/import_export/group/relation_tree_restorer.rb
+++ b/lib/gitlab/import_export/group/relation_tree_restorer.rb
@@ -29,7 +29,7 @@ module Gitlab
end
def restore
- ActiveRecord::Base.uncached do
+ Gitlab::Database.all_uncached do
ActiveRecord::Base.no_touching do
update_params!