Browse Source

Remove `ProcessingIssue` models, step 2 (#74060)

This removes all the rest of the `RawEvent`, `ProcessingIssue`,
`EventProcessingIssue` and `ReprocessingReport` models, and removes
those from the migration state.
Arpad Borsos 8 months ago
parent
commit
f450cfeb87

+ 0 - 98
fixtures/backup/model_dependencies/detailed.json

@@ -1810,34 +1810,6 @@
     "table_name": "sentry_eventattachment",
     "uniques": []
   },
-  "sentry.eventprocessingissue": {
-    "dangling": false,
-    "foreign_keys": {
-      "processing_issue": {
-        "kind": "FlexibleForeignKey",
-        "model": "sentry.processingissue",
-        "nullable": false
-      },
-      "raw_event": {
-        "kind": "FlexibleForeignKey",
-        "model": "sentry.rawevent",
-        "nullable": false
-      }
-    },
-    "model": "sentry.eventprocessingissue",
-    "relocation_dependencies": [],
-    "relocation_scope": "Excluded",
-    "silos": [
-      "Region"
-    ],
-    "table_name": "sentry_eventprocessingissue",
-    "uniques": [
-      [
-        "processing_issue",
-        "raw_event"
-      ]
-    ]
-  },
   "sentry.exporteddata": {
     "dangling": false,
     "foreign_keys": {
@@ -4015,30 +3987,6 @@
       ]
     ]
   },
-  "sentry.processingissue": {
-    "dangling": false,
-    "foreign_keys": {
-      "project": {
-        "kind": "FlexibleForeignKey",
-        "model": "sentry.project",
-        "nullable": false
-      }
-    },
-    "model": "sentry.processingissue",
-    "relocation_dependencies": [],
-    "relocation_scope": "Excluded",
-    "silos": [
-      "Region"
-    ],
-    "table_name": "sentry_processingissue",
-    "uniques": [
-      [
-        "checksum",
-        "project",
-        "type"
-      ]
-    ]
-  },
   "sentry.proguardartifactrelease": {
     "dangling": false,
     "foreign_keys": {
@@ -4641,29 +4589,6 @@
       ]
     ]
   },
-  "sentry.rawevent": {
-    "dangling": false,
-    "foreign_keys": {
-      "project": {
-        "kind": "FlexibleForeignKey",
-        "model": "sentry.project",
-        "nullable": false
-      }
-    },
-    "model": "sentry.rawevent",
-    "relocation_dependencies": [],
-    "relocation_scope": "Excluded",
-    "silos": [
-      "Region"
-    ],
-    "table_name": "sentry_rawevent",
-    "uniques": [
-      [
-        "event_id",
-        "project"
-      ]
-    ]
-  },
   "sentry.recentsearch": {
     "dangling": false,
     "foreign_keys": {
@@ -5294,29 +5219,6 @@
       ]
     ]
   },
-  "sentry.reprocessingreport": {
-    "dangling": false,
-    "foreign_keys": {
-      "project": {
-        "kind": "FlexibleForeignKey",
-        "model": "sentry.project",
-        "nullable": false
-      }
-    },
-    "model": "sentry.reprocessingreport",
-    "relocation_dependencies": [],
-    "relocation_scope": "Excluded",
-    "silos": [
-      "Region"
-    ],
-    "table_name": "sentry_reprocessingreport",
-    "uniques": [
-      [
-        "event_id",
-        "project"
-      ]
-    ]
-  },
   "sentry.rule": {
     "dangling": false,
     "foreign_keys": {

+ 0 - 13
fixtures/backup/model_dependencies/flat.json

@@ -247,10 +247,6 @@
     "sentry.group",
     "sentry.project"
   ],
-  "sentry.eventprocessingissue": [
-    "sentry.processingissue",
-    "sentry.rawevent"
-  ],
   "sentry.exporteddata": [
     "sentry.file",
     "sentry.organization",
@@ -553,9 +549,6 @@
     "sentry.group",
     "sentry.project"
   ],
-  "sentry.processingissue": [
-    "sentry.project"
-  ],
   "sentry.proguardartifactrelease": [
     "sentry.organization",
     "sentry.project",
@@ -643,9 +636,6 @@
     "sentry.project",
     "sentry.snubaquery"
   ],
-  "sentry.rawevent": [
-    "sentry.project"
-  ],
   "sentry.recentsearch": [
     "sentry.organization",
     "sentry.user"
@@ -731,9 +721,6 @@
     "sentry.project",
     "sentry.repository"
   ],
-  "sentry.reprocessingreport": [
-    "sentry.project"
-  ],
   "sentry.rule": [
     "sentry.environment",
     "sentry.project",

+ 0 - 4
fixtures/backup/model_dependencies/sorted.json

@@ -53,7 +53,6 @@
   "sentry.relocation",
   "sentry.recentsearch",
   "sentry.project",
-  "sentry.processingissue",
   "sentry.orgauthtoken",
   "sentry.organizationslugreservation",
   "sentry.organizationonboardingtask",
@@ -107,7 +106,6 @@
   "sentry.snubaquery",
   "sentry.sentryapp",
   "sentry.rule",
-  "sentry.reprocessingreport",
   "sentry.repositoryprojectpathconfig",
   "sentry.relocationvalidation",
   "sentry.relocationfile",
@@ -115,7 +113,6 @@
   "sentry.releaseartifactbundle",
   "sentry.release",
   "sentry.regressiongroup",
-  "sentry.rawevent",
   "sentry.querysubscription",
   "sentry.pullrequest",
   "sentry.promptsactivity",
@@ -143,7 +140,6 @@
   "sentry.group",
   "sentry.fileblobindex",
   "sentry.exporteddatablob",
-  "sentry.eventprocessingissue",
   "sentry.eventattachment",
   "sentry.environmentproject",
   "sentry.distribution",

+ 0 - 4
fixtures/backup/model_dependencies/truncate.json

@@ -53,7 +53,6 @@
   "sentry_relocation",
   "sentry_recentsearch",
   "sentry_project",
-  "sentry_processingissue",
   "sentry_orgauthtoken",
   "sentry_organizationslugreservation",
   "sentry_organizationonboardingtask",
@@ -107,7 +106,6 @@
   "sentry_snubaquery",
   "sentry_sentryapp",
   "sentry_rule",
-  "sentry_reprocessingreport",
   "sentry_repositoryprojectpathconfig",
   "sentry_relocationvalidation",
   "sentry_relocationfile",
@@ -115,7 +113,6 @@
   "sentry_releaseartifactbundle",
   "sentry_release",
   "sentry_regressiongroup",
-  "sentry_rawevent",
   "sentry_querysubscription",
   "sentry_pull_request",
   "sentry_promptsactivity",
@@ -143,7 +140,6 @@
   "sentry_groupedmessage",
   "sentry_fileblobindex",
   "sentry_exporteddatablob",
-  "sentry_eventprocessingissue",
   "sentry_eventattachment",
   "sentry_environmentproject",
   "sentry_distribution",

+ 1 - 1
migrations_lockfile.txt

@@ -10,6 +10,6 @@ hybridcloud: 0016_add_control_cacheversion
 nodestore: 0002_nodestore_no_dictfield
 remote_subscriptions: 0003_drop_remote_subscription
 replays: 0004_index_together
-sentry: 0735_sunset_appstore_connect_integration
+sentry: 0736_rm_reprocessing_step2
 social_auth: 0002_default_auto_field
 uptime: 0003_drop_remote_subscription

+ 0 - 1
src/sentry/api/serializers/models/__init__.py

@@ -47,7 +47,6 @@ from .organization_plugin import *  # noqa: F401,F403
 from .orgauthtoken import *  # noqa: F401,F403
 from .platformexternalissue import *  # noqa: F401,F403
 from .plugin import *  # noqa: F401,F403
-from .processingissue import *  # noqa: F401,F403
 from .project import *  # noqa: F401,F403
 from .project_key import *  # noqa: F401,F403
 from .project_platform import *  # noqa: F401,F403

+ 0 - 15
src/sentry/api/serializers/models/processingissue.py

@@ -1,15 +0,0 @@
-from sentry.api.serializers import Serializer, register
-from sentry.models.processingissue import ProcessingIssue
-
-
-@register(ProcessingIssue)
-class ProcessingIssueSerializer(Serializer):
-    def serialize(self, obj, attrs, user):
-        return {
-            "id": str(obj.id),
-            "type": obj.type,
-            "checksum": obj.checksum,
-            "numEvents": 0,
-            "data": obj.data,
-            "lastSeen": obj.datetime,
-        }

+ 1 - 2
src/sentry/eventstore/base.py

@@ -9,7 +9,6 @@ from snuba_sdk import Condition
 
 from sentry import nodestore
 from sentry.eventstore.models import Event
-from sentry.models.rawevent import RawEvent
 from sentry.snuba.dataset import Dataset
 from sentry.snuba.events import Columns
 from sentry.utils.services import Service
@@ -262,7 +261,7 @@ class EventStorage(Service):
         """
         return Event(project_id=project_id, event_id=event_id, group_id=group_id, data=data)
 
-    def bind_nodes(self, object_list: Sequence[RawEvent | Event]) -> None:
+    def bind_nodes(self, object_list: Sequence[Event]) -> None:
         """
         For a list of Event objects, and a property name where we might find an
         (unfetched) NodeData on those objects, fetch all the data blobs for

+ 45 - 0
src/sentry/migrations/0736_rm_reprocessing_step2.py

@@ -0,0 +1,45 @@
+# Generated by Django 5.0.6 on 2024-07-10 07:27
+
+from django.db import migrations
+
+from sentry.new_migrations.migrations import CheckedMigration
+
+
+class Migration(CheckedMigration):
+    # This flag is used to mark that a migration shouldn't be automatically run in production.
+    # This should only be used for operations where it's safe to run the migration after your
+    # code has deployed. So this should not be used for most operations that alter the schema
+    # of a table.
+    # Here are some things that make sense to mark as post deployment:
+    # - Large data migrations. Typically we want these to be run manually so that they can be
+    #   monitored and not block the deploy for a long period of time while they run.
+    # - Adding indexes to large tables. Since this can take a long time, we'd generally prefer to
+    #   run this outside deployments so that we don't block them. Note that while adding an index
+    #   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 = False
+
+    dependencies = [
+        ("sentry", "0735_sunset_appstore_connect_integration"),
+    ]
+
+    operations = [
+        migrations.SeparateDatabaseAndState(
+            state_operations=[
+                migrations.DeleteModel(
+                    name="EventProcessingIssue",
+                ),
+                migrations.DeleteModel(
+                    name="ProcessingIssue",
+                ),
+                migrations.DeleteModel(
+                    name="RawEvent",
+                ),
+                migrations.DeleteModel(
+                    name="ReprocessingReport",
+                ),
+            ],
+            database_operations=[],
+        )
+    ]

+ 0 - 3
src/sentry/models/__init__.py

@@ -80,7 +80,6 @@ from .organizationslugreservationreplica import *  # NOQA
 from .orgauthtoken import *  # NOQA
 from .outbox import *  # NOQA
 from .platformexternalissue import *  # NOQA
-from .processingissue import *  # NOQA
 from .project import *  # NOQA
 from .projectbookmark import *  # NOQA
 from .projectcodeowners import *  # NOQA
@@ -92,7 +91,6 @@ from .projectteam import ProjectTeam  # noqa
 from .projecttemplate import ProjectTemplate  # noqa
 from .promptsactivity import *  # NOQA
 from .pullrequest import *  # NOQA
-from .rawevent import *  # NOQA
 from .recentsearch import *  # NOQA
 from .relay import *  # NOQA
 from .release import *  # NOQA
@@ -106,7 +104,6 @@ from .releaseprojectenvironment import *  # NOQA
 from .releases.release_project import *  # NOQA
 from .relocation import *  # NOQA
 from .repository import *  # NOQA
-from .reprocessingreport import *  # NOQA
 from .rule import *  # NOQA
 from .rulefirehistory import RuleFireHistory  # NOQA
 from .rulesnooze import RuleSnooze  # NOQA

Some files were not shown because too many files changed in this diff