Commit b8375a93 authored by Mikołaj Wawrzyniak's avatar Mikołaj Wawrzyniak

Merge branch 'lb_for_foss_available' into 'master'

Remove ENABLE_LOAD_BALANCING_FOR_FOSS as it is now ready for production use

See merge request gitlab-org/gitlab!63627
parents bce1c844 5548633d
...@@ -7,7 +7,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w ...@@ -7,7 +7,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
# Database Load Balancing **(FREE SELF)** # Database Load Balancing **(FREE SELF)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/1283) in [GitLab Premium](https://about.gitlab.com/pricing/) 9.0. > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/1283) in [GitLab Premium](https://about.gitlab.com/pricing/) 9.0.
> - [Moved](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/60894) from GitLab Premium to GitLab Free in 14.0. See the [instructions below](#load-balancing-in-gitlab). > - [Moved](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/60894) from GitLab Premium to GitLab Free in 14.0.
Distribute read-only queries among multiple database servers. Distribute read-only queries among multiple database servers.
...@@ -104,17 +104,6 @@ the following. This will balance the load between `host1.example.com` and ...@@ -104,17 +104,6 @@ the following. This will balance the load between `host1.example.com` and
1. Save the file and [restart GitLab](restart_gitlab.md#installations-from-source) for the changes to take effect. 1. Save the file and [restart GitLab](restart_gitlab.md#installations-from-source) for the changes to take effect.
### Load balancing in GitLab Free
Database load balancing was moved from GitLab Premium to GitLab Free in
14.0 with some [known limitations](https://gitlab.com/gitlab-org/gitlab/-/issues/327902).
For example, requesting new jobs for runners may fail. Hence, this feature is **not ready for production use** in GitLab Free.
To use database load balancing in GitLab Free, set the `ENABLE_LOAD_BALANCING_FOR_FOSS`
[environment
variable](https://docs.gitlab.com/omnibus/settings/environment-variables.html)
to `true`.
### Enable the load balancer for Sidekiq ### Enable the load balancer for Sidekiq
Sidekiq mostly writes to the database, which means that most of its traffic hits the Sidekiq mostly writes to the database, which means that most of its traffic hits the
......
...@@ -97,16 +97,9 @@ module Gitlab ...@@ -97,16 +97,9 @@ module Gitlab
# posting the write location of the database if load balancing is # posting the write location of the database if load balancing is
# configured. # configured.
def self.configured? def self.configured?
return false unless feature_available?
hosts.any? || service_discovery_enabled? hosts.any? || service_discovery_enabled?
end end
# Temporarily disabled for FOSS until move from EE to FOSS is complete
def self.feature_available?
Gitlab.ee? || Gitlab::Utils.to_boolean(ENV['ENABLE_LOAD_BALANCING_FOR_FOSS'], default: false)
end
def self.start_service_discovery def self.start_service_discovery
return unless service_discovery_enabled? return unless service_discovery_enabled?
......
...@@ -182,31 +182,6 @@ RSpec.describe Gitlab::Database::LoadBalancing do ...@@ -182,31 +182,6 @@ RSpec.describe Gitlab::Database::LoadBalancing do
expect(described_class.enable?).to eq(true) expect(described_class.enable?).to eq(true)
end end
end end
context 'FOSS' do
before do
allow(Gitlab).to receive(:ee?).and_return(false)
stub_env('ENABLE_LOAD_BALANCING_FOR_FOSS', 'false')
end
it 'is disabled' do
expect(described_class.enable?).to eq(false)
end
end
context 'EE' do
before do
allow(Gitlab).to receive(:ee?).and_return(true)
end
it 'is enabled' do
allow(described_class).to receive(:hosts).and_return(%w(foo))
allow(Gitlab::Runtime).to receive(:sidekiq?).and_return(false)
expect(described_class.enable?).to eq(true)
end
end
end end
describe '.configured?' do describe '.configured?' do
......
...@@ -6,8 +6,6 @@ RSpec.shared_context 'clear DB Load Balancing configuration' do ...@@ -6,8 +6,6 @@ RSpec.shared_context 'clear DB Load Balancing configuration' do
proxy.load_balancer.release_host if proxy proxy.load_balancer.release_host if proxy
::Gitlab::Database::LoadBalancing.instance_variable_set(:@proxy, nil) ::Gitlab::Database::LoadBalancing.instance_variable_set(:@proxy, nil)
::Gitlab::Database::LoadBalancing.remove_instance_variable(:@feature_available) if ::Gitlab::Database::LoadBalancing.instance_variable_defined?(:@feature_available)
::Gitlab::Database::LoadBalancing::Session.clear_session ::Gitlab::Database::LoadBalancing::Session.clear_session
end end
......
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