-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Summary
Support direct DB import/export to bootstrap new apex instances without syncing millions of heights over RPC.
Use case
A new apex deployment for a rollup with 2M+ DA heights of history. RPC sync at ~100 heights/sec = ~5.5 hours. Direct DB import from a snapshot or another indexer = minutes.
Commands
# Export from a running or stopped apex instance
apex export --namespaces eden,xo --from 1000000 --to 2000000 --output dump.sql
# Import into a new instance
apex import --input dump.sqlRequirements
Export
- Dump headers and blobs tables for specified height range and namespaces
- Output format: SQL INSERT statements (portable, inspectable)
- Optional: compressed output (gzip)
- Can run against a live DB (SQLite WAL mode supports concurrent reads)
Import
- Load SQL dump into a fresh or existing database
- Update
sync_stateto reflect imported range - Validate: no duplicate heights, namespace consistency
- Transaction-wrapped for atomicity (rollback on error)
Snapshot (alternative)
- Since it's SQLite, a raw file copy of the
.dbfile is also valid - Document the "stop, copy, start" approach as the simplest option
apex snapshot --output ./backup/could do a safe SQLite backup via the backup API
References
- Design doc:
test_plan.md— Bulk Import section - SQLite online backup API:
sqlite3_backup_init
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels