Skip to content

Commit 5b13418

Browse files
committed
Create snapshot of in-memory tables in <snap>/tables
1 parent a2c246c commit 5b13418

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

ouroboros-consensus-cardano/app/snapshot-converter.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ main = withStdTerminalHandles $ do
356356
InEnv
357357
st
358358
fp
359-
(fromInMemory (fp F.</> "tables" F.</> "tvar"))
359+
(fromInMemory (fp F.</> "tables"))
360360
("InMemory@[" <> fp <> "]")
361361
c
362362
mtd
@@ -412,7 +412,7 @@ main = withStdTerminalHandles $ do
412412
pure $
413413
OutEnv
414414
fp
415-
(toInMemory (fp F.</> "tables" F.</> "tvar"))
415+
(toInMemory (fp F.</> "tables"))
416416
(Just "tables")
417417
(Nothing)
418418
("InMemory@[" <> fp <> "]")

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import Data.Functor.Identity
4141
import qualified Data.List as List
4242
import qualified Data.Map.Strict as Map
4343
import Data.Maybe
44-
import Data.String (fromString)
4544
import GHC.Generics
4645
import NoThunks.Class
4746
import Ouroboros.Consensus.Block
@@ -214,11 +213,11 @@ implTakeHandleSnapshot ::
214213
String ->
215214
m (Maybe CRC)
216215
implTakeHandleSnapshot tv hasFS hint snapshotName = do
217-
createDirectoryIfMissing hasFS True $ mkFsPath [snapshotName, "tables"]
216+
createDirectoryIfMissing hasFS True $ mkFsPath [snapshotName]
218217
h <- readTVarIO tv
219218
guardClosed h $
220219
\values ->
221-
withFile hasFS (mkFsPath [snapshotName, "tables", "tvar"]) (WriteMode MustBeNew) $ \hf ->
220+
withFile hasFS (mkFsPath [snapshotName, "tables"]) (WriteMode MustBeNew) $ \hf ->
222221
fmap (Just . snd) $
223222
hPutAllCRC hasFS hf $
224223
CBOR.toLazyByteString $
@@ -340,10 +339,7 @@ loadSnapshot tracer _rr ccfg fs ds = do
340339
fs
341340
Identity
342341
(valuesMKDecoder extLedgerSt)
343-
( fsPathFromList $
344-
fsPathToList (snapshotToDirPath ds)
345-
<> [fromString "tables", fromString "tvar"]
346-
)
342+
(snapshotToDirPath ds </> mkFsPath ["tables"])
347343
let computedCRC = crcOfConcat checksumAsRead crcTables
348344
Monad.when (computedCRC /= snapshotChecksum snapshotMeta) $
349345
throwE $

0 commit comments

Comments
 (0)