Skip to content

fix(deletions): Prevent DB call from deleting issue #95915

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

armenzg
Copy link
Member

@armenzg armenzg commented Jul 18, 2025

When deleting an issue, a failure to query the DB would prevent scheduling the group deletion task.

From the customer's perspective, it would look that the group has been deleted, however, all relationships would still be left behind.

The biggest problem would be that the group hashes are left behind, thus, any new events matching those group hashes would not create a new issue.

This is a better fix than the one proposed in #93541.

Fixes #93509.
Fixes ID-716

When deleting an issue, a failure to query the DB would prevent scheduling the group deletion task.

From the customer's perspective, it would look that the group has been deleted, however, all relationships would still be left behind.

The biggest problem would be that the group hashes are left behind, thus, any new events matching those group hashes would not create a new issue.

This is a better fix than the one proposed in #93541.

Fixes #93509.
Fixes [ID-716](https://linear.app/getsentry/issue/ID-716/)
@armenzg armenzg self-assigned this Jul 18, 2025
Copy link

linear bot commented Jul 18, 2025

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 18, 2025
@@ -73,6 +73,9 @@ def delete_group_list(
},
)

# Tell seer to delete grouping records for these groups
may_schedule_task_to_delete_hashes_from_seer(error_ids)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this call raises an exception (as it used to do), the exception will be caught by the endpoint and return a 500.

I moved this call here because I don't want the status of the group to be changed.

I have upcoming changes to make this function clearer and more robust.

@@ -1637,23 +1638,25 @@ def test_bulk_delete_performance_issues(self):
self.assert_groups_are_gone(groups)

@patch("sentry.api.helpers.group_index.delete.may_schedule_task_to_delete_hashes_from_seer")
@patch("sentry.utils.audit.log_service.record_audit_log")
def test_audit_log_even_if_exception_raised(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous test does not apply anymore.

@armenzg armenzg marked this pull request as ready for review July 18, 2025 19:30
@armenzg armenzg requested review from a team as code owners July 18, 2025 19:30
@armenzg armenzg requested a review from markstory July 18, 2025 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A DB failure in the group deletion endpoint should not prevent deleting group hashes
1 participant