Commit a7c4391c authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'mk/treat-missing-files-as-sync-failures-in-ssf' into 'master'

Geo: Treat missing files as sync failures

See merge request gitlab-org/gitlab!76801
parents 48a1bb1b af2a926a
......@@ -31,7 +31,11 @@ module Geo
download_result = ::Gitlab::Geo::Replication::BlobDownloader.new(replicator: @replicator).execute
mark_as_synced = download_result.success || download_result.primary_missing_file
mark_as_synced = download_result.success
if download_result.primary_missing_file && Feature.disabled?(:geo_treat_missing_files_as_sync_failed, default_enabled: :yaml)
mark_as_synced = true
end
if mark_as_synced
registry.synced!
......
---
name: geo_treat_missing_files_as_sync_failed
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/76801
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/348590
milestone: '14.6'
type: development
group: group::geo
default_enabled: false
......@@ -46,18 +46,58 @@ RSpec.describe Geo::BlobDownloadService do
end
context "when the downloader returns failure" do
let(:result) { double(:result, success: false, primary_missing_file: false, bytes_downloaded: 123, reason: "foo", extra_details: nil) }
context "when the file is not missing on the primary" do
let(:result) { double(:result, success: false, primary_missing_file: false, bytes_downloaded: 123, reason: "foo", extra_details: nil) }
it "creates the registry" do
expect do
it "creates the registry" do
expect do
subject.execute
end.to change { registry_class.count }.by(1)
end
it "sets sync state to failed" do
subject.execute
end.to change { registry_class.count }.by(1)
expect(registry_class.last).to be_failed
end
end
it "sets sync state to failed" do
subject.execute
context "when the file is missing on the primary" do
context "when the feature flag geo_treat_missing_files_as_sync_failed is enabled" do
let(:result) { double(:result, success: false, primary_missing_file: true, bytes_downloaded: 123, reason: "foo", extra_details: nil) }
it "creates the registry" do
expect do
subject.execute
end.to change { registry_class.count }.by(1)
end
it "sets sync state to failed" do
subject.execute
expect(registry_class.last).to be_failed
end
end
context "when the feature flag geo_treat_missing_files_as_sync_failed is disabled" do
let(:result) { double(:result, success: false, primary_missing_file: true, bytes_downloaded: 123, reason: "foo", extra_details: nil) }
before do
stub_feature_flags(geo_treat_missing_files_as_sync_failed: false)
end
it "creates the registry" do
expect do
subject.execute
end.to change { registry_class.count }.by(1)
end
it "sets sync state to synced" do
subject.execute
expect(registry_class.last).to be_failed
expect(registry_class.last).to be_synced
end
end
end
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