Skip to content

Commit ed5e401

Browse files
committed
db-analyser: make it clear that DB validation is not ledger-related
This has caused a lot of confusion in the past.
1 parent 05a324f commit ed5e401

File tree

4 files changed

+19
-14
lines changed

4 files changed

+19
-14
lines changed

ouroboros-consensus-cardano/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ User should run this if they are dealing with a `cardano` chain.
9191

9292
The user can limit the maximum number of blocks that db-analyser will process.
9393

94-
### Database validation
94+
### Database validation, via --db-validation
9595

9696
The tool provides two database validation policies:
9797

9898
- `validate-all-blocks`, which will cause the tool to validate all chunks on the
99-
immutable and volatile databases.
99+
immutable database.
100100
- `minimum-block-validation`, which will cause the tool to validate only the
101101
most recent chunk in the immutable database.
102102

ouroboros-consensus-cardano/app/DBAnalyser/Parsers.hs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{-# LANGUAGE ApplicativeDo #-}
22
{-# LANGUAGE CPP #-}
3+
{-# LANGUAGE LambdaCase #-}
34

45
module DBAnalyser.Parsers (
56
BlockType (..)
@@ -55,16 +56,18 @@ parseSelectDB =
5556

5657

5758
parseValidationPolicy :: Parser (Maybe ValidateBlocks)
58-
parseValidationPolicy = optional $ asum [
59-
flag' ValidateAllBlocks $ mconcat [
60-
long "validate-all-blocks"
61-
, help "Validate all blocks of the Immutable DB"
62-
]
63-
, flag' MinimumBlockValidation $ mconcat [
64-
long "minimum-block-validation"
65-
, help "Validate a minimum part of the Immutable DB"
66-
]
67-
]
59+
parseValidationPolicy =
60+
optional $ option reader $ mconcat [
61+
long "db-validation"
62+
, help $ "The extent of the ChainDB on-disk files validation. This is "
63+
<> "completely unrelated to validation of the ledger rules. "
64+
<> "Possible values: validate-all-blocks, minimum-block-validation."
65+
]
66+
where
67+
reader = maybeReader $ \case
68+
"validate-all-blocks" -> Just ValidateAllBlocks
69+
"minimum-block-validation" -> Just MinimumBlockValidation
70+
_ -> Nothing
6871

6972
parseAnalysis :: Parser AnalysisName
7073
parseAnalysis = asum [

ouroboros-consensus-cardano/app/db-analyser.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
-- | Database analysis tool.
66
--
7-
-- Usage: db-analyser --db PATH [--analyse-from SLOT_NUMBER]
8-
-- [--validate-all-blocks | --minimum-block-validation]
7+
-- Usage: db-analyser --db PATH [--verbose] [--analyse-from SLOT_NUMBER]
8+
-- [--db-validation ARG]
99
-- [--show-slot-block-no | --count-tx-outputs |
1010
-- --show-block-header-size | --show-block-txs-size |
1111
-- --show-ebbs | --store-ledger SLOT_NUMBER | --count-blocks |

ouroboros-consensus-cardano/src/unstable-cardano-tools/Cardano/Tools/DBAnalyser/Types.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@ data DBAnalyserConfig = DBAnalyserConfig {
2020
, confLimit :: Limit
2121
}
2222

23+
-- | Whether to validate the on-disk files of the ChainDB. This is completely
24+
-- unrelated to validation of the ledger rules.
2325
data ValidateBlocks = ValidateAllBlocks | MinimumBlockValidation

0 commit comments

Comments
 (0)