Skip to content

Drop annotation_event once the backfill has caught up - #1015

Merged
bencap merged 1 commit into
release-2026.3.5from
feature/bencap/973/annotation-event-cutover
Dec 1, 2026
Merged

bencap merged 1 commit into
release-2026.3.5from
feature/bencap/973/annotation-event-cutover

Conversation

@bencap

@bencap bencap commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

This drops annotation_event, its view v_current_annotation_events, and the backfill's annotation_event_backfill table, now that annotation_status has replaced them. The migration refuses to run until the backfill has replayed every event, so nothing the log holds is lost. Merge it in the release after the annotation_status PR's release, once the backfill and its catch-up have run in production.

  • Migration 4cb129146996. It compares annotation_event_backfill.through_event_id with max(annotation_event.id). If the backfill is behind, it raises with the command to run. Otherwise it drops all three objects. Dropping a table that size just removes its files, so it's quick. On an empty database both values are 0, so a replay from scratch passes. The downgrade recreates the three objects empty.
  • Removed: the AnnotationEvent, CurrentAnnotationEvent and AnnotationEventBackfill models, their tests, and scripts/backfill_annotation_status.py, since the tables they read are gone.

Closes #973

For reviewers

  • Archive the table before migrating (pg_dump -t annotation_event to S3) if its raw history should be kept. Only annotation_status holds it afterwards, folded to changes.
  • The migration can't run before the backfill has caught up. If it ships in the same release as the annotation_status PR, the upgrade fails.

Tests

  • Replayed the migrations on an empty Postgres 15. With one event the backfill hadn't reached, the upgrade refused and left the event in place. After the mark caught up, the upgrade dropped all three objects. The downgrade recreated them, and a second upgrade dropped them again.
  • Ran bin/check, and the full suite locally: 5,792 passed, 24 skipped.

Checklist

  • Targets the open patch branch if this is a small, non-breaking change, or the cycle's release-<year>.<n>.0 branch otherwise; never main
  • API schema change? A matching mavedb-ui PR regenerates src/schema/openapi.d.ts (none here)
  • Docs and instruction files touched by this change are updated

@bencap
bencap force-pushed the feature/bencap/973/annotation-event-cutover branch 2 times, most recently from 1ce49be to 3a418fa Compare November 25, 2026 00:26
The cutover revision refuses to run until annotation_event_backfill covers
every event, then drops annotation_event, v_current_annotation_events and
the mark table. Their models, tests and the backfill script go with them.
It merges in the release after the backfill has run in production.
@bencap
bencap force-pushed the feature/bencap/973/annotation-event-cutover branch from 3a418fa to c40f814 Compare November 25, 2026 17:35
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 45666331019

Warning

No base build found for commit 68d82e5 on feature/bencap/973/annotation-status.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 91.223%

Details

  • Patch coverage: No coverable lines changed in this PR.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 19858
Covered Lines: 18115
Line Coverage: 91.22%
Coverage Strength: 0.91 hits per line

💛 - Coveralls

Base automatically changed from feature/bencap/973/annotation-status to release-2026.3.4 November 25, 2026 19:35
@bencap bencap mentioned this pull request Nov 25, 2026
@bencap bencap linked an issue Nov 25, 2026 that may be closed by this pull request
10 tasks
Base automatically changed from release-2026.3.4 to main November 30, 2026 18:02
@bencap
bencap changed the base branch from main to release-2026.3.5 November 30, 2026 18:04
@bencap
bencap marked this pull request as ready for review December 1, 2026 17:38
@bencap
bencap merged commit 81080ea into release-2026.3.5 Dec 1, 2026
10 checks passed
@bencap
bencap deleted the feature/bencap/973/annotation-event-cutover branch December 1, 2026 17:38
@bencap bencap mentioned this pull request Dec 1, 2026
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.

Keep annotation status storage proportional to outcomes, not annotation runs

2 participants