Skip to content

Commit f4f0faf

Browse files
authored
chore(cleanup): Drop option for deleting group hash metadata (#101918)
This was added in #101720 and it's not needed anymore.
1 parent 95e07e0 commit f4f0faf

File tree

3 files changed

+15
-35
lines changed

3 files changed

+15
-35
lines changed

src/sentry/deletions/defaults/group.py

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -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

src/sentry/options/defaults.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,6 @@
342342
type=Int,
343343
flags=FLAG_AUTOMATOR_MODIFIABLE,
344344
)
345-
register(
346-
"deletions.group.delete_group_hashes_metadata_first",
347-
default=False,
348-
type=Bool,
349-
flags=FLAG_AUTOMATOR_MODIFIABLE,
350-
)
351345

352346
# Filestore (default)
353347
register("filestore.backend", default="filesystem", flags=FLAG_NOSTORE)

tests/sentry/deletions/test_group.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,6 @@ def test_delete_grouphashes_and_metadata(self) -> None:
331331
assert not GroupHash.objects.filter(id=grouphash_b.id).exists()
332332
assert not GroupHashMetadata.objects.filter(id=metadata_b_id).exists()
333333

334-
def test_delete_grouphashes_and_metadata_and_metadata_but_delete_metadata_first(self) -> None:
335-
"""
336-
Test that when deleting group hashes, the group hash metadata is deleted first (which will not update the references to the other group hashes)
337-
"""
338-
with self.options({"deletions.group.delete_group_hashes_metadata_first": True}):
339-
self.test_delete_grouphashes_and_metadata()
340-
341334

342335
class DeleteIssuePlatformTest(TestCase, SnubaTestCase, OccurrenceTestMixin):
343336
referrer = Referrer.TESTING_TEST.value

0 commit comments

Comments
 (0)