Skip to content

Commit 8f720f9

Browse files
azaslavskyandrewshie-sentry
authored andcommitted
fix(backup): Move Incident and related models relocation scope (#81066)
These models turn out to actually be "high-volume" in certain cases, so they are better suited for the `Global` scope instead.
1 parent 1570ac7 commit 8f720f9

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

fixtures/backup/model_dependencies/detailed.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3005,7 +3005,7 @@
30053005
},
30063006
"model": "sentry.incident",
30073007
"relocation_dependencies": [],
3008-
"relocation_scope": "Organization",
3008+
"relocation_scope": "Global",
30093009
"silos": [
30103010
"Region"
30113011
],
@@ -3033,7 +3033,7 @@
30333033
},
30343034
"model": "sentry.incidentactivity",
30353035
"relocation_dependencies": [],
3036-
"relocation_scope": "Organization",
3036+
"relocation_scope": "Global",
30373037
"silos": [
30383038
"Region"
30393039
],
@@ -3112,7 +3112,7 @@
31123112
},
31133113
"model": "sentry.incidentsnapshot",
31143114
"relocation_dependencies": [],
3115-
"relocation_scope": "Organization",
3115+
"relocation_scope": "Global",
31163116
"silos": [
31173117
"Region"
31183118
],
@@ -3139,7 +3139,7 @@
31393139
},
31403140
"model": "sentry.incidentsubscription",
31413141
"relocation_dependencies": [],
3142-
"relocation_scope": "Organization",
3142+
"relocation_scope": "Global",
31433143
"silos": [
31443144
"Region"
31453145
],
@@ -3167,7 +3167,7 @@
31673167
},
31683168
"model": "sentry.incidenttrigger",
31693169
"relocation_dependencies": [],
3170-
"relocation_scope": "Organization",
3170+
"relocation_scope": "Global",
31713171
"silos": [
31723172
"Region"
31733173
],
@@ -4096,7 +4096,7 @@
40964096
},
40974097
"model": "sentry.pendingincidentsnapshot",
40984098
"relocation_dependencies": [],
4099-
"relocation_scope": "Organization",
4099+
"relocation_scope": "Global",
41004100
"silos": [
41014101
"Region"
41024102
],
@@ -6059,7 +6059,7 @@
60596059
"relocation_dependencies": [
60606060
"sentry.incident"
60616061
],
6062-
"relocation_scope": "Organization",
6062+
"relocation_scope": "Global",
60636063
"silos": [
60646064
"Region"
60656065
],

src/sentry/incidents/models/incident.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class Incident(Model):
185185
- UI should be able to handle multiple active incidents
186186
"""
187187

188-
__relocation_scope__ = RelocationScope.Organization
188+
__relocation_scope__ = RelocationScope.Global
189189

190190
objects: ClassVar[IncidentManager] = IncidentManager()
191191

@@ -250,7 +250,7 @@ def normalize_before_relocation_import(
250250

251251
@region_silo_model
252252
class PendingIncidentSnapshot(Model):
253-
__relocation_scope__ = RelocationScope.Organization
253+
__relocation_scope__ = RelocationScope.Global
254254

255255
incident = OneToOneCascadeDeletes("sentry.Incident", db_constraint=False)
256256
target_run_date = models.DateTimeField(db_index=True, default=timezone.now)
@@ -263,7 +263,7 @@ class Meta:
263263

264264
@region_silo_model
265265
class IncidentSnapshot(Model):
266-
__relocation_scope__ = RelocationScope.Organization
266+
__relocation_scope__ = RelocationScope.Global
267267

268268
incident = OneToOneCascadeDeletes("sentry.Incident", db_constraint=False)
269269
event_stats_snapshot = FlexibleForeignKey("sentry.TimeSeriesSnapshot", db_constraint=False)
@@ -278,7 +278,7 @@ class Meta:
278278

279279
@region_silo_model
280280
class TimeSeriesSnapshot(Model):
281-
__relocation_scope__ = RelocationScope.Organization
281+
__relocation_scope__ = RelocationScope.Global
282282
__relocation_dependencies__ = {"sentry.Incident"}
283283

284284
start = models.DateTimeField()
@@ -313,7 +313,7 @@ class IncidentActivity(Model):
313313
An IncidentActivity is a record of a change that occurred in an Incident. This could be a status change,
314314
"""
315315

316-
__relocation_scope__ = RelocationScope.Organization
316+
__relocation_scope__ = RelocationScope.Global
317317

318318
incident = FlexibleForeignKey("sentry.Incident")
319319
user_id = HybridCloudForeignKey(settings.AUTH_USER_MODEL, on_delete="CASCADE", null=True)
@@ -348,7 +348,7 @@ class IncidentSubscription(Model):
348348
Not to be confused with a snuba QuerySubscription
349349
"""
350350

351-
__relocation_scope__ = RelocationScope.Organization
351+
__relocation_scope__ = RelocationScope.Global
352352

353353
incident = FlexibleForeignKey("sentry.Incident", db_index=False)
354354
user_id = HybridCloudForeignKey(settings.AUTH_USER_MODEL, on_delete="CASCADE")
@@ -405,7 +405,7 @@ class IncidentTrigger(Model):
405405
NOTE: dissimilar to an AlertRuleTrigger which represents the trigger threshold required to initialize an Incident
406406
"""
407407

408-
__relocation_scope__ = RelocationScope.Organization
408+
__relocation_scope__ = RelocationScope.Global
409409

410410
objects: ClassVar[IncidentTriggerManager] = IncidentTriggerManager()
411411

0 commit comments

Comments
 (0)