-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(deletions): Cleanup more groups per project #103851
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -739,13 +739,6 @@ def run_bulk_deletes_by_project( | |||
| if project_deletion_query is not None and len(to_delete_by_project): | ||||
| debug_output("Running bulk deletes in DELETES_BY_PROJECT") | ||||
|
|
||||
| # Count total projects for progress tracking | ||||
| total_projects = project_deletion_query.count() | ||||
| debug_output(f"Processing {total_projects} project(s)") | ||||
|
|
||||
| processed_count = 0 | ||||
| last_reported_percentage = 0 | ||||
|
|
||||
| for project_id_for_deletion in RangeQuerySetWrapper( | ||||
| project_deletion_query.values_list("id", flat=True), | ||||
| result_value_getter=lambda item: item, | ||||
|
|
@@ -767,7 +760,7 @@ def run_bulk_deletes_by_project( | |||
| order_by=order_by, | ||||
| ) | ||||
|
|
||||
| for chunk in q.iterator(chunk_size=100): | ||||
| for chunk in q.iterator(chunk_size=100, batch_size=30000): | ||||
|
Member
Author
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. The default is 10k: sentry/src/sentry/db/deletion.py Line 94 in 43e4297
Let's try doing 3x and see if things improve. |
||||
| task_queue.put((imp, chunk)) | ||||
| except Exception: | ||||
| capture_exception( | ||||
|
|
@@ -780,17 +773,6 @@ def run_bulk_deletes_by_project( | |||
| sample_rate=1.0, | ||||
| ) | ||||
|
|
||||
| # Update progress tracking after processing all models for this project | ||||
| processed_count += 1 | ||||
| current_percentage = int((processed_count / total_projects) * 100) | ||||
|
|
||||
| # Report progress every 5% to avoid excessive output | ||||
| if current_percentage >= last_reported_percentage + 5: | ||||
| debug_output( | ||||
| f"Progress: {current_percentage}% ({processed_count}/{total_projects} projects processed) (last_project_id: {project_id_for_deletion})" | ||||
| ) | ||||
| last_reported_percentage = current_percentage | ||||
|
|
||||
| # Ensure all tasks are completed before exiting | ||||
| task_queue.join() | ||||
|
|
||||
|
|
||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We don't use any of this.