Skip to content

Commit b1714e2

Browse files
committed
Do not write snapshot if it exists
1 parent d7da947 commit b1714e2

File tree

1 file changed

+4
-1
lines changed
  • ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/V2

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ import Data.Void
7676
import Database.LSMTree (Session, Table)
7777
import qualified Database.LSMTree as LSM
7878
import qualified Database.LSMTree.Internal.Types as LSM
79+
-- import qualified Debug.Trace as Debug
7980
import GHC.Generics
8081
import NoThunks.Class
8182
import Ouroboros.Consensus.Block
@@ -191,7 +192,9 @@ newLSMLedgerTablesHandle tracer rr session (resKey, t0) = do
191192
, takeHandleSnapshot = \_ snapshotName -> do
192193
guardClosed tv $
193194
\table -> do
194-
Monad.void $ LSM.saveSnapshot (fromString snapshotName) "UTxO table" table
195+
exists <- LSM.doesSnapshotExist session (fromString snapshotName)
196+
-- Debug.traceShowM =<< LSM.listSnapshots session
197+
Monad.when (not exists) $ LSM.saveSnapshot (fromString snapshotName) "UTxO table" table
195198
pure Nothing
196199
, tablesSize = pure Nothing
197200
}

0 commit comments

Comments
 (0)