Skip to content

Commit 8b48bb3

Browse files
committed
LedgerDB.V2: take snapshot for immutable tip
It is also sound to create a snapshot for the anchor (which might be a bit older than the immutable tip, as garbage collection has not yet been performed); eg in V1, we create a snapshot for the last flushed state, which is almost always older than the immutable tip. However, it is trivial to create a snapshot for the immutable tip, so let's just do that, as it means (very slightly) faster replay on node startup.
1 parent 7ded356 commit 8b48bb3

File tree

1 file changed

+3
-0
lines changed
  • ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB

1 file changed

+3
-0
lines changed

ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V2.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ implTryTakeSnapshot bss env mTime nrBlocks =
380380
(LedgerDBSnapshotEvent >$< ldbTracer env)
381381
(ldbHasFS env)
382382
. anchorHandle
383+
. volatileSuffix k
383384
=<< readTVarIO (ldbSeq env)
384385
Monad.void $
385386
trimSnapshots
@@ -390,6 +391,8 @@ implTryTakeSnapshot bss env mTime nrBlocks =
390391
else
391392
pure $ SnapCounters (fst <$> mTime) nrBlocks
392393
where
394+
k = ledgerDbCfgSecParam $ ldbCfg env
395+
393396
takeSnapshot ::
394397
CodecConfig blk ->
395398
Tracer m (TraceSnapshotEvent blk) ->

0 commit comments

Comments
 (0)