Commit 594bc10f authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'mk/do-not-create-registry-on-checksum-succeeded' into 'master'

Geo: Fix duplicate Package File Registry rows

See merge request gitlab-org/gitlab!54654
parents 9a319a49 eb528805
...@@ -182,6 +182,7 @@ module Geo ...@@ -182,6 +182,7 @@ module Geo
# Called by Gitlab::Geo::Replicator#consume # Called by Gitlab::Geo::Replicator#consume
def consume_event_checksum_succeeded(**params) def consume_event_checksum_succeeded(**params)
return unless Gitlab::Geo.secondary? return unless Gitlab::Geo.secondary?
return unless registry.persisted?
registry.verification_pending! registry.verification_pending!
end end
......
...@@ -457,10 +457,15 @@ RSpec.shared_examples 'a verifiable replicator' do ...@@ -457,10 +457,15 @@ RSpec.shared_examples 'a verifiable replicator' do
end end
context 'on a Geo secondary' do context 'on a Geo secondary' do
before do
stub_secondary_node
end
context 'with a persisted registry' do
let(:registry) { replicator.registry } let(:registry) { replicator.registry }
before do before do
stub_secondary_node registry.save!
end end
context 'with a registry which is verified' do context 'with a registry which is verified' do
...@@ -487,6 +492,15 @@ RSpec.shared_examples 'a verifiable replicator' do ...@@ -487,6 +492,15 @@ RSpec.shared_examples 'a verifiable replicator' do
end end
end end
end end
context 'with an unpersisted registry' do
it 'does not persist the registry' do
replicator.consume_event_checksum_succeeded
expect(replicator.registry.persisted?).to be_falsey
end
end
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