Skip to content

chore(aci): pending delete WorkflowFireHistory rollout columns #91910

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

Merged
merged 1 commit into from
May 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion migrations_lockfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ tempest: 0002_make_message_type_nullable

uptime: 0042_extra_uptime_indexes

workflow_engine: 0062_workflow_engine_missing_indexes
workflow_engine: 0063_drop_rollout_workflowfirehistory_columns
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Generated by Django 5.2.1 on 2025-05-19 22:35


from sentry.new_migrations.migrations import CheckedMigration
from sentry.new_migrations.monkey.fields import SafeRemoveField
from sentry.new_migrations.monkey.state import DeletionAction


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
Copy link
Member Author

Choose a reason for hiding this comment

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

this table has 43 mil rows. should this and/or the follow up migration to actually delete the columns be post deploy?

Copy link
Member Author

@cathteng cathteng May 19, 2025

Choose a reason for hiding this comment

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

it's not being written to very often anymore (kind of exploded last week, but that change has been rolled back and updated to only write for workflows that fire actions)

Copy link
Member

@vgrozdanic vgrozdanic May 20, 2025

Choose a reason for hiding this comment

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

this table has 43 mil rows. should this and/or the follow up migration to actually delete the columns be post deploy?

Nope, neither of them should be post deployment.

We have it in our docs, but it is a bit hidden, column removals should never be post deployment operations: https://develop.sentry.dev/backend/application-domains/database-migrations/#post-deploy-migrations-is_post_deployment


dependencies = [
("workflow_engine", "0062_workflow_engine_missing_indexes"),
]

operations = [
SafeRemoveField(
model_name="workflowfirehistory",
name="has_fired_actions",
deletion_action=DeletionAction.MOVE_TO_PENDING,
),
SafeRemoveField(
model_name="workflowfirehistory",
name="has_passed_filters",
deletion_action=DeletionAction.MOVE_TO_PENDING,
),
]
8 changes: 0 additions & 8 deletions src/sentry/workflow_engine/models/workflow_fire_history.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from django.db import models

from sentry.backup.scopes import RelocationScope
from sentry.db.models import CharField, FlexibleForeignKey, region_silo_model, sane_repr
from sentry.db.models.base import DefaultFieldsModel
Expand All @@ -14,12 +12,6 @@ class WorkflowFireHistory(DefaultFieldsModel):
group = FlexibleForeignKey("sentry.Group", db_constraint=False)
event_id = CharField(max_length=32)
notification_uuid = UUIDField(auto_add=True, unique=True)
has_passed_filters = models.BooleanField(
null=True
) # used for rollout -- whether the workflow passed all filters
has_fired_actions = models.BooleanField(
default=False, db_default=False
) # used for rollout -- whether at least one group of actions was triggered (Rules have 1 group of actions)

class Meta:
db_table = "workflow_engine_workflowfirehistory"
Expand Down
Loading