Skip to content

chore(releases): stop dual-writing grouprelease new_release_id - #130158

Merged
ldelvoye merged 2 commits into
masterfrom
ldelvoye/chore/grouprelease-stop-dual-write
Nov 9, 2026
Merged

ldelvoye merged 2 commits into
masterfrom
ldelvoye/chore/grouprelease-stop-dual-write

Conversation

@ldelvoye

@ldelvoye ldelvoye commented Nov 5, 2026

Copy link
Copy Markdown
Member

resolves INFRENG-783

Removes the new_release_id dual-write and moves the column to pending deletion.

Do not merge until the 1252 swap has been run by hand in every region. A deploy doesn't run it, and in an unswapped region this code would stop filling the column that becomes release_id, so 1253 raises there and halts the deploy.

@linear-code

linear-code Bot commented Nov 5, 2026

Copy link
Copy Markdown

INFRENG-783

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 5, 2026
@ldelvoye
ldelvoye added this pull request to stack #130159 November 5, 2026 22:25
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

This PR has a migration; here is the generated SQL for src/sentry/migrations/1253_grouprelease_drop_new_release_id_pending.py

for 1253_grouprelease_drop_new_release_id_pending in sentry

--
-- Raw SQL operation
--

DO $$
DECLARE
    release_id_attnum smallint;
    new_release_id_attnum smallint;
BEGIN
    SELECT attnum INTO STRICT release_id_attnum
    FROM pg_attribute
    WHERE attrelid = 'sentry_grouprelease'::regclass AND attname = 'release_id';

    SELECT attnum INTO STRICT new_release_id_attnum
    FROM pg_attribute
    WHERE attrelid = 'sentry_grouprelease'::regclass AND attname = 'new_release_id';

    -- A rename keeps attnum, so the original release_id having the lower one means no swap yet.
    IF release_id_attnum < new_release_id_attnum THEN
        RAISE EXCEPTION 'sentry_grouprelease is not swapped; run 1252 first';
    END IF;
END $$;

--
-- Moved grouprelease.new_release_id field to pending deletion state
--
-- (no-op)

@ldelvoye
ldelvoye marked this pull request as ready for review November 6, 2026 19:00
@ldelvoye
ldelvoye requested review from a team as code owners November 6, 2026 19:00
Comment on lines +24 to +27
-- A rename keeps attnum, so the original release_id having the lower one means no swap yet.
IF release_id_attnum < new_release_id_attnum THEN
RAISE EXCEPTION 'sentry_grouprelease is not swapped; run 1252 first';
END IF;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We typically haven't done deploy time checks like this. I think the extra caution is reasonable though given the consequences of making a mistake.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah I realized while working on the swap that the previous swaps I've done were... questionable. Like they work but if anything went wrong it would be really annoying to work around partial success

Base automatically changed from ldelvoye/feat/grouprelease-swap-release-id to master November 9, 2026 18:08
@ldelvoye
ldelvoye force-pushed the ldelvoye/chore/grouprelease-stop-dual-write branch from a2272b3 to 532c7db Compare November 9, 2026 18:08
The swap made release_id the wide column, so the narrow one moves to
pending deletion. The migration raises in a region that hasn't run the
swap, where this code would stop filling the future release_id.
@ldelvoye
ldelvoye force-pushed the ldelvoye/chore/grouprelease-stop-dual-write branch from 532c7db to e44772f Compare November 9, 2026 22:29
@ldelvoye
ldelvoye merged commit ab63946 into master Nov 9, 2026
99 checks passed
@ldelvoye
ldelvoye deleted the ldelvoye/chore/grouprelease-stop-dual-write branch November 9, 2026 23:07
ldelvoye added a commit that referenced this pull request Nov 10, 2026
resolves INFRENG-784

Drops the old int4 `new_release_id` column from `sentry_grouprelease`,
the last step of widening `release_id` to int8. 1253 (#130158) moved it
to pending and has finished deploying everywhere, so its swap guard has
passed in every region.

It also deletes the 1252 and 1253 migration tests. Both migrate back to
1251, and reversing this drop re-adds the column with a new attnum, so
1252's unswap guard sees the table as already unswapped and does
nothing. #127461 removed the release swap test for the same reason.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants