backfill-a-partitioned-table
Use when reprocessing historical partitions after a bug, a logic change, or new data. Runs the backfill in bounded idempotent chunks with a concurrency cap and verifies each partition before moving on.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- backfill-a-partitioned-table
- description
- Use when reprocessing historical partitions after a bug, a logic change, or new data. Runs the backfill in bounded idempotent chunks with a concurrency cap and verifies each partition before moving on.
02 资源文件 3
- 许可证LICENSE1.0 KB
- 参考文档SOURCE.md354 B
- 参考文档TRUST.auto.yaml2.1 KB
03 SKILL.md 正文
Backfill a Partitioned Table
A backfill re-derives history with fixed logic. Done carelessly it locks the table, blows the budget, or overwrites good data with half-computed results. Run it in idempotent chunks through the same code path as the daily job.
Procedure
- Reuse the production job code with only the partition range changed. Never a one-off script that drifts from the daily logic.
- Compute the affected range precisely: the first and last partition the bug touched. Do not backfill everything for a narrow fix.
- Write to a shadow partition and swap, or merge on the natural key, so a failed chunk leaves the original intact.
- Chunk by partition and cap concurrency at 2-4 partitions at once, to bound source load and keep each chunk cheaply retryable.
- Make each chunk idempotent (upsert) so a retried chunk converges.
- Verify each chunk before moving on: row count and checksum for the partition, compared to a recompute from the source.
- Order: oldest-to-newest when later partitions depend on earlier ones (cumulative snapshots), newest-to-oldest when only freshness matters and time is short.
- Rate-limit against the source: a backfill on the same replica as production can starve it; add a query tag and a per-query budget.
- Record progress in a table so the backfill is resumable after a stop.
- Pin the code revision in the progress record, so a mid-flight deploy does not produce partitions computed by two different versions.
Pitfalls
- Overwriting the target partition in place means a crash mid-write leaves it empty or partial.
- Backfilling new logic into partitions downstream already consumed creates a silent inconsistency with cached results.
- Running all partitions in parallel exhausts the source connection pool.
- Backfilling from a source table that was itself already corrected changes nothing; check the raw history still exists.
- Forgetting the trailing late-data horizon re-introduces the gap the backfill was meant to fix.
- No progress table means a restart redoes the whole range.
- A deploy that changes the transform while a backfill is running mixes two logic versions across the range.
- Verifying only the first and last partition misses a bad middle chunk.
Verification
psql -c "SELECT dt, count(*), sum(amount) FROM sales WHERE dt BETWEEN '2026-09-01' AND '2026-09-30' GROUP BY dt ORDER BY dt"
Every partition's count and sum match the source; run the query twice to confirm idempotency (no growth). Report the range backfilled, partitions verified, rows written, and any partition left failing.
04 同仓库更多 Skills
recipe-performance
Diagnose a specific MetaMask user flow's real-app performance and Sentry critical-user-flow telemetry with deterministic mm-harness recipes. Use for CUF boundaries, cold/warm/background-resume behavior, latency regressions, lifecycle tags, duplicate or blocking network requests, long tasks, layout/paint cost, screen redraws, React rerenders, or browser trace analysis where tests alone cannot prove the real app.
mexc-spot-websocket
MEXC Spot WebSocket workflows for public streams, protobuf handling, depth maintenance, listen keys, and private streams without exposing API keys.
mexc-spot-rest
MEXC Spot REST workflows for public data, signed account requests, orders, wallet/admin actions, and secure signing without exposing API keys.
mexc-futures-websocket
MEXC Futures WebSocket workflows for public streams, private account/order/position streams, ping/pong, subscriptions, and depth maintenance.
0xklen-version-and-refresh-sanctions-lists
暂无简介
verify-tests-cover-changed-lines
Use when a PR adds code that the existing suite may not exercise. Measures patch coverage — the share of newly changed lines hit by tests — before approving.