Skip to content
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

review of dagstore + carv2 #596

Merged
merged 13 commits into from Aug 4, 2021
Merged

Conversation

raulk
Copy link
Member

@raulk raulk commented Aug 3, 2021

  • consolidation of small packages related to blockstore management and filestores under package stores.
  • naming changes for more succinctness.
  • simplify blockstore trackers; revise naming.
  • storage provider: register ongoing CAR blockstores on restart; more obvious than the previous behaviour.

TODO

Refactoring migration.

@codecov-commenter
Copy link

codecov-commenter commented Aug 3, 2021

Codecov Report

Merging #596 (7a479e7) into feat/wip-markets-dagstore (cf7e2a9) will increase coverage by 0.87%.
The diff coverage is 59.52%.

Impacted file tree graph

@@                      Coverage Diff                      @@
##           feat/wip-markets-dagstore     #596      +/-   ##
=============================================================
+ Coverage                      64.97%   65.83%   +0.87%     
=============================================================
  Files                             67       63       -4     
  Lines                           4649     4562      -87     
=============================================================
- Hits                            3020     3003      -17     
+ Misses                          1342     1268      -74     
- Partials                         287      291       +4     
Impacted Files Coverage Δ
storagemarket/events.go 40.00% <ø> (ø)
storagemarket/impl/client_environments.go 0.00% <0.00%> (ø)
storagemarket/impl/providerstates/provider_fsm.go 73.73% <ø> (-0.22%) ⬇️
storagemarket/impl/requestvalidation/common.go 85.19% <ø> (-1.91%) ⬇️
storagemarket/types.go 85.37% <ø> (ø)
stores/dagstore.go 0.00% <0.00%> (ø)
stores/error.go 100.00% <ø> (ø)
storagemarket/impl/provider_environments.go 8.42% <12.50%> (-0.96%) ⬇️
storagemarket/impl/client.go 21.48% <40.00%> (-0.07%) ⬇️
storagemarket/impl/provider.go 27.92% <41.67%> (-0.52%) ⬇️
... and 17 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a44f98a...7a479e7. Read the comment docs.

FastRetrieval: params.FastRetrieval,
DealStages: storagemarket.NewDealStages(),
CreationTime: curTime(),
IndexedCAR: params.IndexedCAR,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the name of this field to describe function, and not type. I don't think this affects existing deals, because I believe that CBOR is positional, but would love a confirmation, since you've seen several upgrades through @dirkmc

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure about that - maybe write a test to confirm?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's gonna be hard writing a test for that :-( I'll hack something but it won't go in as a test.

@@ -263,7 +262,7 @@ func (p *Provider) receiveDeal(s network.StorageDealStream) error {
Ref: proposal.Piece,
FastRetrieval: proposal.FastRetrieval,
CreationTime: curTime(),
CARv2FilePath: carV2FilePath,
InboundCAR: path,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the field name. Idem as above @dirkmc

Comment on lines +609 to +614
// re-track all deals for whom we still have a local blockstore.
for _, d := range deals {
if _, err := os.Stat(d.InboundCAR); err == nil && d.Ref != nil {
_, _ = p.stores.GetOrOpen(d.ProposalCid.String(), d.InboundCAR, d.Ref.Root)
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now load all in progress deals whose inbound CAR still exists on disk into the trackers. This reduces complexity of the former FinalizeReadWriteBlockstore on providerDealEnvironment, which used to accept the root CID and the path to reload the entry in the tracker if it didn't exist. It puzzled me quite a bit. I believe restoring state on startup is more correct.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds right to me 👍

func (p *providerDealEnvironment) FinalizeReadWriteBlockstore(proposalCid cid.Cid, carPath string, rootCid cid.Cid) error {
bs, err := p.p.readWriteBlockStores.GetOrCreate(proposalCid.String(), carPath, rootCid)
func (p *providerDealEnvironment) FinalizeBlockstore(proposalCid cid.Cid) error {
bs, _, err := p.p.stores.Get(proposalCid.String())
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's what I was talking about above.

@@ -0,0 +1,161 @@
package stores
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous filestorecaradapter package is now merged into stores.

@raulk raulk requested a review from dirkmc August 3, 2021 21:25
Comment on lines +609 to +614
// re-track all deals for whom we still have a local blockstore.
for _, d := range deals {
if _, err := os.Stat(d.InboundCAR); err == nil && d.Ref != nil {
_, _ = p.stores.GetOrOpen(d.ProposalCid.String(), d.InboundCAR, d.Ref.Root)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds right to me 👍

storagemarket/impl/provider_environments.go Outdated Show resolved Hide resolved
storagemarket/impl/provider_environments.go Show resolved Hide resolved
storagemarket/impl/provider_environments.go Outdated Show resolved Hide resolved
stores/rw_bstores.go Outdated Show resolved Hide resolved
@dirkmc
Copy link
Contributor

dirkmc commented Aug 4, 2021

Looks like you need to run make prepare-pr

@raulk
Copy link
Member Author

raulk commented Aug 4, 2021

The docs-check CI target is broken in the CircleCI config, nothing to do with this PR.

@raulk raulk marked this pull request as ready for review August 4, 2021 12:03
@raulk raulk merged commit cdd492e into feat/wip-markets-dagstore Aug 4, 2021
@raulk raulk deleted the raulk/review-dagstore branch August 4, 2021 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants