-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
fix(deletions): Switch to bulk deletions for GroupHistory #102580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This is how it used to be before #76608. Now that we have fixed the circular relationship (#102470) I believe we should give this approach another attempt. Fixes [SENTRY-5BX2](https://sentry.sentry.io/issues/6993998110/): For posterity: ``` OperationalError canceling statement due to user request SQL: SELECT "sentry_grouphistory"."id" AS "id" FROM "sentry_grouphistory" WHERE "sentry_grouphistory"."group_id" = %s ORDER BY 1 ASC LIMIT 100 ``` The group in question has only been seen 4 times yet it has 905,729 rows of group history.
| if options.get("deletions.group-history.use-bulk-deletion"): | ||
| manager.register(models.GroupHistory, defaults.GroupHistoryDeletionTask) | ||
| else: | ||
| manager.register(models.GroupHistory, BulkModelDeletionTask) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it works, we can remove the custom class.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #102580 +/- ##
===========================================
+ Coverage 80.88% 80.89% +0.01%
===========================================
Files 8861 8865 +4
Lines 390436 390860 +424
Branches 24832 24832
===========================================
+ Hits 315786 316195 +409
- Misses 74285 74300 +15
Partials 365 365 |
markstory
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth a shot now that the recursion issue is addressed.
wedamija
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the group has this many rows, there's a good chance that the query you have will still time out, since there is no index on group_id, id. I don't mind if you want to try, but I think the solution here would be to add that index if this doesn't work. You could even just do it temporarily until the deletions finish.
Actually, how about this - just remove the ordering from your query? You don't care about the order here, you just want to delete rows.
to
|
Sorry, I was looking at the sentry error that you linked here and this feedback was to fix the error seen there. Afaict, the |
|
Related code: sentry/src/sentry/utils/query.py Lines 272 to 294 in 2eecdd2
|
This is part of the required steps to remove a column from Sentry: https://develop.sentry.dev/backend/application-domains/database-migrations/#deleting-columns. This is a follow-up to #102474. This fixes [SENTRY-5BX8](https://sentry.sentry.io/issues/6994851757/) and [SENTRY-5BXW](https://sentry.sentry.io/issues/6995699817/) which are happening since we switched to the bulk deletion model (#102580).
This is part of the required steps to remove a column from Sentry: https://develop.sentry.dev/backend/application-domains/database-migrations/#deleting-columns. This is a follow-up to #102474. This fixes [SENTRY-5BX8](https://sentry.sentry.io/issues/6994851757/) and [SENTRY-5BXW](https://sentry.sentry.io/issues/6995699817/) which are happening since we switched to the bulk deletion model (#102580).
This is how it used to be before #76608. Now that we have fixed the circular relationship (#102470) I believe we should give this approach another attempt. Fixes [SENTRY-5BX2](https://sentry.sentry.io/issues/6993998110/): For posterity: ``` OperationalError canceling statement due to user request SQL: SELECT "sentry_grouphistory"."id" AS "id" FROM "sentry_grouphistory" WHERE "sentry_grouphistory"."group_id" = %s ORDER BY 1 ASC LIMIT 100 ``` The group in question has only been seen 4 times yet it has 905,729 rows of group history. This is caused by the priority of the group changing back and forth between high and medium priority. We're investigating the root cause of it.
This is part of the required steps to remove a column from Sentry: https://develop.sentry.dev/backend/application-domains/database-migrations/#deleting-columns. This is a follow-up to #102474. This fixes [SENTRY-5BX8](https://sentry.sentry.io/issues/6994851757/) and [SENTRY-5BXW](https://sentry.sentry.io/issues/6995699817/) which are happening since we switched to the bulk deletion model (#102580).
This is how it used to be before #76608. Now that we have fixed the circular relationship (#102470) I believe we should give this approach another attempt. Fixes [SENTRY-5BX2](https://sentry.sentry.io/issues/6993998110/): For posterity: ``` OperationalError canceling statement due to user request SQL: SELECT "sentry_grouphistory"."id" AS "id" FROM "sentry_grouphistory" WHERE "sentry_grouphistory"."group_id" = %s ORDER BY 1 ASC LIMIT 100 ``` The group in question has only been seen 4 times yet it has 905,729 rows of group history. This is caused by the priority of the group changing back and forth between high and medium priority. We're investigating the root cause of it.
This is part of the required steps to remove a column from Sentry: https://develop.sentry.dev/backend/application-domains/database-migrations/#deleting-columns. This is a follow-up to #102474. This fixes [SENTRY-5BX8](https://sentry.sentry.io/issues/6994851757/) and [SENTRY-5BXW](https://sentry.sentry.io/issues/6995699817/) which are happening since we switched to the bulk deletion model (#102580).
This is how it used to be before #76608. Now that we have fixed the circular relationship (#102470) I believe we should give this approach another attempt.
Fixes SENTRY-5BX2:
For posterity:
The group in question has only been seen 4 times yet it has 905,729 rows of group history. This is caused by the priority of the group changing back and forth between high and medium priority. We're investigating the root cause of it.