-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
chore(deletions): Drop sentry_incidentseen and sentry_incidentsubscription leftover tables
#103559
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
Conversation
…cription` leftover tables These two models were already preivously deleted and a previous migration dropped them, but due to an issue with SafeDeleteModel they were not actually dropped. This migration drops them directly.
|
This PR has a migration; here is the generated SQL for for --
-- Raw SQL operation
--
DROP TABLE IF EXISTS sentry_incidentseen;
--
-- Raw SQL operation
--
DROP TABLE IF EXISTS sentry_incidentsubscription; |
vgrozdanic
left a comment
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.
Do we know why this PR #81623 didn't drop the tables?
| operations = [ | ||
| SafeRunSQL( | ||
| """ | ||
| DROP TABLE IF EXISTS sentry_incidentseen; |
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.
Should we also CASCADE deletes?
Not sure how was this used before, but previous PR that for to me unknown reason did't work generated following SQL:
--
-- Delete model IncidentSeen
--
DROP TABLE "sentry_incidentseen" CASCADE;
--
-- Delete model IncidentSubscription
--
DROP TABLE "sentry_incidentsubscription" CASCADE;
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.
hmm yea it seemed wrong to cascade but now I realize the original had it, should probably be okay to cascade here as well - ill add it
| # is a schema change, it's completely safe to run the operation after the code has deployed. | ||
| # Once deployed, run these manually via: https://develop.sentry.dev/database-migrations/#migration-deployment | ||
|
|
||
| is_post_deployment = True |
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.
If there are no cascading drops - this can be in-deployment migration, since the drop is quite fast when there are no active transactions on the table
This could be related to database routing not being able to route the table to a database. When the model class is removed, the silo assignment of the table is also lost. Adding these table names to the sentry/src/sentry/db/router.py Lines 68 to 80 in db8dc3d
I suspect that you'll need to update the historical_silo_assignments to get this migration to run correctly as well. |
|
@markstory - yea @wedamija and I discussed it, he didnt seem to believe it was necessary anymore and that sentry/src/sentry/new_migrations/monkey/models.py Lines 38 to 39 in f6c2bc7
@wedamija is looking into preventing this in the future I believe |
src/sentry/migrations/1004_drop_legacy_incidentseen_incidentsubscription.py
Outdated
Show resolved
Hide resolved
src/sentry/migrations/1006_drop_legacy_incidentseen_incidentsubscription.py
Show resolved
Hide resolved
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #103559 +/- ##
===========================================
+ Coverage 75.42% 80.59% +5.17%
===========================================
Files 9260 9259 -1
Lines 395305 395356 +51
Branches 25213 25179 -34
===========================================
+ Hits 298160 318642 +20482
+ Misses 96716 76284 -20432
- Partials 429 430 +1 |
|
This PR has a migration; here is the generated SQL for for --
-- Raw SQL operation
--
DROP TABLE IF EXISTS sentry_incidentseen CASCADE;
--
-- Raw SQL operation
--
DROP TABLE IF EXISTS sentry_incidentsubscription CASCADE; |
These two models were already preivously deleted and a previous migration dropped them, but due to an issue with SafeDeleteModel they were not actually dropped. This migration drops them directly.