Skip to content

Conversation

@cursor
Copy link
Contributor

@cursor cursor bot commented Oct 15, 2025

Fixes OperationalError: canceling statement due to user request during sentry cleanup for EventAttachment.

The root cause was the BulkDeleteQuery's iterator attempting to fetch 10,000 records at a time from the massive sentry_eventattachment table, leading to database statement timeouts.

This PR:

  • Reduces the default batch_size in BulkDeleteQuery.iterator() from 10,000 to 1,000.
  • Sets a specific batch_size of 100 for EventAttachment during cleanup, as it's an exceptionally large table.
  • Adds a test to verify custom batch_size functionality.

These changes ensure cleanup queries are less resource-intensive and complete within database timeouts, improving the reliability of data retention.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.


Open in Cursor Open in Web

@cursor
Copy link
Contributor Author

cursor bot commented Oct 15, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@cursor cursor bot requested a review from trillville October 15, 2025 19:01
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 15, 2025
@getsantry
Copy link
Contributor

getsantry bot commented Nov 6, 2025

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot added the Stale label Nov 6, 2025
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 Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants