File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 1+ ### Patch
2+
3+ - Fix a race condition between chain switches and LedgerDB.V1 forker acquisition.
Original file line number Diff line number Diff line change @@ -759,13 +759,14 @@ acquireAtTarget ::
759759 Either Word64 (Target (Point blk )) ->
760760 ReadLocked m (Either GetForkerError (DbChangelog l ))
761761acquireAtTarget ldbEnv target = readLocked $ runExceptT $ do
762- dblog <- lift $ readTVarIO (ldbChangelog ldbEnv)
763- volSuffix <- lift $ atomically $ getVolatileSuffix $ ldbGetVolatileSuffix ldbEnv
764- -- The DbChangelog might contain more than k states if they have not yet
765- -- been garbage-collected.
766- let volStates = volSuffix $ changelogStates dblog
762+ (dblog, volStates) <- lift $ atomically $ do
763+ dblog <- readTVar (ldbChangelog ldbEnv)
764+ -- The DbChangelog might contain more than k states if they have not yet
765+ -- been garbage-collected.
766+ volSuffix <- getVolatileSuffix $ ldbGetVolatileSuffix ldbEnv
767+ pure (dblog, volSuffix $ changelogStates dblog)
767768
768- immTip :: Point blk
769+ let immTip :: Point blk
769770 immTip = castPoint $ getTip $ AS. anchor volStates
770771
771772 rollbackMax :: Word64
You can’t perform that action at this time.
0 commit comments