Commit a91c05ea authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg

Remove Geo FsShard checks

Geo depends on FsShard checks to detect failures on shards, but this
isn't needed as Gitaly can report this, and soon its obsolete anyway.
parent 25236feb
...@@ -7,7 +7,6 @@ module Geo ...@@ -7,7 +7,6 @@ module Geo
include ::Gitlab::Geo::LogHelpers include ::Gitlab::Geo::LogHelpers
HEALTHY_SHARD_CHECKS = [ HEALTHY_SHARD_CHECKS = [
Gitlab::HealthChecks::FsShardsCheck,
Gitlab::HealthChecks::GitalyCheck Gitlab::HealthChecks::GitalyCheck
].freeze ].freeze
......
...@@ -26,13 +26,12 @@ describe Geo::RepositorySyncWorker, :geo, :clean_gitlab_redis_cache do ...@@ -26,13 +26,12 @@ describe Geo::RepositorySyncWorker, :geo, :clean_gitlab_redis_cache do
it 'skips backfill for repositories on other shards' do it 'skips backfill for repositories on other shards' do
create(:project, group: synced_group, repository_storage: 'broken') create(:project, group: synced_group, repository_storage: 'broken')
unhealthy_dirty = create(:project, group: synced_group, repository_storage: 'broken') unhealthy_dirty = create(:project, group: synced_group, repository_storage: 'broken')
create(:geo_project_registry, :synced, :repository_dirty, project: unhealthy_dirty) create(:geo_project_registry, :synced, :repository_dirty, project: unhealthy_dirty)
# Make the shard unhealthy allow(Gitlab::GitalyClient).to receive(:call) do
Gitlab::Shell.new.rm_directory('broken', '/') raise GRPC::Unavailable.new('No Gitaly available')
end
expect(Geo::RepositoryShardSyncWorker).to receive(:perform_async).with(project_in_synced_group.repository.storage)
expect(Geo::RepositoryShardSyncWorker).not_to receive(:perform_async).with('broken') expect(Geo::RepositoryShardSyncWorker).not_to receive(:perform_async).with('broken')
subject.perform subject.perform
...@@ -42,8 +41,6 @@ describe Geo::RepositorySyncWorker, :geo, :clean_gitlab_redis_cache do ...@@ -42,8 +41,6 @@ describe Geo::RepositorySyncWorker, :geo, :clean_gitlab_redis_cache do
secondary.update!(selective_sync_type: 'shards', selective_sync_shards: [healthy_shard_name]) secondary.update!(selective_sync_type: 'shards', selective_sync_shards: [healthy_shard_name])
# Report both shards as healthy # Report both shards as healthy
expect(Gitlab::HealthChecks::FsShardsCheck).to receive(:readiness)
.and_return([result(true, healthy_shard_name), result(true, 'broken')])
expect(Gitlab::HealthChecks::GitalyCheck).to receive(:readiness) expect(Gitlab::HealthChecks::GitalyCheck).to receive(:readiness)
.and_return([result(true, healthy_shard_name), result(true, 'broken')]) .and_return([result(true, healthy_shard_name), result(true, 'broken')])
...@@ -77,8 +74,6 @@ describe Geo::RepositorySyncWorker, :geo, :clean_gitlab_redis_cache do ...@@ -77,8 +74,6 @@ describe Geo::RepositorySyncWorker, :geo, :clean_gitlab_redis_cache do
create(:geo_project_registry, :synced, :repository_dirty, project: unhealthy_dirty) create(:geo_project_registry, :synced, :repository_dirty, project: unhealthy_dirty)
# Report only one healthy shard # Report only one healthy shard
expect(Gitlab::HealthChecks::FsShardsCheck).to receive(:readiness)
.and_return([result(true, healthy_shard_name), result(true, 'broken')])
expect(Gitlab::HealthChecks::GitalyCheck).to receive(:readiness) expect(Gitlab::HealthChecks::GitalyCheck).to receive(:readiness)
.and_return([result(true, healthy_shard_name), result(false, 'broken')]) .and_return([result(true, healthy_shard_name), result(false, 'broken')])
......
...@@ -28,10 +28,10 @@ describe Geo::RepositoryVerification::Primary::BatchWorker, :postgresql, :clean_ ...@@ -28,10 +28,10 @@ describe Geo::RepositoryVerification::Primary::BatchWorker, :postgresql, :clean_
create(:repository_state, :repository_outdated, project: unhealthy_outdated) create(:repository_state, :repository_outdated, project: unhealthy_outdated)
# Make the shard unhealthy allow(Gitlab::GitalyClient).to receive(:call) do
Gitlab::Shell.new.rm_directory('broken', '/') raise GRPC::Unavailable.new('No Gitaly available')
end
expect(Geo::RepositoryVerification::Primary::ShardWorker).to receive(:perform_async).with(healthy_shard)
expect(Geo::RepositoryVerification::Primary::ShardWorker).not_to receive(:perform_async).with('broken') expect(Geo::RepositoryVerification::Primary::ShardWorker).not_to receive(:perform_async).with('broken')
subject.perform subject.perform
...@@ -61,8 +61,6 @@ describe Geo::RepositoryVerification::Primary::BatchWorker, :postgresql, :clean_ ...@@ -61,8 +61,6 @@ describe Geo::RepositoryVerification::Primary::BatchWorker, :postgresql, :clean_
create(:repository_state, :repository_outdated, project: unhealthy_outdated) create(:repository_state, :repository_outdated, project: unhealthy_outdated)
# Report only one healthy shard # Report only one healthy shard
expect(Gitlab::HealthChecks::FsShardsCheck).to receive(:readiness)
.and_return([result(true, healthy_shard), result(true, 'broken')])
expect(Gitlab::HealthChecks::GitalyCheck).to receive(:readiness) expect(Gitlab::HealthChecks::GitalyCheck).to receive(:readiness)
.and_return([result(true, healthy_shard), result(false, 'broken')]) .and_return([result(true, healthy_shard), result(false, 'broken')])
......
...@@ -25,10 +25,10 @@ describe Geo::RepositoryVerification::Secondary::SchedulerWorker, :postgresql, : ...@@ -25,10 +25,10 @@ describe Geo::RepositoryVerification::Secondary::SchedulerWorker, :postgresql, :
it 'skips verification for repositories on other shards' do it 'skips verification for repositories on other shards' do
create(:project, repository_storage: 'broken') create(:project, repository_storage: 'broken')
# Make the shard unhealthy allow(Gitlab::GitalyClient).to receive(:call) do
Gitlab::Shell.new.rm_directory('broken', '/') raise GRPC::Unavailable.new('No Gitaly available')
end
expect(Geo::RepositoryVerification::Secondary::ShardWorker).to receive(:perform_async).with(healthy_shard)
expect(Geo::RepositoryVerification::Secondary::ShardWorker).not_to receive(:perform_async).with('broken') expect(Geo::RepositoryVerification::Secondary::ShardWorker).not_to receive(:perform_async).with('broken')
subject.perform subject.perform
...@@ -50,9 +50,6 @@ describe Geo::RepositoryVerification::Secondary::SchedulerWorker, :postgresql, : ...@@ -50,9 +50,6 @@ describe Geo::RepositoryVerification::Secondary::SchedulerWorker, :postgresql, :
it 'skips verification for projects with downed Gitaly server' do it 'skips verification for projects with downed Gitaly server' do
create(:project, repository_storage: 'broken') create(:project, repository_storage: 'broken')
# Report only one healthy shard
expect(Gitlab::HealthChecks::FsShardsCheck).to receive(:readiness)
.and_return([result(true, healthy_shard), result(true, 'broken')])
expect(Gitlab::HealthChecks::GitalyCheck).to receive(:readiness) expect(Gitlab::HealthChecks::GitalyCheck).to receive(:readiness)
.and_return([result(true, healthy_shard), result(false, 'broken')]) .and_return([result(true, healthy_shard), result(false, 'broken')])
...@@ -66,8 +63,6 @@ describe Geo::RepositoryVerification::Secondary::SchedulerWorker, :postgresql, : ...@@ -66,8 +63,6 @@ describe Geo::RepositoryVerification::Secondary::SchedulerWorker, :postgresql, :
secondary.update!(selective_sync_type: 'shards', selective_sync_shards: [healthy_shard]) secondary.update!(selective_sync_type: 'shards', selective_sync_shards: [healthy_shard])
# Report both shards as healthy # Report both shards as healthy
expect(Gitlab::HealthChecks::FsShardsCheck).to receive(:readiness)
.and_return([result(true, healthy_shard), result(true, 'broken')])
expect(Gitlab::HealthChecks::GitalyCheck).to receive(:readiness) expect(Gitlab::HealthChecks::GitalyCheck).to receive(:readiness)
.and_return([result(true, healthy_shard), result(true, 'broken')]) .and_return([result(true, healthy_shard), result(true, 'broken')])
......
...@@ -17,9 +17,8 @@ describe Geo::Scheduler::PerShardSchedulerWorker do ...@@ -17,9 +17,8 @@ describe Geo::Scheduler::PerShardSchedulerWorker do
expect(described_class).to include_module(::Gitlab::Geo::LogHelpers) expect(described_class).to include_module(::Gitlab::Geo::LogHelpers)
end end
it 'includes FsShards and Gitaly health checks' do it 'includes Gitaly health checks' do
expect(described_class::HEALTHY_SHARD_CHECKS).to include( expect(described_class::HEALTHY_SHARD_CHECKS).to include(
Gitlab::HealthChecks::FsShardsCheck,
Gitlab::HealthChecks::GitalyCheck Gitlab::HealthChecks::GitalyCheck
) )
end end
...@@ -36,7 +35,6 @@ describe Geo::Scheduler::PerShardSchedulerWorker do ...@@ -36,7 +35,6 @@ describe Geo::Scheduler::PerShardSchedulerWorker do
let(:unhealthy_shard) { Gitlab::HealthChecks::Result.new(false, '14:Connect Failed', shard: unhealthy_shard_name) } let(:unhealthy_shard) { Gitlab::HealthChecks::Result.new(false, '14:Connect Failed', shard: unhealthy_shard_name) }
before do before do
allow(Gitlab::HealthChecks::FsShardsCheck).to receive(:readiness).and_return([default_shard, other_shard, unhealthy_shard])
allow(Gitlab::HealthChecks::GitalyCheck).to receive(:readiness).and_return([default_shard, other_shard, unhealthy_shard]) allow(Gitlab::HealthChecks::GitalyCheck).to receive(:readiness).and_return([default_shard, other_shard, unhealthy_shard])
end end
...@@ -49,7 +47,7 @@ describe Geo::Scheduler::PerShardSchedulerWorker do ...@@ -49,7 +47,7 @@ describe Geo::Scheduler::PerShardSchedulerWorker do
end end
describe '#ready_shards' do describe '#ready_shards' do
let(:ready_shards) { [[default_shard, other_shard, unhealthy_shard], [default_shard, other_shard, unhealthy_shard]] } let(:ready_shards) { [[default_shard, other_shard, unhealthy_shard]] }
it "returns an array of ready shards" do it "returns an array of ready shards" do
expect(per_shard_scheduler_worker.ready_shards).to eq(ready_shards) expect(per_shard_scheduler_worker.ready_shards).to eq(ready_shards)
......
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