Skip to content
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

fix(migration): iterate over project to avoid query timeouts #47720

Merged
merged 1 commit into from
Apr 20, 2023

Conversation

barkbarkimashark
Copy link
Contributor

OPS is running into timeouts trying to run this migration. This PR tries to avoid the timeouts by iterating over projects and then querying on groups.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 20, 2023
@barkbarkimashark barkbarkimashark marked this pull request as ready for review April 20, 2023 17:53
@barkbarkimashark barkbarkimashark requested a review from a team as a code owner April 20, 2023 17:53
Copy link
Member

@wedamija wedamija left a comment

Choose a reason for hiding this comment

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

The reason this would be timing out is because you're trying to filter on status=GroupStatus.IGNORED while using the RangeQuerySetWrapper. RangeQuerySetWrapper adds in a sort by id, and so since there's not an index on status, id it can result in bad query plans.

Sometimes it can be just easier to RangeQuerySetWrapper over .all() and skip rows that don't match the criteria in code.

This change might fix it, or it might run into the same problem since you're still using a RangeQuerySetWrapper when filtering down to projects. Up to you if you want to try it

@barkbarkimashark barkbarkimashark merged commit d1c1a08 into master Apr 20, 2023
@barkbarkimashark barkbarkimashark deleted the sharky/group-substatus-migration-optimize branch April 20, 2023 21:55
barkbarkimashark added a commit that referenced this pull request Apr 21, 2023
Opt to iterate over all groups and filter it down. Based on this comment
#47720 (review)
@armenzg armenzg added this to the Issue States and Filters milestone May 2, 2023
@github-actions github-actions bot locked and limited conversation to collaborators May 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants