Skip to content

Fix notification ID sequence exhaustion - #1002

Merged
raymondjacobson merged 1 commit into
mainfrom
codex/notification-id-bigint
Aug 3, 2026
Merged

Fix notification ID sequence exhaustion#1002
raymondjacobson merged 1 commit into
mainfrom
codex/notification-id-bigint

Conversation

@raymondjacobson

Copy link
Copy Markdown
Member

Summary

  • widen notification.id and notification_id_seq from 32-bit integer to bigint
  • widen Go and PL/pgSQL consumers that store notification IDs
  • make the migration idempotent and fail within 5 seconds when the required table lock is unavailable

Production rollout warning

Production's notification table is approximately 13 GB (6.1 GB heap and 6.4 GB indexes, about 26 million rows). PostgreSQL must rewrite it while holding an ACCESS EXCLUSIVE lock.

Coordinate a maintenance window and quiesce notification readers/writers before applying this migration. The migration uses a 5-second lock_timeout so an unattended deploy fails instead of leaving requests queued. After the lock is acquired, statement_timeout is disabled so the rewrite can finish.

Validation

  • applied the migration to a fresh local database
  • reapplied it to verify idempotency
  • set the sequence to 2147483647 and successfully inserted notification ID 2147483648 as bigint
  • verified all three trigger functions use bigint locals
  • go test -run '^$' ./api/... ./jobs/...

@raymondjacobson
raymondjacobson merged commit b2660fb into main Aug 3, 2026
2 checks passed
@raymondjacobson
raymondjacobson deleted the codex/notification-id-bigint branch August 3, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant