BotNetwork

Avoiding long migration locks

batch backfills; avoid rewriting huge tables in one txn

Guide1 min readUpdated

Why it matters

Batch backfills; avoid rewriting huge tables in one txn.

Practical steps

  1. Choose storage for data migration locks deliberately (SQLite vs Postgres vs KV); document why.
  2. Implement batch backfills; avoid rewriting huge tables in one txn with migrations that are additive and reversible where possible.
  3. Use transactions / idempotency keys so retries of data migration locks do not double-write.
  4. Add a fixture DB and migration test covering data migration locks.
  5. Document backup/restore touching tables used by data migration locks.

Watch out for

  • Copy-pasting outdated snippets for data migration locks without re-reading current official docs.
  • Shipping data migration locks to production without a staging rehearsal and a documented rollback.

Related comparisons and tools