You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The end state for metagraphed-health D1, per ADR 0014 and the #2108 infra epic, is full retirement for chain data -- D1 was always meant to be a temporary hot cache during the Postgres cutover, not a permanent architecture. Tonight's work (#2112, #4746/#4750) got blocks/extrinsics/account_events flipped to Postgres-primary, and #4771 (once built) will do the same for the metagraph/neuron pipeline. This issue tracks the actual deletion once every dependency clears -- it is explicitly a "once X, Y, Z are true" issue, not startable yet.
D1 hosts tables in genuinely different categories, and this issue is scoped ONLY to the chain-data ones -- the health/registry-monitoring tables (surface_checks, surface_status, surface_uptime_daily, rpc_proxy_events) are unrelated to chain data and are explicitly NOT part of D1 retirement; they're registry/health-prober telemetry with their own, already-working retention and no relationship to the Postgres cutover. Do not delete them under this issue.
Similarly, account_events_daily and subnet_snapshots are explicitly, deliberately retained indefinitely per their own migration comments (migrations/0009_account_events.sql:33-35, migrations/0002_analytics.sql:9-10) -- low-volume, long-term-by-design tables, not a capacity risk at any realistic timescale (~2GB/decade and ~4MB/decade respectively at current growth). These are NOT part of D1 retirement either; do not touch them under this issue.
Gate 3: blocks/extrinsics/account_events Postgres serving must be proven reliable over a real sustained window (not just tonight's spot-verification) before the D1 fallback is removed -- per ADR 0014's own stricter pre-launch criteria, this is explicitly a lower bar tonight (no real users yet) than what should gate a permanent code deletion.
Once all gates clear: delete D1's blocks/extrinsics/account_events/neurons/neuron_daily tables and their prune-cron logic (pruneBlocks/pruneExtrinsics/pruneAccountEvents/pruneNeuronDaily and the archive-then-prune wiring in workers/api.mjs's NEURON_HISTORY_ROLLUP_CRON handler).
Delete the now-dead D1 ingest endpoints (/api/v1/internal/blocks, /internal/events in workers/api.mjs) and the tryPostgresTier D1-fallback branches for these tiers (workers/postgres-tier.mjs callers) -- once nothing depends on the fallback, keeping dead fallback code around is exactly the kind of thing that causes confusion later.
Delete scripts/stream-events.py, scripts/fetch-events.py (if nothing else uses it), the streamer's Ansible role, docs/realtime-streamer.md, the */3 R2-drain cron, and .github/workflows/backfill-events.yml -- all of these exist solely to feed or repair D1's chain-data tables.
Update ADR 0014 (or file its successor if enough has changed by then, per its own "if reality moves again, write ADR 0015" guidance) to reflect D1 fully retired for chain data.
Deliverables
A single, well-tested PR (or a small tightly-sequenced set) deleting the schema, prune logic, ingest endpoints, and fallback code identified above.
Deletion of the now-unused scripts/docs/workflows/Ansible role.
An updated ADR reflecting the actual end state.
Confirmation that account_events_daily, subnet_snapshots, and the health/registry-monitoring tables remain untouched and D1 continues to exist for exactly those, by design.
Expected outcomes
metagraphed-health D1 shrinks to just its intentionally-D1-native tables (health/registry monitoring + the two deliberately-indefinite rollups).
No dead code paths remain referencing the retired tables.
The block explorer's chain-data serving is 100% Postgres, with no D1 fallback remaining for blocks/extrinsics/account_events/neurons/neuron_daily.
ADR 0014 (docs/adr/0014-chain-data-infrastructure-and-postgres-cutover.md) -- Sequencing step 8 ("Delete D1's tables and prune logic once they're empty")
migrations/0009_account_events.sql:33-35, migrations/0002_analytics.sql:9-10 -- the explicit "retain indefinitely" comments for the two tables this issue does NOT touch
Priority
Medium -- not startable until #4771 lands, and not urgent in itself (D1's chain-data tables are now correctly bounded and shrinking, not an active risk). This is the clean final step of a project already well underway, tracked now so it isn't forgotten once the real blocker (#4771) clears.
Context
The end state for
metagraphed-healthD1, per ADR 0014 and the #2108 infra epic, is full retirement for chain data -- D1 was always meant to be a temporary hot cache during the Postgres cutover, not a permanent architecture. Tonight's work (#2112, #4746/#4750) got blocks/extrinsics/account_events flipped to Postgres-primary, and #4771 (once built) will do the same for the metagraph/neuron pipeline. This issue tracks the actual deletion once every dependency clears -- it is explicitly a "once X, Y, Z are true" issue, not startable yet.D1 hosts tables in genuinely different categories, and this issue is scoped ONLY to the chain-data ones -- the health/registry-monitoring tables (
surface_checks,surface_status,surface_uptime_daily,rpc_proxy_events) are unrelated to chain data and are explicitly NOT part of D1 retirement; they're registry/health-prober telemetry with their own, already-working retention and no relationship to the Postgres cutover. Do not delete them under this issue.Similarly,
account_events_dailyandsubnet_snapshotsare explicitly, deliberately retained indefinitely per their own migration comments (migrations/0009_account_events.sql:33-35,migrations/0002_analytics.sql:9-10) -- low-volume, long-term-by-design tables, not a capacity risk at any realistic timescale (~2GB/decade and ~4MB/decade respectively at current growth). These are NOT part of D1 retirement either; do not touch them under this issue.Requirements
neurons/neuron_dailyare the only chain-data tables still D1-only after tonight's work.blocks/extrinsics/account_events/neurons/neuron_dailytables and their prune-cron logic (pruneBlocks/pruneExtrinsics/pruneAccountEvents/pruneNeuronDailyand the archive-then-prune wiring inworkers/api.mjs'sNEURON_HISTORY_ROLLUP_CRONhandler)./api/v1/internal/blocks,/internal/eventsinworkers/api.mjs) and thetryPostgresTierD1-fallback branches for these tiers (workers/postgres-tier.mjscallers) -- once nothing depends on the fallback, keeping dead fallback code around is exactly the kind of thing that causes confusion later.scripts/stream-events.py,scripts/fetch-events.py(if nothing else uses it), the streamer's Ansible role,docs/realtime-streamer.md, the*/3R2-drain cron, and.github/workflows/backfill-events.yml-- all of these exist solely to feed or repair D1's chain-data tables.Deliverables
account_events_daily,subnet_snapshots, and the health/registry-monitoring tables remain untouched and D1 continues to exist for exactly those, by design.Expected outcomes
metagraphed-healthD1 shrinks to just its intentionally-D1-native tables (health/registry monitoring + the two deliberately-indefinite rollups).Links/resources
docs/adr/0014-chain-data-infrastructure-and-postgres-cutover.md) -- Sequencing step 8 ("Delete D1's tables and prune logic once they're empty")migrations/0009_account_events.sql:33-35,migrations/0002_analytics.sql:9-10-- the explicit "retain indefinitely" comments for the two tables this issue does NOT touchPriority
Medium -- not startable until #4771 lands, and not urgent in itself (D1's chain-data tables are now correctly bounded and shrinking, not an active risk). This is the clean final step of a project already well underway, tracked now so it isn't forgotten once the real blocker (#4771) clears.