Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --store-ledger option to db-analyser #3376

Merged
merged 1 commit into from
Sep 22, 2021

Conversation

EncodePanda
Copy link
Contributor

Consider a chain downloaded by cardano-node. While getting the chain, the default disk policy created two snapshots on disk

$> ls -h db_mainnet/ledger
13916582  14776127

Now we can ask db-analyser to also create a snapshot of ledger at slot 13916582 - while processing the chain - and store it. The name of the file will be 13916582_db-analyser.
(please note that by providing a suffix _db-analyser we ensure that the snapshot will not be deleted by node in the future)

cabal run ouroboros-consensus-cardano:db-analyser --  \
  --db db_mainnet cardano \
  --configByron dbacfg/mainnet-byron-genesis.json \ 
  --configShelley dbacfg/mainnet-shelley-genesis.json \
  --nonce 1a3be38bcbb7911969283716ad7aa550250226b76a61fc51cc9a9a35d9276d81 \
  --configAlonzo dbacfg/mainnet-alonzo-genesis.json \
  --store-ledger 13916582

Once the node is done with its work we can see that the snapshot is created.

ls -h db_mainnet/ledger
13916582  13916582_db-analyser  14776127

We can now compare if snapshot created by node is identical to the one created by db-analyser

&> cmp db_mainnet/ledger/13916582 db_mainnet/ledger/13916582_db-analyser \
&& echo 'success' || echo 'failure'

success

@EncodePanda
Copy link
Contributor Author

I've just finished running the tool against longer chain that also holds alonzo blocks, and everything works as expected

λ cmp db_mainnet_with_alonzo_40217333/ledger/40174168 db_mainnet_with_alonzo_40217333/ledger/40174168_db-analyser && echo 'success' || echo 'failure'

success

Copy link
Member

@dnadales dnadales left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • what is hasFS set to, and does it make sense to always have a value?
  • can we avoid exposing new symbols in OnDisk
  • would it make sense to rename storeLedgerX functions to storeLedgeStateAt?
  • shouldn't snapshot taking stop at the specified slot number?

@EncodePanda EncodePanda force-pushed the EncodePanda/CAD-3383/store-ledger branch from 699b6f0 to 274a415 Compare September 22, 2021 09:33
Copy link
Member

@dnadales dnadales left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved after discussing my comments with Pawel.

@EncodePanda EncodePanda force-pushed the EncodePanda/CAD-3383/store-ledger branch from fcebb0f to 61f7fac Compare September 22, 2021 12:00
@EncodePanda
Copy link
Contributor Author

bors merge

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Sep 22, 2021

@iohk-bors iohk-bors bot merged commit d682626 into master Sep 22, 2021
@iohk-bors iohk-bors bot deleted the EncodePanda/CAD-3383/store-ledger branch September 22, 2021 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants