@@ -258,28 +258,21 @@ def delete_group_hashes(
258258 logger .warning ("Error scheduling task to delete hashes from seer" )
259259 finally :
260260 hash_ids = [gh [0 ] for gh in hashes_chunk ]
261- if options .get ("deletions.group.delete_group_hashes_metadata_first" ):
262- metrics .incr ("deletions.group.delete_group_hashes_metadata_first" , sample_rate = 1.0 )
263- # If we delete the grouphash metadata rows first we will not need to update the references to the other grouphashes.
264- # If we try to delete the group hashes first, then it will require the updating of the columns first.
265- #
266- # To understand this, let's say we have the following relationships:
267- # gh A -> ghm A -> no reference to another grouphash
268- # gh B -> ghm B -> gh C
269- # gh C -> ghm C -> gh A
270- #
271- # Deleting group hashes A, B & C (since they all point to the same group) will require:
272- # * Updating columns ghmB & ghmC to point to None
273- # * Deleting the group hash metadata rows
274- # * Deleting the group hashes
275- #
276- # If we delete the metadata first, we will not need to update the columns before deleting them.
277- try :
278- GroupHashMetadata .objects .filter (grouphash_id__in = hash_ids ).delete ()
279- except Exception :
280- # XXX: Let's make sure that no issues are caused by this and then remove it
281- logger .exception ("Error deleting group hash metadata" )
282-
261+ # If we delete the grouphash metadata rows first we will not need to update the references to the other grouphashes.
262+ # If we try to delete the group hashes first, then it will require the updating of the columns first.
263+ #
264+ # To understand this, let's say we have the following relationships:
265+ # gh A -> ghm A -> no reference to another grouphash
266+ # gh B -> ghm B -> gh C
267+ # gh C -> ghm C -> gh A
268+ #
269+ # Deleting group hashes A, B & C (since they all point to the same group) will require:
270+ # * Updating columns ghmB & ghmC to point to None
271+ # * Deleting the group hash metadata rows
272+ # * Deleting the group hashes
273+ #
274+ # If we delete the metadata first, we will not need to update the columns before deleting them.
275+ GroupHashMetadata .objects .filter (grouphash_id__in = hash_ids ).delete ()
283276 GroupHash .objects .filter (id__in = hash_ids ).delete ()
284277
285278 iterations += 1
0 commit comments