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 'lib/gitlab/database/connection.rb')
-rw-r--r--lib/gitlab/database/connection.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/gitlab/database/connection.rb b/lib/gitlab/database/connection.rb
index f6183503035..521512f5644 100644
--- a/lib/gitlab/database/connection.rb
+++ b/lib/gitlab/database/connection.rb
@@ -34,12 +34,17 @@ module Gitlab
Gitlab::Runtime.max_threads + headroom
end
- def uncached_config
- scope.connection_db_config.configuration_hash.with_indifferent_access
- end
-
def config
- @config ||= uncached_config
+ # The result of this method must not be cached, as other methods may use
+ # it after making configuration changes and expect those changes to be
+ # present. For example, `disable_prepared_statements` expects the
+ # configuration settings to always be up to date.
+ #
+ # See the following for more information:
+ #
+ # - https://gitlab.com/gitlab-org/release/retrospectives/-/issues/39
+ # - https://gitlab.com/gitlab-com/gl-infra/production/-/issues/5238
+ scope.connection_db_config.configuration_hash.with_indifferent_access
end
def pool_size
@@ -72,7 +77,7 @@ module Gitlab
# Disables prepared statements for the current database connection.
def disable_prepared_statements
- scope.establish_connection(uncached_config.merge(prepared_statements: false))
+ scope.establish_connection(config.merge(prepared_statements: false))
end
def read_only?