Skip to content

docs(lore-0090): backfill history-loss — preroll + cleanup coordination#103

Open
karczuRF wants to merge 5 commits into
developfrom
docs/0090-backfill-preroll-cleanup
Open

docs(lore-0090): backfill history-loss — preroll + cleanup coordination#103
karczuRF wants to merge 5 commits into
developfrom
docs/0090-backfill-preroll-cleanup

Conversation

@karczuRF

@karczuRF karczuRF commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

While running the 0088 historical backfill, discovered that backfilled candle history is silently lost. This PR records the root cause + fix as lore task 0090 and adds a diagnostic tool. No production code is changed here — 0090 is a blocker for 0088.

Root cause (measured on ch-prod-01)

  • sdex-backfill writes candles only to prices.price_ohlcv_1m — a 7-day-retention feeder, not a store of record.
  • The rollup MVs (schema/rollups.sql) are refreshable, LIVE-only, now() - INTERVAL 2 HOUR windowed, so they deliberately ignore historical/backfilled rows. History must be rolled up by schema/preroll.sql instead.
  • The cleanup worker (prices-{env}-cleanup, cron(0 2 * * *)) drops historical 1m partitions nightly.
  • Net: backfilled 1m data is written, never pre-rolled, and partition-dropped un-rolled. The coarse forever-tables (1h/4h/1d/1w/1M) the BE consumer reads are empty.

The extractor is proven correct (archive ledger 51050000 → 133 trades → 114 candles through the real pipeline); the loss is entirely downstream at the destination.

Contents

  • lore/1-tasks/backlog/0090_…md — root cause, evidence, and the corrected disable-cleanup → backfill → preroll → verify → re-enable workflow + acceptance criteria.
  • packages/prices-ingest-core/examples/decode_probe.rs — diagnostic: decode an archive ledger and run the real extract→tick→candle pipeline.

Follow-ups (in the task)

  • Owner decision: full-range preroll (disable cleanup) vs per-chunk/direct-to-coarse (disk headroom on shared cluster).
  • Update docs/runbooks/continue-soroban-backfill.md with the preroll + cleanup steps.
  • Separately: live ingestion appears stopped (newest 1m row ~1.3 days stale).

karczuRF added 5 commits July 9, 2026 12:37
Backfill writes only price_ohlcv_1m, a 7-day-retention feeder; the live
rollup MVs are refreshable/2h-windowed and ignore historical rows, so
backfilled candles are partition-dropped un-rolled and the coarse
forever-tables the BE consumer reads stay empty. Captures evidence and
the corrected disable-cleanup -> backfill -> preroll -> re-enable flow.
Blocks 0088.
Diagnostic example: decodes an archive ledger and runs the real
extract_trades -> tick -> candle pipeline, proving the extractor
produces candles for pre-floor ledgers (loss is downstream).
…backfill

Self-contained, no-context-assumed procedure: stop backfill -> disable
cleanup -> reset progress -> re-run into 1m -> preroll into permanent
tables -> verify -> re-enable cleanup, with per-step confirm checks.
…nbook

Disabling cleanup holds the full 1m history transiently (~5-9 GB measured);
add a GO/NO-GO gate (Avail >= 20 GB) before disabling, with the per-chunk
preroll fallback if the shared cluster is short on disk.
…ata)

Move 0088 active -> blocked. Running it surfaced that backfilled candles
land only in the 7-day price_ohlcv_1m and are dropped before reaching the
permanent coarse tables (root cause + fix in 0090). Resume after 0090.
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