Skip to content

Commit e2ae71a

Browse files
committed
LedgerDB.V2: take snapshot at immutable tip
This ensures that the underlying handle isn't garbage-collected, as we only schedule a garbage collection for all states with a slot number strictly smaller than the immutable tip. Also, a very small benefit is that we get (slightly) faster replay on node startup.
1 parent bb771a8 commit e2ae71a

File tree

1 file changed

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

1 file changed

+2
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ mkInternals bss h =
200200
TakeAtImmutableTip -> anchorHandle
201201
TakeAtVolatileTip -> currentHandle
202202
)
203+
. volatileSuffix (ledgerDbCfgSecParam (ldbCfg env))
203204
<$> readTVarIO (ldbSeq env)
204205
Monad.void $
205206
takeSnapshot
@@ -387,6 +388,7 @@ implTryTakeSnapshot bss env mTime nrBlocks =
387388
(LedgerDBSnapshotEvent >$< ldbTracer env)
388389
(ldbHasFS env)
389390
. anchorHandle
391+
. volatileSuffix (ledgerDbCfgSecParam (ldbCfg env))
390392
=<< readTVarIO (ldbSeq env)
391393
Monad.void $
392394
trimSnapshots

0 commit comments

Comments
 (0)