-
Notifications
You must be signed in to change notification settings - Fork 86
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
CAD-3565 split openChainDB
#3452
Conversation
35e19ce
to
ba327a6
Compare
ouroboros-consensus/src/Ouroboros/Consensus/Util/ResourceRegistry.hs
Outdated
Show resolved
Hide resolved
9122504
to
9556dba
Compare
ouroboros-consensus/src/Ouroboros/Consensus/Storage/VolatileDB/Impl/State.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/Ouroboros/Consensus/Storage/VolatileDB/Impl.hs
Outdated
Show resolved
Hide resolved
9556dba
to
06bbc4f
Compare
ouroboros-consensus/src/Ouroboros/Consensus/Storage/ChainDB/Impl.hs
Outdated
Show resolved
Hide resolved
06bbc4f
to
4270caa
Compare
4270caa
to
89ed0fe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I left some comments, which we could discuss on a video call.
ouroboros-consensus/docs/report/chapters/storage/immutabledb.tex
Outdated
Show resolved
Hide resolved
ouroboros-consensus/docs/report/chapters/storage/immutabledb.tex
Outdated
Show resolved
Hide resolved
ouroboros-consensus/docs/report/chapters/storage/volatiledb.tex
Outdated
Show resolved
Hide resolved
2ad76f8
to
edb7d05
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent additions to the report!
I'm Requesting Changes because I feel uncomfortable with the additions to the ResourceRegistry
API. See my very long comment below. This is a high-level course correction request/proposal.
(Sorry for the delay; the review took longer than I thought, and I couldn't finish before my flight. Today is the first day we have some unscheduled time during the vacation :).)
ouroboros-consensus/docs/report/chapters/storage/volatiledb.tex
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/Ouroboros/Consensus/Util/ResourceRegistry.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/Ouroboros/Consensus/Util/ResourceRegistry.hs
Outdated
Show resolved
Hide resolved
6de5671
to
850cd3c
Compare
Javier, Damian, and I discussed the new state of the PR. We're very happy with it. The remaining work is to introduce the following function instead of Those calls from the ChainDB init to the component inits will use
|
1501bfe
to
a794cea
Compare
adfa0d1
to
5bec58b
Compare
Rebased and commits reworded to prepare for the merge |
ouroboros-consensus/src/Ouroboros/Consensus/Util/ResourceRegistry.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/Ouroboros/Consensus/Util/ResourceRegistry.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/Ouroboros/Consensus/Util/ResourceRegistry.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/Ouroboros/Consensus/Util/ResourceRegistry.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/Ouroboros/Consensus/Storage/VolatileDB/Impl.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/Ouroboros/Consensus/Storage/ImmutableDB/Impl.hs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Again, I especially appreciate the nice write-up in the report!
I'm Requesting Changes again because I think we can simplify the openDB
functions appreciably. I pushed up a commit showing how I think it should be; see the PR comments below. Please criticize it, or just squash it in if you like it. The key idea is that even the openDB
functions do not need to leak the internal state type.
I also moved the free
function out of the monadic computation. At the highest level, that's 1) to simplify the types and 2) to make it more strongly resemble the bracket
API.
Edit: several of these comments are replies to Damian's comments -- GitHub unhelpfully does not indicate that below :(
ouroboros-consensus/src/Ouroboros/Consensus/Storage/ImmutableDB/Impl.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/Ouroboros/Consensus/Storage/ImmutableDB/Impl.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/src/Ouroboros/Consensus/Storage/VolatileDB/Impl.hs
Outdated
Show resolved
Hide resolved
90ed957
to
d24a838
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving! Great PR!
I made a couple minor requests, as final touches.
Would you also change the name of my commit you cherry-picked (at least remove the WIP
part)? Or squash it down to eliminate it? The PR description already looks good 👍
ouroboros-consensus/docs/report/chapters/intro/nonfunctional.tex
Outdated
Show resolved
Hide resolved
Prior to this change, ChainDB was being initialized in an `allocate` call which mask exceptions, and because of this the initialization process was uninterruptible. This change reimplements the logic so that initialization is no longer masked. The ChainDB initialization now runs with a temporary resource registry that will ensure deallocation of resources in presence of an exception. Refer to the additions to the report for an explanation of the new structure of registries and how they are related. Co-authored-by: nfrisby <nick.frisby@iohk.io>
d24a838
to
de40006
Compare
0225477
to
de40006
Compare
bors r+ |
Build succeeded: |
The ChainDB initialization no longer runs inside an
allocate
call but instead runs with a temporary registry that will keep track of the resources allocated through initialization until the chainDB itself is allocated together with a handle that can close all the resources into the general registry.For the new definitions in
ResourceRegistry
, check the haddock comments as well as the report.