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

[CAD-3383] Add --num-blocks-to-process option to db-analyser #3379

Merged
merged 1 commit into from
Sep 28, 2021

Conversation

EncodePanda
Copy link
Contributor

Add --limit option so that user can control number of blocks they want to process

λ cabal run ouroboros-consensus-cardano:db-analyser -- \
  --db db_mainnet_with_alonzo_40217333 cardano \
  --configByron dbacfg/mainnet-byron-genesis.json \
  --configShelley dbacfg/mainnet-shelley-genesis.json \
  --nonce 1a3be38bcbb7911969283716ad7aa550250226b76a61fc51cc9a9a35d9276d81 \
  --configAlonzo dbacfg/mainnet-alonzo-genesis.json \
  --show-slot-block-no \
  --limit 10

BlockNo 0	SlotNo 0
BlockNo 1	SlotNo 0
BlockNo 2	SlotNo 1
BlockNo 3	SlotNo 2
BlockNo 4	SlotNo 3
BlockNo 5	SlotNo 4
BlockNo 6	SlotNo 5
BlockNo 7	SlotNo 6
BlockNo 8	SlotNo 7
BlockNo 9	SlotNo 8
ChainDB tip: At (Block {blockPointSlot = SlotNo 40217333, blockPointHash = fd4487549a0d2c6dcba32255c2a4f7e1419cb1c88a07b8872a32db19e4b02a41})

@EncodePanda EncodePanda marked this pull request as draft September 22, 2021 10:35
@EncodePanda EncodePanda changed the title [WIP] [CAD-3383]Add --limit option to db-analyser [CAD-3383]Add --limit option to db-analyser Sep 22, 2021
@EncodePanda EncodePanda marked this pull request as ready for review September 22, 2021 13:16
Copy link
Contributor

@nfrisby nfrisby left a comment

Choose a reason for hiding this comment

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

👍 A few minor suggestions.

@EncodePanda EncodePanda force-pushed the EncodePanda/CAD-3383/limit branch 3 times, most recently from 7a0c043 to ef7da5d Compare September 28, 2021 13:07
@EncodePanda
Copy link
Contributor Author

@nfrisby this is now ready for 2nd review

@EncodePanda
Copy link
Contributor Author

Usage: db-analyser --db PATH [--verbose] [--onlyImmutableDB]
                   [--validate-all-blocks | --minimum-block-validation] COMMAND
                   [--show-slot-block-no | --count-tx-outputs |
                     --show-block-header-size | --show-block-txs-size |
                     --show-ebbs | --store-ledger SLOT NUMBER]
                   [--num-blocks-to-process INT]

Copy link
Contributor

@nfrisby nfrisby left a comment

Choose a reason for hiding this comment

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

Approved; just a couple style comments.

ChainDB.IteratorBlockGCed pt -> error $ "block GC'ed " <> show pt
go :: ChainDB.Iterator IO blk b -> Limit -> st -> IO st
go itr lt !st = case decreaseLimit lt of
Nothing -> return st
Copy link
Contributor

Choose a reason for hiding this comment

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

Please align these -> and remove the parens around the Just pattern.

go itr !st = do
go :: ImmutableDB.Iterator IO blk b -> Limit -> st -> IO st
go itr lt !st = case decreaseLimit lt of
Nothing -> return st
Copy link
Contributor

Choose a reason for hiding this comment

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

Please align these -> and remove the parens around the Just pattern.

@nfrisby nfrisby changed the title [CAD-3383]Add --limit option to db-analyser [CAD-3383] Add --num-blocks-to-process option to db-analyser Sep 28, 2021
@EncodePanda
Copy link
Contributor Author

bors merge

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Sep 28, 2021

@iohk-bors iohk-bors bot merged commit e0487a5 into master Sep 28, 2021
@iohk-bors iohk-bors bot deleted the EncodePanda/CAD-3383/limit branch September 28, 2021 17:03
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