Geo: Fix blob delete events
Problem
(I have not confirmed this problem by testing it yet, I'm just looking at the code)
- When a PackageFile is deleted on the primary, a delete event is published, and the PackageFile record disappears from the DB.
- On a secondary, the delete event is likely (maybe always?) to be processed after the record is deleted from the read-replica DB.
-
Geo::EventServiceinstantiates a Replicator, callsconsume, which callsconsume_event_deleted, which checksin_replicables_for_geo_node?which callsmodel_record.in_replicables_for_geo_node?which will fail whenmodel_recordisnil.
Proposal
-
Don't call in_replicables_for_geo_node?fromconsume_event_deletedbecausemodel_recordwill often or always benil, somodel_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_destroywill fail callingmodel_record.idwhenmodel_recordisnil, so we should usemodel_record_id -
Fix blob_path -
Add tests that should have caught these items
Edited by Michael Kozono