ref(hybridcloud): widen externalactorreplica.externalactor_id to bigint#119348
Open
strongs wants to merge 2 commits into
Open
ref(hybridcloud): widen externalactorreplica.externalactor_id to bigint#119348strongs wants to merge 2 commits into
strongs wants to merge 2 commits into
Conversation
externalactor_id is a simulated FK onto the bigint PK of sentry.ExternalActor but the replica column was created as int4 from the Django model definition. Widen it to int8 so it can hold the full source ID range. Part of the Disjoint ID ranges for cells work (Phase 1: widen int4 columns to int8). Refs INFRENG. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
This PR has a migration; here is the generated SQL for for --
-- Custom state/database change combination
--
ALTER TABLE "hybridcloud_externalactorreplica" ALTER COLUMN "externalactor_id" TYPE bigint USING "externalactor_id"::bigint; |
lynnagara
approved these changes
Jul 9, 2026
markstory
reviewed
Jul 10, 2026
| SafeRunSQL( | ||
| f'ALTER TABLE "{TABLE}" ALTER COLUMN "{COLUMN}" TYPE bigint USING "{COLUMN}"::bigint;', | ||
| reverse_sql=f'ALTER TABLE "{TABLE}" ALTER COLUMN "{COLUMN}" TYPE integer USING "{COLUMN}"::integer;', | ||
| hints={"tables": [TABLE]}, |
Member
There was a problem hiding this comment.
You can also set checked = False on the migration to disable the safety checks instead of dodging the checker this way.
Member
Author
There was a problem hiding this comment.
using the stock schema editor would take away the timeout we get from SafeRunSQL, but I'll use this in the future for simplicity probably
Member
|
The writes to this table are done in an outbox handler, and the reads are in integration code. Adding lock contention to the writes should be ok as if those writes fail, they will be retried. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
hybridcloud_externalactorreplica.externalactor_idis a simulated foreign key onto the primary key ofsentry.ExternalActor, which is aBoundedBigAutoField. The replica column was created as int4 straight from its Django model definition. That's a 32-bit column pointing at a 64-bit ID space which is just waiting to overflowThis is an
ALTER COLUMN ... TYPE, so it rewrites the table under anACCESS EXCLUSIVElock, which the zero-downtime safety framework blocks on the normalAlterFieldpath. I split state from DB withSeparateDatabaseAndState:I gave a good look at how safe running this migration would be, and I think it should be fine; the table is small (217k rows) and I put together a DD dashboard which shows traffic against it to be minimal; ~0.05 scans/s for reads, ~0.01 rows/s writes