-
Notifications
You must be signed in to change notification settings - Fork 32
LSM trees initial integration #1572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jasagredo
wants to merge
3
commits into
main
Choose a base branch
from
js/lsm1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+925
−156
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
ouroboros-consensus-cardano/changelog.d/20250729_124022_javier.sagredo_lsm1.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| <!-- | ||
| A new scriv changelog fragment. | ||
|
|
||
| Uncomment the section that is right (remove the HTML comment wrapper). | ||
| For top level release notes, leave all the headers commented out. | ||
| --> | ||
|
|
||
| <!-- | ||
| ### Patch | ||
|
|
||
| - A bullet item for the Patch category. | ||
|
|
||
| --> | ||
| <!-- | ||
| ### Non-Breaking | ||
|
|
||
| - A bullet item for the Non-Breaking category. | ||
|
|
||
| --> | ||
| <!-- | ||
| ### Breaking | ||
|
|
||
| - A bullet item for the Breaking category. | ||
|
|
||
| --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,9 +15,9 @@ import Cardano.Tools.DBAnalyser.HasAnalysis | |
| import Cardano.Tools.DBAnalyser.Types | ||
| import Control.ResourceRegistry | ||
| import Control.Tracer (Tracer (..), nullTracer) | ||
| import Data.Functor.Contravariant ((>$<)) | ||
| import qualified Data.SOP.Dict as Dict | ||
| import Data.Singletons (Sing, SingI (..)) | ||
| import Data.Void | ||
| import qualified Debug.Trace as Debug | ||
| import Ouroboros.Consensus.Block | ||
| import Ouroboros.Consensus.Config | ||
|
|
@@ -35,19 +35,24 @@ import qualified Ouroboros.Consensus.Storage.ChainDB as ChainDB | |
| import qualified Ouroboros.Consensus.Storage.ChainDB.Impl.Args as ChainDB | ||
| import qualified Ouroboros.Consensus.Storage.ImmutableDB as ImmutableDB | ||
| import qualified Ouroboros.Consensus.Storage.ImmutableDB.Stream as ImmutableDB | ||
| import Ouroboros.Consensus.Storage.LedgerDB (TraceEvent (..)) | ||
| import qualified Ouroboros.Consensus.Storage.LedgerDB as LedgerDB | ||
| import qualified Ouroboros.Consensus.Storage.LedgerDB.V1 as LedgerDB.V1 | ||
| import qualified Ouroboros.Consensus.Storage.LedgerDB.V1.Args as LedgerDB.V1 | ||
| import qualified Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB as LMDB | ||
| import qualified Ouroboros.Consensus.Storage.LedgerDB.V1.Snapshots as LedgerDB.V1 | ||
| import qualified Ouroboros.Consensus.Storage.LedgerDB.V1.Snapshots as V1 | ||
| import qualified Ouroboros.Consensus.Storage.LedgerDB.V2 as LedgerDB.V2 | ||
| import qualified Ouroboros.Consensus.Storage.LedgerDB.V2.Args as LedgerDB.V2 | ||
| import qualified Ouroboros.Consensus.Storage.LedgerDB.V2.Args as V2 | ||
| import qualified Ouroboros.Consensus.Storage.LedgerDB.V2.InMemory as InMemory | ||
| import qualified Ouroboros.Consensus.Storage.LedgerDB.V2.LSM as LSM | ||
| import Ouroboros.Consensus.Util.Args | ||
| import Ouroboros.Consensus.Util.IOLike | ||
| import Ouroboros.Consensus.Util.Orphans () | ||
| import Ouroboros.Network.Block (genesisPoint) | ||
| import System.FS.API | ||
| import System.IO | ||
| import System.Random | ||
| import Text.Printf (printf) | ||
|
|
||
| {------------------------------------------------------------------------------- | ||
|
|
@@ -66,7 +71,7 @@ openLedgerDB :: | |
| , LedgerDB.TestInternals' IO blk | ||
| ) | ||
| openLedgerDB [email protected]{LedgerDB.lgrFlavorArgs = LedgerDB.LedgerDbFlavorArgsV1 bss} = do | ||
| let snapManager = LedgerDB.V1.snapshotManager lgrDbArgs | ||
| let snapManager = V1.snapshotManager lgrDbArgs | ||
| (ledgerDB, _, intLedgerDB) <- | ||
| LedgerDB.openDBInternal | ||
| lgrDbArgs | ||
|
|
@@ -83,8 +88,27 @@ openLedgerDB [email protected]{LedgerDB.lgrFlavorArgs = LedgerDB.L | |
| pure (ledgerDB, intLedgerDB) | ||
| openLedgerDB [email protected]{LedgerDB.lgrFlavorArgs = LedgerDB.LedgerDbFlavorArgsV2 args} = do | ||
| (snapManager, bss') <- case args of | ||
| LedgerDB.V2.V2Args LedgerDB.V2.InMemoryHandleArgs -> pure (InMemory.snapshotManager lgrDbArgs, LedgerDB.V2.InMemoryHandleEnv) | ||
| LedgerDB.V2.V2Args (LedgerDB.V2.LSMHandleArgs (LedgerDB.V2.LSMArgs x)) -> absurd x | ||
| V2.V2Args V2.InMemoryHandleArgs -> pure (InMemory.snapshotManager lgrDbArgs, V2.InMemoryHandleEnv) | ||
| V2.V2Args (V2.LSMHandleArgs (V2.LSMArgs path salt mkFS)) -> do | ||
| (rk1, V2.SomeHasFSAndBlockIO fs' blockio) <- mkFS (LedgerDB.lgrRegistry lgrDbArgs) | ||
| session <- | ||
| allocate | ||
| (LedgerDB.lgrRegistry lgrDbArgs) | ||
| ( \_ -> | ||
| LSM.openSession | ||
| ( LedgerDBFlavorImplEvent . LedgerDB.FlavorImplSpecificTraceV2 . V2.LSMTrace | ||
| >$< LedgerDB.lgrTracer lgrDbArgs | ||
| ) | ||
| fs' | ||
| blockio | ||
| salt | ||
| path | ||
| ) | ||
| LSM.closeSession | ||
| pure | ||
| ( LSM.snapshotManager (snd session) lgrDbArgs | ||
| , V2.LSMHandleEnv (V2.LSMResources (fst session) (snd session) rk1) | ||
| ) | ||
| (ledgerDB, _, intLedgerDB) <- | ||
| LedgerDB.openDBInternal | ||
| lgrDbArgs | ||
|
|
@@ -128,6 +152,7 @@ analyse dbaConfig args = | |
| lock <- newMVar () | ||
| chainDBTracer <- mkTracer lock verbose | ||
| analysisTracer <- mkTracer lock True | ||
| lsmSalt <- fst . genWord64 <$> newStdGen | ||
| ProtocolInfo{pInfoInitLedger = genesisLedger, pInfoConfig = cfg} <- | ||
| mkProtocolInfo args | ||
| let shfs = Node.stdMkChainDbHasFS dbDir | ||
|
|
@@ -152,6 +177,13 @@ analyse dbaConfig args = | |
| V2InMem -> | ||
| LedgerDB.LedgerDbFlavorArgsV2 | ||
| (LedgerDB.V2.V2Args LedgerDB.V2.InMemoryHandleArgs) | ||
| V2LSM -> | ||
| LedgerDB.LedgerDbFlavorArgsV2 | ||
| ( LedgerDB.V2.V2Args | ||
| ( LedgerDB.V2.LSMHandleArgs | ||
| (LedgerDB.V2.LSMArgs (mkFsPath ["lsm"]) lsmSalt (LSM.stdMkBlockIOFS dbDir)) | ||
| ) | ||
| ) | ||
| args' = | ||
| ChainDB.completeChainDbArgs | ||
| registry | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
ouroboros-consensus-diffusion/changelog.d/20250729_125052_javier.sagredo_lsm1.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <!-- | ||
| A new scriv changelog fragment. | ||
|
|
||
| Uncomment the section that is right (remove the HTML comment wrapper). | ||
| For top level release notes, leave all the headers commented out. | ||
| --> | ||
|
|
||
| <!-- | ||
| ### Patch | ||
|
|
||
| - A bullet item for the Patch category. | ||
|
|
||
| --> | ||
| <!-- | ||
| ### Non-Breaking | ||
|
|
||
| - A bullet item for the Non-Breaking category. | ||
|
|
||
| --> | ||
| ### Breaking | ||
|
|
||
| - `srnLdbFlavorArgs` was renamed to `srnLedgerDbBackendArgs` and changed its type to `LedgerDBBackendArgs`. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.