Commit dd5308b7 authored by Stan Hu's avatar Stan Hu

Merge branch '199672-geo-initialization-order-issue-with-geo-database' into 'master'

Geo - Fix initialization order issue with Geo database

Closes #199672

See merge request gitlab-org/gitlab!24021
parents ba41cbc9 8ef028f2
...@@ -10,6 +10,16 @@ def log_pool_size(db, previous_pool_size, current_pool_size) ...@@ -10,6 +10,16 @@ def log_pool_size(db, previous_pool_size, current_pool_size)
Gitlab::AppLogger.debug(log_message.join(' ')) Gitlab::AppLogger.debug(log_message.join(' '))
end end
Gitlab.ee do
# We need to initialize the Geo database before
# setting the Geo DB connection pool size.
if File.exist?(Rails.root.join('config/database_geo.yml'))
Rails.application.configure do
config.geo_database = config_for(:database_geo)
end
end
end
# When running on multi-threaded runtimes like Puma or Sidekiq, # When running on multi-threaded runtimes like Puma or Sidekiq,
# set the number of threads per process as the minimum DB connection pool size. # set the number of threads per process as the minimum DB connection pool size.
# This is to avoid connectivity issues as was documented here: # This is to avoid connectivity issues as was documented here:
......
# frozen_string_literal: true # frozen_string_literal: true
Gitlab.ee do Gitlab.ee do
if File.exist?(Rails.root.join('config/database_geo.yml')) if Gitlab::Geo.connected? && Gitlab::Geo.primary?
Rails.application.configure do Gitlab::Geo.current_node&.update_clone_url!
config.geo_database = config_for(:database_geo)
end
end
begin
if Gitlab::Geo.connected? && Gitlab::Geo.primary?
Gitlab::Geo.current_node&.update_clone_url!
end
rescue => e
warn "WARNING: Unable to check/update clone_url_prefix for Geo: #{e}"
end end
rescue => e
warn "WARNING: Unable to check/update clone_url_prefix for Geo: #{e}"
end end
---
title: Fix DB connection pool size for Geo database
merge_request: 24021
author:
type: fixed
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment