Skip to content

ref(crons): Drop the check-in monitor_id column - #127648

Open
wedamija wants to merge 1 commit into
masterfrom
danf/crons-checkin-monitor-id-3-drop-column
Open

wedamija wants to merge 1 commit into
masterfrom
danf/crons-checkin-monitor-id-3-drop-column

Conversation

@wedamija

@wedamija wedamija commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Part of a series reducing crons database work per check-in, as check-in volume grows.

Drops sentry_monitorcheckin.monitor_id. Its indexes are dropped in #127646. DROP COLUMN only changes the catalog, so it is quick.

Do not merge until #127646 has deployed. Dropping the column while older code still has the field on the model would break it.

Merge order:

  1. sentry#127609: Filter check-in list and stats by monitor environment ids
  2. sentry#127644: Stop using monitor_id and make it nullable with no FK constraint
  3. sentry#127646: Remove the field from the model, drop its indexes concurrently, MOVE_TO_PENDING (after ref(crons): Stop using monitor_id on check-ins #127644 deploys)
  4. sentry#127648: Drop the column, DELETE (after 3 deploys and its migration has run) ← this PR

@wedamija
wedamija requested a review from a team as a code owner October 15, 2026 20:59
@linear-code

linear-code Bot commented Oct 15, 2026

Copy link
Copy Markdown

ID-3

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR has a migration; here is the generated SQL for src/sentry/monitors/migrations/0020_make_checkin_monitor_nullable.py src/sentry/monitors/migrations/0021_remove_checkin_monitor.py src/sentry/monitors/migrations/0022_drop_checkin_monitor.py

for 0020_make_checkin_monitor_nullable in monitors

--
-- Alter field monitor on monitorcheckin
--
SET CONSTRAINTS "sentry_monitorcheckin_monitor_id_c15ff0f0_fk_sentry_monitor_id" IMMEDIATE; ALTER TABLE "sentry_monitorcheckin" DROP CONSTRAINT "sentry_monitorcheckin_monitor_id_c15ff0f0_fk_sentry_monitor_id";
ALTER TABLE "sentry_monitorcheckin" ALTER COLUMN "monitor_id" DROP NOT NULL;

for 0021_remove_checkin_monitor in monitors

--
-- Remove index sentry_moni_monitor_0a49ce_idx from monitorcheckin
--
DROP INDEX CONCURRENTLY IF EXISTS "sentry_moni_monitor_0a49ce_idx";
--
-- Remove index sentry_moni_monitor_7ed5ce_idx from monitorcheckin
--
DROP INDEX CONCURRENTLY IF EXISTS "sentry_moni_monitor_7ed5ce_idx";
--
-- Moved monitorcheckin.monitor field to pending deletion state
--
-- (no-op)

for 0022_drop_checkin_monitor in monitors

--
-- Remove field monitor from monitorcheckin
--
SET CONSTRAINTS "sentry_monitorcheckin_monitor_id_c15ff0f0_fk_sentry_monitor_id" IMMEDIATE; ALTER TABLE "sentry_monitorcheckin" DROP CONSTRAINT "sentry_monitorcheckin_monitor_id_c15ff0f0_fk_sentry_monitor_id";
ALTER TABLE "sentry_monitorcheckin" DROP COLUMN "monitor_id" CASCADE;

@wedamija
wedamija force-pushed the danf/crons-checkin-monitor-id-3-drop-column branch from e2d1a7b to 56da090 Compare October 15, 2026 21:45
@wedamija
wedamija force-pushed the danf/crons-checkin-monitor-id-2-remove-model branch from f03dfbf to aacd7de Compare October 15, 2026 21:45
@sentry

sentry Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Sentry Snapshot Testing

Name Added Removed Changed Renamed Unchanged Skipped Status
sentry-frontend
sentry-frontend
0 0 0 0 630 0 ✅ Unchanged

⚙️ sentry-frontend Snapshot Settings

@github-actions

Copy link
Copy Markdown
Contributor

This PR has a migration; here is the generated SQL for src/sentry/monitors/migrations/0021_make_checkin_monitor_nullable.py src/sentry/monitors/migrations/0022_remove_checkin_monitor.py src/sentry/monitors/migrations/0023_drop_checkin_monitor.py

for 0021_make_checkin_monitor_nullable in monitors

--
-- Alter field monitor on monitorcheckin
--
SET CONSTRAINTS "sentry_monitorcheckin_monitor_id_c15ff0f0_fk_sentry_monitor_id" IMMEDIATE; ALTER TABLE "sentry_monitorcheckin" DROP CONSTRAINT "sentry_monitorcheckin_monitor_id_c15ff0f0_fk_sentry_monitor_id";
ALTER TABLE "sentry_monitorcheckin" ALTER COLUMN "monitor_id" DROP NOT NULL;

for 0022_remove_checkin_monitor in monitors

--
-- Remove index sentry_moni_monitor_0a49ce_idx from monitorcheckin
--
DROP INDEX CONCURRENTLY IF EXISTS "sentry_moni_monitor_0a49ce_idx";
--
-- Remove index sentry_moni_monitor_7ed5ce_idx from monitorcheckin
--
DROP INDEX CONCURRENTLY IF EXISTS "sentry_moni_monitor_7ed5ce_idx";
--
-- Moved monitorcheckin.monitor field to pending deletion state
--
-- (no-op)

for 0023_drop_checkin_monitor in monitors

--
-- Remove field monitor from monitorcheckin
--
SET CONSTRAINTS "sentry_monitorcheckin_monitor_id_c15ff0f0_fk_sentry_monitor_id" IMMEDIATE; ALTER TABLE "sentry_monitorcheckin" DROP CONSTRAINT "sentry_monitorcheckin_monitor_id_c15ff0f0_fk_sentry_monitor_id";
ALTER TABLE "sentry_monitorcheckin" DROP COLUMN "monitor_id" CASCADE;

@wedamija
wedamija force-pushed the danf/crons-checkin-monitor-id-2-remove-model branch from cbcb40b to c28d830 Compare October 15, 2026 22:24
@wedamija
wedamija requested review from a team as code owners October 15, 2026 22:24
@wedamija
wedamija force-pushed the danf/crons-checkin-monitor-id-3-drop-column branch from ebd7a93 to 54b6930 Compare October 15, 2026 22:24
@wedamija
wedamija force-pushed the danf/crons-checkin-monitor-id-2-remove-model branch from c28d830 to 1c90d7b Compare October 15, 2026 22:51
@wedamija
wedamija force-pushed the danf/crons-checkin-monitor-id-3-drop-column branch from 54b6930 to 6b3b604 Compare October 15, 2026 22:51
@github-actions

Copy link
Copy Markdown
Contributor

This PR has a migration; here is the generated SQL for src/sentry/monitors/migrations/0022_remove_checkin_monitor.py src/sentry/monitors/migrations/0023_drop_checkin_monitor.py

for 0022_remove_checkin_monitor in monitors

--
-- Remove index sentry_moni_monitor_0a49ce_idx from monitorcheckin
--
DROP INDEX CONCURRENTLY IF EXISTS "sentry_moni_monitor_0a49ce_idx";
--
-- Remove index sentry_moni_monitor_7ed5ce_idx from monitorcheckin
--
DROP INDEX CONCURRENTLY IF EXISTS "sentry_moni_monitor_7ed5ce_idx";
--
-- Moved monitorcheckin.monitor field to pending deletion state
--
-- (no-op)

for 0023_drop_checkin_monitor in monitors

--
-- Remove field monitor from monitorcheckin
--
ALTER TABLE "sentry_monitorcheckin" DROP COLUMN "monitor_id" CASCADE;

@wedamija
wedamija force-pushed the danf/crons-checkin-monitor-id-2-remove-model branch from 1c90d7b to c4aabd8 Compare October 15, 2026 23:07
@wedamija
wedamija force-pushed the danf/crons-checkin-monitor-id-3-drop-column branch from 6b3b604 to abf49fc Compare October 15, 2026 23:07
Base automatically changed from danf/crons-checkin-monitor-id-2-remove-model to master October 16, 2026 02:58
Part of a series reducing crons database work per check-in, as check-in
volume grows.

Drops `sentry_monitorcheckin.monitor_id`. Its indexes were dropped in the
previous PR. `DROP COLUMN` only changes the catalog, so it is quick.

Co-Authored-By: Claude <noreply@anthropic.com>
@wedamija
wedamija force-pushed the danf/crons-checkin-monitor-id-3-drop-column branch from 31723e3 to 28b7f49 Compare October 16, 2026 03:00
@github-actions

Copy link
Copy Markdown
Contributor

This PR has a migration; here is the generated SQL for src/sentry/monitors/migrations/0023_drop_checkin_monitor.py

for 0023_drop_checkin_monitor in monitors

--
-- Remove field monitor from monitorcheckin
--
ALTER TABLE "sentry_monitorcheckin" DROP COLUMN "monitor_id" CASCADE;

This branch has not been deployed

No deployments
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