Skip to content

Backfill all replays completed tables; backfill status survives restarts - #19

Merged
emoss08 merged 1 commit into
mainfrom
fix/backfill-replay-all
Oct 5, 2026
Merged

emoss08 merged 1 commit into
mainfrom
fix/backfill-replay-all

Conversation

@emoss08

@emoss08 emoss08 commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • POST /backfill {"all":true} (and the dashboard's "backfill all") now replays every published table from the start, completed or not, and returns {"status":"enqueued","tables":N}. Before, it called EnqueueAll, which skips completed tables, so on a running deployment it queued 0 tables and still reported success. Startup auto-backfill keeps the resume-only EnqueueAll.
  • Backfill status survives restarts: gtc_backfill_state gains rows_copied (ADD COLUMN IF NOT EXISTS on existing installs), and the coordinator loads completed tables into status at start, with row counts and completion time. The dashboard's table list includes every backfilled table, so it is not empty after a restart.
  • Replaying a table now clears its persisted state before queueing it. The old goroutine could delete a small table's completion record after the replay saved it.

Found running GTC in production: after a redeploy the dashboard showed nothing, and "backfill all" silently did nothing.

Testing

  • New unit tests: completed backfills appear in status after a restart; ReplayAll re-queues completed tables (and EnqueueAll still skips them) and does not double-queue; progress saves carry rows_copied.
  • go vet ./..., go test ./..., go test -race on the backfill package.

🤖 Generated with Claude Code

POST /backfill {"all":true} called EnqueueAll, which skips tables that
already completed, so on a running deployment it queued nothing and
reported success. It now calls ReplayAll: every published table is
replayed from the start, as the README and dashboard describe, and the
response says how many were queued. The startup auto-backfill keeps
EnqueueAll's resume semantics.

Backfill status lived only in memory, so after a restart GET /backfill
and the dashboard showed nothing although gtc_backfill_state recorded
every table as done. The state table gains rows_copied (added in place on
existing installs); the coordinator loads it at start and reports
completed backfills with their row counts and completion time. The
stats table list includes every backfilled table, so it is not empty
until the first live change.

Replaying a table cleared its persisted state in a goroutine after
queueing it; for a small table that delete could land after the replay
saved its completion. The state is now cleared before the table is
queued.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@emoss08
emoss08 merged commit 5d62c0d into main Oct 5, 2026
7 checks passed
@emoss08
emoss08 deleted the fix/backfill-replay-all branch October 5, 2026 02:52
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