<p>The snapshot will only be applied if cardano-node is synced past the snapshot point, since the benefit of using it would be eliminated given cardano-db-sync rolls back to genesis under these conditions. For best results, ensure the node is close to the network tip prior to upgrading.</p>

CC BY-SA 4.0
2022-07-25T14:34:13.207Z
2022-07-25T14:34:13.207Z
james
<p>I start the docker as followed in the guide:</p>
<pre><code>export NETWORK=mainnet &amp;&amp;\
docker pull inputoutput/cardano-graphql:6.2.0-${NETWORK} &amp;&amp;\
docker pull inputoutput/cardano-graphql-hasura:6.2.0 &amp;&amp;\
docker pull cardanosolutions/cardano-node-ogmios:v5.1.0-${NETWORK} &amp;&amp;\
RESTORE_SNAPSHOT=https://update-cardano-mainnet.iohk.io/cardano-db-sync/13/db-sync-snapshot-schema-13-block-7519843-x86_64.tgz \
docker-compose up -d &amp;&amp;\
docker-compose logs -f
</code></pre>
<p>However, db-sync didn't start from a point where I passed as a RESTORE_SNAPSHOT parameter instead started at 0 to sync from genesis which takes too much time to get sync. Any recommendations? If I keep waiting to make it sync via genesis probably will last 2-3 weeks.</p>

CC BY-SA 4.0
2022-07-25T12:58:43.083Z
Rolling back to genesis like this can be due to 3 reasons: the node is not synced, the node and db-sync are running on different networks or wrong/missing ledger state directory.
Erik de Castro Lopo
CC BY-SA 4.0
2022-07-25T13:05:46.427Z
What you mean by node is not Ogmios right? I mean my node and db-sync are running on same computer in different screens and it's sync. However, I did not pass any parameter while starting db-sync about the ledger path.
korimusk
CC BY-SA 4.0
2022-07-25T21:14:15.513Z
On the `db-sync` command line there is a `--state-dir` parameter. That specifies the directory where the ledger state is expected.
Erik de Castro Lopo
CC BY-SA 4.0
2022-07-25T22:28:01.550Z
If the state directory is empty then it will roll back to genesis.
Erik de Castro Lopo
CC BY-SA 4.0
2022-07-26T01:59:51.567Z
One common issue when using snapshots is that the ledger state part of the snapshot is restored to one place and `db-sync` expects it in another.
Erik de Castro Lopo
CC BY-SA 4.0
2022-07-26T06:56:10.550Z
Do you mind sending the link where I pass the parameter while starting db-sync? I did follow the guide and I don't know how to pass --state-dir parameter when running via docker compose.
korimusk
CC BY-SA 4.0
2022-07-26T21:15:28.320Z
Documentation is at https://github.com/input-output-hk/cardano-db-sync/blob/master/doc/building-running.md . The `--state-dir` parameter should point to the directory where the `db-sync` should store its ledge state data (assuming you are syncing from genesis) or where `db-sync` will find the ledger state data from the snapshot.
Erik de Castro Lopo
<cardano-db-sync><cardano-graphql>
Syncing from genesis instead of snapshot
# Syncing from genesis instead of snapshot

(Asked by: username_0 on 2022-07-25)

I start the docker as followed in the guide:
export NETWORK=mainnet &&\
docker pull inputoutput/cardano-graphql:6.2.0-${NETWORK} &&\
docker pull inputoutput/cardano-graphql-hasura:6.2.0 &&\
docker pull cardanosolutions/cardano-node-ogmios:v5.1.0-${NETWORK} &&\
RESTORE_SNAPSHOT=https://update-cardano-mainnet.iohk.io/cardano-db-sync/13/db-sync-snapshot-schema-13-block-7519843-x86_64.tgz \
docker-compose up -d &&\
docker-compose logs -f

However, db-sync didn't start from a point where I passed as a RESTORE_SNAPSHOT parameter instead started at 0 to sync from genesis which takes too much time to get sync. Any recommendations? If I keep waiting to make it sync via genesis probably will last 2-3 weeks.

**Tags:** cardano-db-sync, cardano-graphql
> **Comments:**
> **username_1**: Rolling back to genesis like this can be due to 3 reasons: the node is not synced, the node and db-sync are running on different networks or wrong/missing ledger state directory.  
> **username_0**: What you mean by node is not Ogmios right? I mean my node and db-sync are running on same computer in different screens and it's sync. However, I did not pass any parameter while starting db-sync about the ledger path.  
> **username_1**: On the `db-sync` command line there is a `--state-dir` parameter. That specifies the directory where the ledger state is expected.  
> **username_1**: If the state directory is empty then it will roll back to genesis.  
> **username_1**: One common issue when using snapshots is that the ledger state part of the snapshot is restored to one place and `db-sync` expects it in another.  
> **username_0**: Do you mind sending the link where I pass the parameter while starting db-sync? I did follow the guide and I don't know how to pass --state-dir parameter when running via docker compose.  
> **username_1**: Documentation is at https://github.com/input-output-hk/cardano-db-sync/blob/master/doc/building-running.md . The `--state-dir` parameter should point to the directory where the `db-sync` should store its ledge state data (assuming you are syncing from genesis) or where `db-sync` will find the ledger state data from the snapshot.  

---

## 1 answers

### Answer by username_2 on 2022-07-25. Score: 0

The snapshot will only be applied if cardano-node is synced past the snapshot point, since the benefit of using it would be eliminated given cardano-db-sync rolls back to genesis under these conditions. For best results, ensure the node is close to the network tip prior to upgrading.


---

