IntersectMBO / ouroboros-consensus

Implementation of a Consensus Layer for the Ouroboros family of protocols
https://ouroboros-consensus.cardano.intersectmbo.org
Apache License 2.0
34 stars 23 forks source link

Simplify UTxO-HD CLI args and configuration options #1220

Closed jasagredo closed 1 month ago

jasagredo commented 2 months ago

Now that UTxO-HD is reaching the merging point, we need to cleanup the arguments. I propose the following structure (based on https://github.com/IntersectMBO/ouroboros-consensus/pull/1199):

cardano-node run 
  (--database-path <all-dbs> | --immutable-database-path <imm-db> --volatile-database-path <other-dbs>) 
  [(--utxos-on-disk                                         # enables on-disk backend
                    [--utxos-database-path    <lmdb path>]  # will create a ledgerdb dir under the given path
                    [--utxos-flush-frequency  WORD       ]
                    [--utxos-query-batch-size WORD       ]
                    [--lmdb-mapsize           GIGABYTES  ]
  | --utxos-on-memory)                                      # enables the in-memory backend, it is the default
  ]

where the defaults would be:

--database-path "mainnet/db"
--utxos-on-memory
--utxos-database-path "<database-path>"
--utxos-flush-frequency DefaultFlushFrequency
--utxos-query-batch-size DefaullQueryBatchSize
--lmdb-mapsize 16
jasagredo commented 2 months ago

Note that at the moment, if the user specifies a path for database-path but not for --utxos-database-path (the old --ssd-database-path) it is created in mainnet/ledgerdb, leading to this weird scenario:

➜ cabal run cardano-node -- run --database-path mypath

➜ tree mainnet mypath
mainnet/
└── ledgerdb
mypath
├── clean
├── immutable
│   └── ...
├── ledger
│   └── ...
├── lock
├── protocolMagicId
└── volatile
    └── ...

6 directories, 8 files

where it should be:


mypath
├── clean
├── immutable
│   └── ...
├── ledger
│   └── ...
├── ledgerdb
│   └── ...
├── lock
├── protocolMagicId
└── volatile
    └── ...
jasagredo commented 1 month ago

Done!

  [ --utxos-in-memory
  | --utxos-on-disk
    [--utxos-flush-frequency WORD]
    [--utxos-query-batch-size WORD]
    [--lmdb-path FILEPATH]
    [--lmdb-mapsize NR_GIGABYTES]
  ]
...
  --utxos-in-memory        Use the InMemory LedgerDB backend. The node uses this
                           backend by default if none is specified.
  --utxos-on-disk          Use the LMDB ledger DB backend.
  --utxos-flush-frequency WORD
                           Flush parts of the ledger state to disk after WORD
                           blocks have moved into the immutable part of the
                           chain. This should be at least 0.
  --utxos-query-batch-size WORD
                           When reading large amounts of ledger state data from
                           disk for a ledger state query, perform reads in
                           batches of WORD size. This should be at least 1.
  --lmdb-path FILEPATH     Directory where the live lmdb is stored.
  --lmdb-mapsize NR_GIGABYTES
                           The maximum database size defined in number of
                           Gigabytes. By default, the mapsize (maximum database
                           size) of the backend is set to 16 Gigabytes. Warning:
                           if the database size exceeds the given mapsize, the
                           node will abort. Therefore, the mapsize should be set
                           to a value high enough to guarantee that the maximum
                           database size will not be reached during the expected
                           node uptime.