-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
feat(GAL): Add reset_and_backfill task for group action log #119355
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,3 +48,43 @@ def backfill_group_action_log_for_group( | |
| "total_created": total, | ||
| }, | ||
| ) | ||
|
|
||
|
|
||
| @instrumented_task( | ||
| name="sentry.tasks.backfill_group_action_log.reset_and_backfill_group_action_log", | ||
| namespace=issues_tasks, | ||
| silo_mode=SiloMode.CELL, | ||
| ) | ||
| def reset_and_backfill_group_action_log( | ||
| group_id: int, | ||
| **kwargs: object, | ||
| ) -> None: | ||
| from sentry.issues.models.groupactionlogentry import GroupActionLogEntry | ||
| from sentry.issues.models.groupderiveddata import GroupDerivedData | ||
|
|
||
| try: | ||
| group = Group.objects.get(id=group_id) | ||
| except Group.DoesNotExist: | ||
| logger.warning( | ||
| "backfill_group_action_log.group_not_found", | ||
| extra={"group_id": group_id}, | ||
| ) | ||
| return | ||
|
|
||
| GroupDerivedData.objects.filter(group_id=group_id).delete() | ||
|
|
||
| deleted_count, _ = GroupActionLogEntry.objects.filter( | ||
| group_id=group_id, | ||
| source="backfill:activity", | ||
| ).delete() | ||
|
cursor[bot] marked this conversation as resolved.
|
||
|
|
||
| logger.info( | ||
| "backfill_group_action_log.reset_completed", | ||
| extra={ | ||
| "group_id": group_id, | ||
| "project_id": group.project_id, | ||
| "deleted_count": deleted_count, | ||
| }, | ||
| ) | ||
|
|
||
|
sentry[bot] marked this conversation as resolved.
|
||
| backfill_group_action_log_for_group.delay(group_id=group_id) | ||
|
cursor[bot] marked this conversation as resolved.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Derived data not rebuiltHigh Severity
Reviewed by Cursor Bugbot for commit b9bc2ef. Configure here. |
||


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.
Bug: The
reset_and_backfill_group_action_logtask pre-emptively deletesGroupDerivedData, which prevents the subsequent async backfill from triggering the necessary derived data rebuild task.Severity: HIGH
Suggested Fix
Remove the initial
GroupDerivedData.objects.filter(group_id=group_id).delete()call from thereset_and_backfill_group_action_logtask. The existing logic within the async backfill process, specifically the call toinvalidate_group_derived_data, should be sufficient to handle the deletion and subsequent reprocessing trigger. This ensures the condition for scheduling the rebuild task is met correctly.Prompt for AI Agent