<p>After the import of the snapshot finishs it rolls back to genisis and starts over</p>
<pre><code>cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | All good!
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:57.73 UTC] Schema migration files validated
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:57.73 UTC] Running database migrations
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.13 UTC] Using byron genesis file from: &quot;/nix/store/iwq90igv72ihdr9z9nl3m0dsiv0bfh7y-byron-genesis.json&quot;
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.13 UTC] Using shelley genesis file from: &quot;/nix/store/sr1r1fsqij2bcr3jc1xz7hdgih2w6gp7-shelley-genesis.json&quot;
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.13 UTC] Using alonzo genesis file from: &quot;/nix/store/5qpskcxlvakm8d0qf4gg0mhs3ckr264l-alonzo-genesis.json&quot;
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.43 UTC] NetworkMagic: 764824073
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.70 UTC] Initial genesis distribution present and correct
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.70 UTC] Total genesis supply of Ada: 31112484745.000000
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.71 UTC] Inserting Shelley Genesis distribution
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.71 UTC] localInitiatorNetworkApplication: connecting to node via &quot;/node-ipc/node.socket&quot;
cardano-db-sync2_1  | [db-sync-node.Subscription:Notice:65] [2021-09-02 19:36:58.71 UTC] Identity Starting Subscription Worker, valency 1
cardano-db-sync2_1  | [db-sync-node.Subscription:Notice:66] [2021-09-02 19:36:58.71 UTC] Identity Connection Attempt Start, destination LocalAddress &quot;/node-ipc/node.socket&quot;
cardano-db-sync2_1  | [db-sync-node.Subscription:Notice:66] [2021-09-02 19:36:58.71 UTC] Identity Connection Attempt End, destination LocalAddress &quot;/node-ipc/node.socket&quot; outcome: ConnectSuccessLast
cardano-db-sync2_1  | [db-sync-node.Handshake:Info:66] [2021-09-02 19:36:58.71 UTC] WithMuxBearer (ConnectionId {localAddress = LocalAddress &quot;&quot;, remoteAddress = LocalAddress &quot;/ipc/node.socket&quot;}) Send (ClientAgency TokPropose,MsgProposeVersions (fromList [(NodeToClientV_1,TInt 764824073),(NodeToClientV_2,TInt 764824073),(NodeToClientV_3,TInt 764824073),(NodeToClientV_4,TInt 764824073),(NodeToClientV_5,TInt 764824073),(NodeToClientV_6,TInt 764824073),(NodeToClientV_7,TInt 764824073),(NodeToClientV_8,TInt 764824073),(NodeToClientV_9,TInt 764824073)]))
cardano-db-sync2_1  | [db-sync-node.Handshake:Info:66] [2021-09-02 19:36:58.71 UTC] WithMuxBearer (ConnectionId {localAddress = LocalAddress &quot;&quot;, remoteAddress = LocalAddress &quot;/ipc/node.socket&quot;}) Recv (ServerAgency TokConfirm,MsgAcceptVersion NodeToClientV_9 (TInt 764824073))
cardano-db-sync2_1  | [db-sync-node.Mux:Info:66] [2021-09-02 19:36:58.71 UTC] Bearer on ConnectionId {localAddress = LocalAddress &quot;&quot;, remoteAddress = LocalAddress &quot;/ipc/node.socket&quot;} event: Handshake Client end, duration 0.000429297s
cardano-db-sync2_1  | [db-sync-node.Mux:Info:67] [2021-09-02 19:36:58.71 UTC] Bearer on ConnectionId {localAddress = LocalAddress &quot;&quot;, remoteAddress = LocalAddress &quot;/ipc/node.socket&quot;} event: State: Mature
cardano-db-sync2_1  | [db-sync-node:Info:70] [2021-09-02 19:36:58.71 UTC] Starting chainSyncClient
cardano-db-sync2_1  | [db-sync-node:Info:70] [2021-09-02 19:36:58.71 UTC] Cardano.Db tip is at slot 38188791, block 6151159
cardano-db-sync2_1  | [db-sync-node:Info:75] [2021-09-02 19:36:58.71 UTC] Running DB thread
cardano-db-sync2_1  | [db-sync-node:Info:75] [2021-09-02 19:36:58.72 UTC] Rolling back to genesis
cardano-db-sync2_1  | [db-sync-node.Subscription:Notice:65] [2021-09-02 19:36:58.73 UTC] Identity Required subscriptions started
cardano-db-sync2_1  | [db-sync-node:Info:75] [2021-09-02 19:37:11.35 UTC] Deleting 6151159 blocks up to slot 38188791

</code></pre>
<p>My config:</p>
<pre><code>  cardano-db-sync:
    image: inputoutput/cardano-db-sync:11.0.0
    environment:
      - NETWORK=${NETWORK:-mainnet}
      - POSTGRES_HOST=postgres
      - POSTGRES_PORT=5432
      - RESTORE_SNAPSHOT=https://update-cardano-mainnet.iohk.io/cardano-db-sync/11/db-sync-snapshot-schema-11-block-6151159-x86_64.tgz
      - RESTORE_RECREATE_DB=N
    depends_on:
      - postgres
    secrets:
      - postgres_password
      - postgres_user
      - postgres_db
    volumes:
      - db-sync-data:/var/lib/cdbsync
      - /relay1-ipc:/node-ipc
      - ./tmp:/tmp
    restart: on-failure
    logging:
      driver: &quot;json-file&quot;
      options:
        max-size: &quot;200k&quot;
        max-file: &quot;10&quot;
</code></pre>
<p>Any ideas what i'm doing wrong?</p>

CC BY-SA 4.0
2021-10-04T16:38:13.913Z
I believe this is resolved in latest db-sync. I know we had some bugs about a month ago that have recently been cleaned up.
Samuel Leathers
CC BY-SA 4.0
2021-10-04T19:41:46.120Z
Yes it is fixed in the newerst version
wutzebaer
CC BY-SA 4.0
2023-01-27T07:44:55.060Z
I’m voting to close this question because it has been a bug in the old version of cardano-db-sync which is now fixed.
Marek Mahut - StakeNuts
<cardano-db-sync>
db-sync makes a rollback after using RESTORE_SNAPSHOT
# db-sync makes a rollback after using RESTORE_SNAPSHOT

(Asked by: username_0 on 2021-09-02)

After the import of the snapshot finishs it rolls back to genisis and starts over
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | All good!
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:57.73 UTC] Schema migration files validated
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:57.73 UTC] Running database migrations
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.13 UTC] Using byron genesis file from: "/nix/store/iwq90igv72ihdr9z9nl3m0dsiv0bfh7y-byron-genesis.json"
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.13 UTC] Using shelley genesis file from: "/nix/store/sr1r1fsqij2bcr3jc1xz7hdgih2w6gp7-shelley-genesis.json"
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.13 UTC] Using alonzo genesis file from: "/nix/store/5qpskcxlvakm8d0qf4gg0mhs3ckr264l-alonzo-genesis.json"
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.43 UTC] NetworkMagic: 764824073
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.70 UTC] Initial genesis distribution present and correct
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.70 UTC] Total genesis supply of Ada: 31112484745.000000
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.71 UTC] Inserting Shelley Genesis distribution
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.71 UTC] localInitiatorNetworkApplication: connecting to node via "/node-ipc/node.socket"
cardano-db-sync2_1  | [db-sync-node.Subscription:Notice:65] [2021-09-02 19:36:58.71 UTC] Identity Starting Subscription Worker, valency 1
cardano-db-sync2_1  | [db-sync-node.Subscription:Notice:66] [2021-09-02 19:36:58.71 UTC] Identity Connection Attempt Start, destination LocalAddress "/node-ipc/node.socket"
cardano-db-sync2_1  | [db-sync-node.Subscription:Notice:66] [2021-09-02 19:36:58.71 UTC] Identity Connection Attempt End, destination LocalAddress "/node-ipc/node.socket" outcome: ConnectSuccessLast
cardano-db-sync2_1  | [db-sync-node.Handshake:Info:66] [2021-09-02 19:36:58.71 UTC] WithMuxBearer (ConnectionId {localAddress = LocalAddress "", remoteAddress = LocalAddress "/ipc/node.socket"}) Send (ClientAgency TokPropose,MsgProposeVersions (fromList [(NodeToClientV_1,TInt 764824073),(NodeToClientV_2,TInt 764824073),(NodeToClientV_3,TInt 764824073),(NodeToClientV_4,TInt 764824073),(NodeToClientV_5,TInt 764824073),(NodeToClientV_6,TInt 764824073),(NodeToClientV_7,TInt 764824073),(NodeToClientV_8,TInt 764824073),(NodeToClientV_9,TInt 764824073)]))
cardano-db-sync2_1  | [db-sync-node.Handshake:Info:66] [2021-09-02 19:36:58.71 UTC] WithMuxBearer (ConnectionId {localAddress = LocalAddress "", remoteAddress = LocalAddress "/ipc/node.socket"}) Recv (ServerAgency TokConfirm,MsgAcceptVersion NodeToClientV_9 (TInt 764824073))
cardano-db-sync2_1  | [db-sync-node.Mux:Info:66] [2021-09-02 19:36:58.71 UTC] Bearer on ConnectionId {localAddress = LocalAddress "", remoteAddress = LocalAddress "/ipc/node.socket"} event: Handshake Client end, duration 0.000429297s
cardano-db-sync2_1  | [db-sync-node.Mux:Info:67] [2021-09-02 19:36:58.71 UTC] Bearer on ConnectionId {localAddress = LocalAddress "", remoteAddress = LocalAddress "/ipc/node.socket"} event: State: Mature
cardano-db-sync2_1  | [db-sync-node:Info:70] [2021-09-02 19:36:58.71 UTC] Starting chainSyncClient
cardano-db-sync2_1  | [db-sync-node:Info:70] [2021-09-02 19:36:58.71 UTC] Cardano.Db tip is at slot 38188791, block 6151159
cardano-db-sync2_1  | [db-sync-node:Info:75] [2021-09-02 19:36:58.71 UTC] Running DB thread
cardano-db-sync2_1  | [db-sync-node:Info:75] [2021-09-02 19:36:58.72 UTC] Rolling back to genesis
cardano-db-sync2_1  | [db-sync-node.Subscription:Notice:65] [2021-09-02 19:36:58.73 UTC] Identity Required subscriptions started
cardano-db-sync2_1  | [db-sync-node:Info:75] [2021-09-02 19:37:11.35 UTC] Deleting 6151159 blocks up to slot 38188791


My config:
  cardano-db-sync:
    image: inputoutput/cardano-db-sync:11.0.0
    environment:
      - NETWORK=${NETWORK:-mainnet}
      - POSTGRES_HOST=postgres
      - POSTGRES_PORT=5432
      - RESTORE_SNAPSHOT=https://update-cardano-mainnet.iohk.io/cardano-db-sync/11/db-sync-snapshot-schema-11-block-6151159-x86_64.tgz
      - RESTORE_RECREATE_DB=N
    depends_on:
      - postgres
    secrets:
      - postgres_password
      - postgres_user
      - postgres_db
    volumes:
      - db-sync-data:/var/lib/cdbsync
      - /relay1-ipc:/node-ipc
      - ./tmp:/tmp
    restart: on-failure
    logging:
      driver: "json-file"
      options:
        max-size: "200k"
        max-file: "10"

Any ideas what i'm doing wrong?

**Tags:** cardano-db-sync
> **Comments:**
> **username_1**: I believe this is resolved in latest db-sync. I know we had some bugs about a month ago that have recently been cleaned up.  
> **username_0**: Yes it is fixed in the newerst version  
> **username_2**: I’m voting to close this question because it has been a bug in the old version of cardano-db-sync which is now fixed.  

---

## 0 answers

