Skip to content

Geo: Fix blob delete events

Problem

(I have not confirmed this problem by testing it yet, I'm just looking at the code)

  1. When a PackageFile is deleted on the primary, a delete event is published, and the PackageFile record disappears from the DB.
  2. On a secondary, the delete event is likely (maybe always?) to be processed after the record is deleted from the read-replica DB.
  3. Geo::EventService instantiates a Replicator, calls consume, which calls consume_event_deleted, which checks in_replicables_for_geo_node? which calls model_record.in_replicables_for_geo_node? which will fail when model_record is nil.

Proposal

  • Don't call in_replicables_for_geo_node? from consume_event_deleted because model_record will often or always be nil, so model_record.in_replicables_for_geo_node? is not relevant to whether we should try to delete it from the secondary.
  • If we do the previous item, then replicate_destroy will fail calling model_record.id when model_record is nil, so we should use model_record_id
  • Fix blob_path
  • Add tests that should have caught these items
Edited by Michael Kozono