Remove FDW remote schema check

Since GitLab 13.2 we don't rely on FDW query/models
parent b4665a80
......@@ -14,12 +14,6 @@ module Gitlab
return "Geo database version (#{database_version}) does not match latest migration (#{migration_version}).\nYou may have to run `gitlab-rake geo:db:migrate` as root on the secondary." unless database_migration_version_match?
return 'Geo database is not configured to use Foreign Data Wrapper.' unless Gitlab::Geo::Fdw.enabled?
unless Gitlab::Geo::Fdw.foreign_tables_up_to_date?
output = "Geo database has an outdated FDW remote schema."
output = "#{output} It contains #{foreign_schema_tables_count} of #{gitlab_schema_tables_count} expected tables." unless schema_tables_match?
return output
end
''
rescue => e
e.message
......@@ -109,18 +103,6 @@ module Gitlab
database_version.to_i == migration_version.to_i
end
def gitlab_schema_tables_count
@gitlab_schema_tables_count ||= Gitlab::Geo::Fdw.gitlab_schema_tables_count
end
def foreign_schema_tables_count
@foreign_schema_tables_count ||= Gitlab::Geo::Fdw.foreign_schema_tables_count
end
def schema_tables_match?
gitlab_schema_tables_count == foreign_schema_tables_count
end
def archive_recovery_replication_enabled?
!streaming_replication_enabled? && some_replication_active?
end
......
......@@ -103,7 +103,6 @@ RSpec.describe Gitlab::Geo::HealthCheck, :geo do
before do
allow(subject).to receive(:replication_working?).and_return(true)
allow(Gitlab::Geo::Fdw).to receive(:enabled?) { true }
allow(Gitlab::Geo::Fdw).to receive(:foreign_tables_up_to_date?) { true }
end
it 'returns an error if database is not fully migrated' do
......@@ -122,26 +121,6 @@ RSpec.describe Gitlab::Geo::HealthCheck, :geo do
expect(subject.perform_checks).to match(/Geo database is not configured to use Foreign Data Wrapper/)
end
context 'when foreign tables are not up-to-date' do
before do
allow(Gitlab::Geo::Fdw).to receive(:foreign_tables_up_to_date?) { false }
end
it 'returns an error when FDW remote table is not in sync but has same amount of tables' do
allow(Gitlab::Geo::Fdw).to receive(:foreign_schema_tables_count) { 1 }
allow(Gitlab::Geo::Fdw).to receive(:gitlab_schema_tables_count) { 1 }
expect(subject.perform_checks).to match(/Geo database has an outdated FDW remote schema\./)
end
it 'returns an error when FDW remote table is not in sync and has same different amount of tables' do
allow(Gitlab::Geo::Fdw).to receive(:foreign_schema_tables_count) { 1 }
allow(Gitlab::Geo::Fdw).to receive(:gitlab_schema_tables_count) { 2 }
expect(subject.perform_checks).to match(/Geo database has an outdated FDW remote schema\. It contains [0-9]+ of [0-9]+ expected tables/)
end
end
it 'finally returns an empty string when everything is healthy' do
expect(subject.perform_checks).to be_blank
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