Skip to content

Commit 2c593d8

Browse files
committed
Address review comments
1 parent d8493e8 commit 2c593d8

3 files changed

Lines changed: 12 additions & 11 deletions

File tree

cardano-node/src/Cardano/Node/Configuration/POM.hs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -488,16 +488,13 @@ instance FromJSON PartialNodeConfiguration where
488488
Nothing -> return Nothing
489489

490490
parseLedgerDbConfig v = do
491-
-- TODO maybe don't silently convert old format (which was in seconds)
492-
-- to new format (which is in slots), despite these being the same on
493-
-- mainnet?
494-
let snapInterval x = do
491+
let snapIntervalSlots x = do
495492
si <- x .:? "SnapshotInterval"
496493
when (any (<= 0) si) $ fail $ "Non-positive SnapshotInterval: " <> show si
497494
pure $ Override . SlotNo <$> si
498495
snapNum x = fmap (Override . NumOfDiskSnapshots) <$> x .:? "NumOfDiskSnapshots"
499496

500-
mTopLevelSnapInterval <- snapInterval v
497+
mTopLevelSnapInterval <- snapIntervalSlots v
501498
mTopLevelSnapNum <- snapNum v
502499

503500
let topLevelOptionsSet =
@@ -523,7 +520,7 @@ instance FromJSON PartialNodeConfiguration where
523520
-- Parse snapshot options from the "Snapshots" sub-object if present,
524521
-- otherwise fall back to the LedgerDB object for backward compatibility.
525522
let parseSnapshotOpts s = do
526-
sInterval <- (getLast . (Last mTopLevelSnapInterval <>) . Last <$> snapInterval s) .!= UseDefault
523+
sInterval <- (getLast . (Last mTopLevelSnapInterval <>) . Last <$> snapIntervalSlots s) .!= UseDefault
527524
sNum <- (getLast . (Last mTopLevelSnapNum <>) . Last <$> snapNum s) .!= UseDefault
528525
sOffset <- (fmap Override <$> s .:? "SlotOffset") .!= UseDefault
529526
sRateLimit <- (fmap (Override . secondsToDiffTime) <$> s .:? "RateLimit") .!= UseDefault

cardano-node/src/Cardano/Node/Tracing/Tracers/ChainDB.hs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,13 +1796,13 @@ instance ( StandardHash blk
17961796
, "snapshot" .= forMachine dtals snap
17971797
, "failure" .= show failure ]
17981798
forMachine _dtals (LedgerDB.SnapshotRequestDelayed snapshotRequestTime delayBeforeSnapshotting slots) =
1799-
mconcat [ "kind" .= String "TraceLedgerDBEvent.LedgerDBSnapshotEvent.SnapshotRequestDelayed"
1799+
mconcat [ "kind" .= String "SnapshotRequestDelayed"
18001800
, "requestTime" .= show snapshotRequestTime
1801-
, "delayBeforeSnapshotting " .= show delayBeforeSnapshotting
1802-
, "slots" .= show slots
1801+
, "delayBeforeSnapshotting" .= show delayBeforeSnapshotting
1802+
, "slots" .= toJSON (NonEmpty.toList slots)
18031803
]
18041804
forMachine _dtals (LedgerDB.SnapshotRequestCompleted) =
1805-
mconcat [ "kind" .= String "TraceLedgerDBEvent.LedgerDBSnapshotEvent.SnapshotRequestCompleted"
1805+
mconcat [ "kind" .= String "SnapshotRequestCompleted"
18061806
]
18071807

18081808

@@ -1816,6 +1816,8 @@ instance MetaTrace (LedgerDB.TraceSnapshotEvent blk) where
18161816
severityFor (Namespace _ ["TookSnapshot"]) _ = Just Info
18171817
severityFor (Namespace _ ["DeletedSnapshot"]) _ = Just Debug
18181818
severityFor (Namespace _ ["InvalidSnapshot"]) _ = Just Error
1819+
severityFor (Namespace _ ["SnapshotRequestDelayed"]) _ = Just Debug
1820+
severityFor (Namespace _ ["SnapshotRequestCompleted"]) _ = Just Debug
18191821
severityFor _ _ = Nothing
18201822

18211823
documentFor (Namespace _ ["TookSnapshot"]) = Just $ mconcat
@@ -1840,6 +1842,8 @@ instance MetaTrace (LedgerDB.TraceSnapshotEvent blk) where
18401842
[ Namespace [] ["TookSnapshot"]
18411843
, Namespace [] ["DeletedSnapshot"]
18421844
, Namespace [] ["InvalidSnapshot"]
1845+
, Namespace [] ["SnapshotRequestDelayed"]
1846+
, Namespace [] ["SnapshotRequestCompleted"]
18431847
]
18441848

18451849
--------------------------------------------------------------------------------

configuration/cardano/mainnet-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ LedgerDB:
9191
# Instead of an object with individual options, a predefined snapshot
9292
# policy can be selected by name, e.g. `Snapshots: Mithril`.
9393
Snapshots:
94-
# The time interval between snapshots, in seconds.
94+
# The time interval between snapshots, in slots.
9595
SnapshotInterval: 4320
9696

9797
# The number of disk snapshots to keep.

0 commit comments

Comments
 (0)