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

Don't Keep Streams Open #230

Merged
merged 3 commits into from
May 8, 2020
Merged

Don't Keep Streams Open #230

merged 3 commits into from
May 8, 2020

Conversation

hannahhoward
Copy link
Collaborator

@hannahhoward hannahhoward commented May 8, 2020

Goals

Our approach has been to just leave streams open, and read form them at will in storage market, and this has caused several issues.

This PR moves to closing streams as soon as we send information in the storage market. Retrieval will move to this also, but only after the data transfer move has happened

Implementation

  • Change to write and reads of deal proposals/responses opening the stream, sending the data, and closing the stream
  • Only read responses in response handlers
  • Fix a number of CBOR gen issues (will be instituting autocheck shortly)
  • Remove use of conmanager ( need to delete files)
  • Update with waiting for response state.
  • move network types to root storage market types file so response can live on client deal

Follow-up

  • remove conn manager
  • institute nil types

@codecov-io
Copy link

Codecov Report

Merging #230 into master will decrease coverage by 0.55%.
The diff coverage is 42.67%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #230      +/-   ##
==========================================
- Coverage   66.03%   65.48%   -0.54%     
==========================================
  Files          40       39       -1     
  Lines        2269     2242      -27     
==========================================
- Hits         1498     1468      -30     
- Misses        657      660       +3     
  Partials      114      114              
Impacted Files Coverage Δ
storagemarket/impl/client.go 0.00% <0.00%> (ø)
storagemarket/impl/provider.go 5.91% <0.00%> (+0.14%) ⬆️
storagemarket/types.go 33.34% <ø> (ø)
storagemarket/impl/clientstates/client_fsm.go 83.34% <33.34%> (-16.66%) ⬇️
retrievalmarket/impl/client.go 67.89% <50.00%> (ø)
storagemarket/network/ask_stream.go 66.67% <75.00%> (ø)
storagemarket/network/deal_stream.go 63.16% <75.00%> (ø)
retrievalmarket/impl/provider.go 70.91% <100.00%> (ø)
storagemarket/impl/clientstates/client_states.go 88.68% <100.00%> (-2.08%) ⬇️
storagemarket/impl/clientutils/clientutils.go 78.95% <100.00%> (-2.87%) ⬇️
... and 6 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 32d301b...061890f. Read the comment docs.

Copy link
Contributor

@ingar ingar left a comment

Choose a reason for hiding this comment

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

Looks good; my rebase actually does look a little hairier. But that's ok.

One comment about naming; I think SignedResponse was originally intended to be used for when we had a counter signature from the Provider. But now that is handled by the PublishStorageDeals message, this is more accurately a StorageDealStatus or a ProviderDealStatus or something like that. I'm mainly thinking about this because in my branch there are multiple "responses" so the request/response naming makes less sense. It can wait though for sure.

@@ -305,7 +304,7 @@ func TestEnsureProviderFunds(t *testing.T) {
},
dealInspector: func(t *testing.T, deal storagemarket.MinerDeal) {
require.Equal(t, storagemarket.StorageDealProviderFunding, deal.State)
require.Equal(t, cids[0], deal.AddFundsCid)
require.Equal(t, &cids[0], deal.AddFundsCid)
Copy link
Contributor

Choose a reason for hiding this comment

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

I am really confused about pointers, equality and how this works with serialization into and out of the store. I guess maybe in this case require.Equal is dereferencing the pointers under the hood?

I guess a more general question, why do we have a mix of *cid.Cid and cid.Cid in the MinerDeal and ClientDeal? Should we be using one or the other?

Copy link
Collaborator Author

@hannahhoward hannahhoward May 8, 2020

Choose a reason for hiding this comment

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

yes -- good point, non-obvious, but this is knowledge that should be shared by everyone. A CID that is not ALWAYS set should be a pointer. If a data structure has a regular cid with a value of cid.Undef, it will NOT serialize to CBOR. These changes are actually corrections to already merged code that had to be made once I ran our cbor generation scripts. I'm working. @shannonwells is working on a ticket to add checking that CBOR generation has been run and is up to date to our CI pipeline.

Copy link
Contributor

@shannonwells shannonwells left a comment

Choose a reason for hiding this comment

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

LGTM, nothing blocking.

storagemarket/impl/provider.go Show resolved Hide resolved
@hannahhoward hannahhoward merged commit 46655d2 into master May 8, 2020
@dirkmc dirkmc mentioned this pull request Oct 4, 2021
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.

4 participants