Skip to content

Commit 9af4d91

Browse files
mgmeierjasagredo
authored andcommitted
nix | wb: add utxo_lsmt attrs for LedgerDB.V2LSM config
1 parent c5dabc3 commit 9af4d91

File tree

5 files changed

+29
-1
lines changed

5 files changed

+29
-1
lines changed

bench/cardano-profile/src/Cardano/Benchmarking/Profile/Primitives.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ empty = Types.Profile {
177177
, Types.chaindb = Nothing
178178
, Types.node = Types.Node {
179179
Types.utxo_lmdb = False
180+
, Types.utxo_lsmt = False
180181
, Types.ssd_directory = Nothing
181182
, Types.verbatim = Types.NodeVerbatim (Just True) -- EnableP2P = true enforced; Node 10.6 won't support non-p2p topologies.
182183
, Types.trace_forwarding = False

bench/cardano-profile/src/Cardano/Benchmarking/Profile/Types.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ instance Aeson.FromJSON Chunks where
392392
data Node = Node
393393
{
394394
utxo_lmdb :: Bool
395+
, utxo_lsmt :: Bool
395396
, ssd_directory :: Maybe String
396397

397398
, verbatim :: NodeVerbatim
@@ -414,6 +415,7 @@ instance Aeson.ToJSON Node where
414415
toJSON n =
415416
Aeson.object
416417
[ "utxo_lmdb" Aeson..= utxo_lmdb n
418+
, "utxo_lsmt" Aeson..= utxo_lsmt n
417419
, "ssd_directory" Aeson..= ssd_directory n
418420
, "verbatim" Aeson..= verbatim n
419421
-- TODO: Rename in workbench/bash to "trace_forwarding".
@@ -430,6 +432,7 @@ instance Aeson.FromJSON Node where
430432
Aeson.withObject "Node" $ \o -> do
431433
Node
432434
<$> o Aeson..: "utxo_lmdb"
435+
<*> o Aeson..: "utxo_lsmt"
433436
<*> o Aeson..:? "ssd_directory"
434437
<*> o Aeson..: "verbatim"
435438
-- TODO: Rename in workbench/bash to "trace_forwarding".

bench/cardano-profile/test/Main.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ ciTestBage = Types.Profile {
345345
, Types.scenario = Types.FixedLoaded
346346
, Types.node = Types.Node {
347347
Types.utxo_lmdb = False
348+
, Types.utxo_lsmt = False
348349
, Types.ssd_directory = Nothing
349350
, Types.verbatim = Types.NodeVerbatim (Just True) -- EnableP2P = true enforced; Node 10.6 won't support non-p2p topologies.
350351
, Types.trace_forwarding = True

nix/nixos/cardano-node-service.nix

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ let
117117
hasPrometheus = map (n: if isInt n then n + i else n) baseConfig.hasPrometheus;
118118
})
119119
)
120+
// optionalAttrs (cfg.withUtxoHdLsmt i){
121+
LedgerDB = {
122+
Backend = "V2LSM";
123+
LSMDatabasePath = cfg.lmdbDatabasePath i;
124+
};
125+
}
120126
// optionalAttrs (cfg.withUtxoHdLmdb i){
121127
LedgerDB = {
122128
Backend = "V1LMDB";
@@ -427,7 +433,7 @@ in {
427433
default = null;
428434
apply = x : if lib.isFunction x then x else if x == null then _: null else _: x;
429435
description = ''
430-
A node UTxO-HD LMDB path for performant disk I/O, for each instance.
436+
A node UTxO-HD on-disk (LMDB or LSM-trees) path for performant disk I/O, for each instance.
431437
This could point to a direct-access SSD, with a specifically created journal-less file system and optimized mount options.
432438
'';
433439
};
@@ -802,6 +808,16 @@ in {
802808
'';
803809
};
804810

811+
withUtxoHdLsmt = mkOption {
812+
type = funcToOr bool;
813+
default = false;
814+
apply = x: if lib.isFunction x then x else _: x;
815+
description = ''
816+
On a UTxO-HD enabled node, the in-memory backend is the default.
817+
This activates the on-disk backend (LSM-Trees) instead.
818+
'';
819+
};
820+
805821
extraArgs = mkOption {
806822
type = listOf str;
807823
default = [];

nix/workbench/service/nodes.nix

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ let
7676
# Allow for local clusters to have multiple LMDB directories in the same physical ssd_directory;
7777
# non-block producers (like the explorer node) keep using the in-memory backend
7878
withUtxoHdLmdb = profile.node.utxo_lmdb && isProducer;
79+
withUtxoHdLsmt = profile.node.utxo_lsmt && isProducer;
7980
lmdbDatabasePath = liveTablesPath i;
8081

8182
## Combine:
@@ -122,6 +123,12 @@ let
122123
AlonzoGenesisFile = "../genesis/genesis.alonzo.json";
123124
ConwayGenesisFile = "../genesis/genesis.conway.json";
124125
DijkstraGenesisFile = "../genesis/genesis.dijkstra.json";
126+
} // optionalAttrs (profile.node.utxo_lsmt && isProducer)
127+
{
128+
LedgerDB = {
129+
Backend = "V2LSM";
130+
LSMDatabasePath = liveTablesPath i;
131+
};
125132
} // optionalAttrs (profile.node.utxo_lmdb && isProducer)
126133
{
127134
LedgerDB = {

0 commit comments

Comments
 (0)