Skip to content

Commit e536711

Browse files
committed
Drop unnecessary "/tvar" path for tables in InMemory snapshots
1 parent 3cfc050 commit e536711

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ data OutEnv = OutEnv
233233
LedgerState (CardanoBlock StandardCrypto) EmptyMK ->
234234
ResourceRegistry IO ->
235235
IO (SinkArgs (LedgerState (CardanoBlock StandardCrypto)) IO)
236-
, outCreateExtra :: Maybe FilePath
237236
, outDeleteExtra :: Maybe FilePath
238237
, outProgressMsg :: String
239238
, outBackend :: SnapshotBackend
@@ -293,7 +292,6 @@ main = withStdTerminalHandles $ do
293292

294293
wipeOutputPaths OutEnv{..} = do
295294
wipePath outFilePath
296-
lift $ maybe (pure ()) (D.createDirectory . (outFilePath F.</>)) outCreateExtra
297295
maybe
298296
(pure ())
299297
wipePath
@@ -356,7 +354,7 @@ main = withStdTerminalHandles $ do
356354
InEnv
357355
st
358356
fp
359-
(fromInMemory (fp F.</> "tables" F.</> "tvar"))
357+
(fromInMemory (fp F.</> "tables"))
360358
("InMemory@[" <> fp <> "]")
361359
c
362360
mtd
@@ -412,8 +410,7 @@ main = withStdTerminalHandles $ do
412410
pure $
413411
OutEnv
414412
fp
415-
(toInMemory (fp F.</> "tables" F.</> "tvar"))
416-
(Just "tables")
413+
(toInMemory (fp F.</> "tables"))
417414
Nothing
418415
("InMemory@[" <> fp <> "]")
419416
UTxOHDMemSnapshot
@@ -431,7 +428,6 @@ main = withStdTerminalHandles $ do
431428
fp
432429
(toLMDB fp defaultLMDBLimits)
433430
Nothing
434-
Nothing
435431
("LMDB@[" <> fp <> "]")
436432
UTxOHDLMDBSnapshot
437433
LSM fp lsmDbPath -> do
@@ -447,7 +443,6 @@ main = withStdTerminalHandles $ do
447443
OutEnv
448444
fp
449445
(toLSM lsmDbPath (last $ splitDirectories fp))
450-
Nothing
451446
(Just lsmDbPath)
452447
("LSM@[" <> lsmDbPath <> "]")
453448
UTxOHDLSMSnapshot

ouroboros-consensus/changelog.d/20250904_155944_javier.sagredo_version_tables.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ For top level release notes, leave all the headers commented out.
2020

2121
### Breaking
2222

23-
- Version the ledger tables in snapshots. For now only the 'TablesCodecVersion1' exists. Snapshots without a version will be regarded as invalid, thus triggering a replay of the chain.
23+
- Version the ledger tables in snapshots. For now only the `TablesCodecVersion1` exists. Snapshots without a version will be regarded as invalid, thus triggering a replay of the chain.
24+
- Change the InMemory snapshot format. The tables will be stored in `<snapshot-dir>/tables` instead of `<snapshot-dir>/tables/tvar`.

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,10 @@ newInMemoryLedgerTablesHandle tracer someFS@(SomeHasFS hasFS) l = do
137137
)
138138
)
139139
, takeHandleSnapshot = \hint snapshotName -> do
140-
createDirectoryIfMissing hasFS True $ mkFsPath [snapshotName, "tables"]
141140
h <- readTVarIO tv
142141
guardClosed h $
143142
\values ->
144-
withFile hasFS (mkFsPath [snapshotName, "tables", "tvar"]) (WriteMode MustBeNew) $ \hf ->
143+
withFile hasFS (mkFsPath [snapshotName, "tables"]) (WriteMode MustBeNew) $ \hf ->
145144
fmap (Just . snd) $
146145
hPutAllCRC hasFS hf $
147146
CBOR.toLazyByteString $
@@ -272,7 +271,7 @@ loadSnapshot tracer _rr ccfg fs ds = do
272271
(valuesMKDecoder extLedgerSt)
273272
( fsPathFromList $
274273
fsPathToList (snapshotToDirPath ds)
275-
<> [fromString "tables", fromString "tvar"]
274+
<> [fromString "tables"]
276275
)
277276
let computedCRC = crcOfConcat checksumAsRead crcTables
278277
Monad.when (computedCRC /= snapshotChecksum snapshotMeta) $

0 commit comments

Comments
 (0)