Granola-Team / mina-indexer

The Mina Indexer is a re-imagined version of the software collectively called the "Mina archive node."
Apache License 2.0
18 stars 10 forks source link

Problem: database creation fails if a database already exists #1273

Closed robinbb closed 1 month ago

robinbb commented 1 month ago
2024-07-08T19:04:28.250863-07:00 - INFO Creating mina indexer database in "/mnt/mina-indexer-test/db/0.7.1-1234"
2024-07-08T19:04:28.252373-07:00 - INFO Using default mainnet genesis ledger
2024-07-08T19:04:28.384457-07:00 - INFO Initializing new mina indexer
2024-07-08T19:04:28.384919-07:00 - INFO Initializing indexer from blocks in "/mnt/mina-indexer-test/blocks-1234" and staking ledgers in "/mnt/mina-indexer-test/staking-ledgers"
2024-07-08T19:04:28.400448-07:00 - INFO Genesis ledger added to indexer store
2024-07-08T19:04:28.400470-07:00 - INFO Genesis block added to indexer store
thread 'tokio-runtime-worker' panicked at src/store/canonicity_store_impl.rs:193:54:
b has a parent
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: at least one subsystem returned an error
robinbb commented 1 month ago

This is what happens when a database already exists at the target. Optimal solution is that database creation resumes where it left off.

trevorbernard commented 1 month ago

@robinbb What about the more immediate suboptimal solution?

trevorbernard commented 1 month ago

Assuming the DB isn't corrupt from the previous run, We'd have to at the very least re-ingest the last block (from previous run) since we can't guarantee it was successfully applied. Then continue on with the remaining blocks

robinbb commented 1 month ago

@trevorbernard The more immediate suboptimal solution is to simply fail if there exists anything at the target directory. Very easy.