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(semver): Backfill missed semver releases #28798

Merged
merged 1 commit into from
Sep 27, 2021

Conversation

ahmedetefy
Copy link
Contributor

@ahmedetefy ahmedetefy commented Sep 23, 2021

Migration to backfill semver columns for releases because some releases were not populated incorrectly from July 21st of 2021 (when the last backfill occurred) as a result of bug that did not run the semver version parser on Release creation

Basically a replica of #27518

Related Ticket: https://getsentry.atlassian.net/browse/WOR-1373?atlOrigin=eyJpIjoiZmVjOWY1N2NiN2M2NDBiNDgzYzM3ZDgyM2FhNjI3NjIiLCJwIjoiamlyYS1zbGFjay1pbnQifQ
Bug fix: #28722

@github-actions
Copy link
Contributor

This PR has a migration; here is the generated SQL

--
-- MIGRATION NOW PERFORMS OPERATION THAT CANNOT BE WRITTEN AS SQL:
-- Raw Python operation
--

Comment on lines 56 to 62
queryset = RangeQuerySetWrapperWithProgressBar(
Release.objects.filter(
version__contains="@",
version__regex=SEMVER_REGEX,
major=None,
date_added__gte=datetime(2021, 7, 21, tzinfo=pytz.utc),
).values_list(
Copy link
Member

Choose a reason for hiding this comment

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

I'd recommend we just iterate over the whole table like the previous backfills do. 2021/07/21 is only applicable to getsentry and not to on-prem/st users, and that regex is pretty expensive to run, and will run for each batch that RangeQuerySetWrapperWithProgressBar processes.

It'd be fine to just entirely duplicate src/sentry/migrations/0223_semver_backfill_2.py as is and just have ops run that again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wedamija what if we narrow it down just by keeping major=None filter, surely it is not needed to re-process the already parsed ones .. that brings us down to about 6.5 mill releases

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Scratch that, that's incorrect.. difference is not that massive

Copy link
Member

Choose a reason for hiding this comment

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

@ahmedetefy The other thing is that when we use RangeQuerySetWrapperWithProgressBar it orders by id so that we can iterate through in batches. So typically the index used will be on pk, and we won't be able to make use of other indexes.

In practice, for this table it's not a big deal. This backfill takes < 1 day to run from what I remember, and it's written fairly efficiently since it only makes an update if the parsed fields change, and batches updates in groups of 100.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right

Migration to backfill semver columns that
were not populated incorrectly as a result of bug
that did not run the semver version parser on Release
creation
@ahmedetefy ahmedetefy merged commit a61f66c into master Sep 27, 2021
@ahmedetefy ahmedetefy deleted the ahmed-backfill-semver-releases branch September 27, 2021 11:22
vuluongj20 pushed a commit that referenced this pull request Sep 30, 2021
Migration to backfill semver columns that
were not populated incorrectly as a result of bug
that did not run the semver version parser on Release
creation
@github-actions github-actions bot locked and limited conversation to collaborators Oct 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants