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

basic reprovider implementation #554

Merged
merged 7 commits into from
Jan 17, 2015
Merged

basic reprovider implementation #554

merged 7 commits into from
Jan 17, 2015

Conversation

whyrusleeping
Copy link
Member

This PR currently has basic functionality, im not sure what else we would need, so im RFCR

@whyrusleeping whyrusleeping added the status/in-progress In progress label Jan 13, 2015
@@ -1,6 +1,6 @@
{
"ImportPath": "github.com/jbenet/go-ipfs",
"GoVersion": "go1.3",
"GoVersion": "devel +9ef10fde754f Thu Dec 11 16:32:25 2014 +1100",
Copy link
Contributor

Choose a reason for hiding this comment

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

1.3 or (1.4)

Copy link
Member Author

Choose a reason for hiding this comment

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

ah, thanks

@btc
Copy link
Contributor

btc commented Jan 14, 2015

you'll want to edit the commit where context isn't vendored

https://build.protocol-dev.com/job/build-walk-branch/728/

@@ -6,7 +6,7 @@ import (
"strings"
"syscall"

fuseversion "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-fuse-version"
fuseversion "github.com/jbenet/go-fuse-version"
Copy link
Member

Choose a reason for hiding this comment

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

you somehow unvendored go-fuse-version. are you running straight up make vendor?

Oh, you might not have the dep. it may be important to make it:

vendor: godep
    go get ./...
    godep save -r ./...

cc @briantigerchow

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 all for anything that helps to reduce friction so long as it respects the developer's GOPATH.

I tend to use godep restore ./... to turn vendored dependencies into packages in my GOPATH, but I recognize that some may find this behavior inconvenient.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, i just ran 'make vendor' not sure what happened there

Copy link
Member

Choose a reason for hiding this comment

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

sigh godep vendoring. i think that godep get ./... will:

  • only fetch things the user doesnt have (so wont break things for them)
  • will still require a godep update <path> to change to the version the user has.

why did this rewrite even happen? godep has no business turning that back into a non-vendored pkg...

Copy link
Member

Choose a reason for hiding this comment

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

@whyrusleeping this got changed back again-- i'll update this path

Copy link
Member

Choose a reason for hiding this comment

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

k updated

@jbenet
Copy link
Member

jbenet commented Jan 14, 2015

beautifully simple implementation 👍

some cases may come up later where we want to send signals to reprovide, but nothing comes to mind.

Oh, one question: are provider records and provider's addresses kept in a distinct spot in dht? e.g.:

1. /ip4/1.2.3.4/..../Qmlorien... publishes key Qmkey

2. Qmcelebdil stores (Qmlorien -> Qmkey, and Qmlorien -> /ip4/1.2.3.4/..../Qmlorien...)

3. machine holding Qmlorien changes network (it's a laptop). 
  it reconnects at /ip4/4.3.2.1/.../Qmlorien

4. /ip4/4.3.2.1/.../Qmlorien talks to the world

5. through queries unrelated to Qmkey, Qmcelebdil finds out that
  (Qmlorien -> /ip4/4.3.2.1/..../Qmlorien...)

6. if Qmcelebdil serves provider records for Qmkey, and includes Qmlorien,
   it should give (Qmlorien -> /ip4/4.3.2.1/..../Qmlorien...)

@jbenet
Copy link
Member

jbenet commented Jan 14, 2015

(this reminds me we need to evict user's addresses from the peerstore over time), tricky: only for addresses we find outside, bootstrap addrs should remain the same. and our own addrs should be up to date with our interfaces). laptop moving around will surely mess ipfs up

@whyrusleeping
Copy link
Member Author

everything failed?

@whyrusleeping
Copy link
Member Author

@briantigerchow your commit fixes things, no need to rebase or anything

@jbenet
Copy link
Member

jbenet commented Jan 14, 2015

@whyrusleeping we need to rebase to make sure every commit passes tests.

@whyrusleeping
Copy link
Member Author

oh yeah... thats right. duh

@jbenet jbenet force-pushed the feat/reprovide branch 2 times, most recently from 4d57624 to 2ae9340 Compare January 14, 2015 05:53
@jbenet
Copy link
Member

jbenet commented Jan 14, 2015

@whyrusleeping can you answer question above, on "provider records and provider's addresses kept in a distinct spot"?

@whyrusleeping
Copy link
Member Author

No, i dont think the dht stores addresses, thats entirely handled by the peerstore as far as i know

@jbenet
Copy link
Member

jbenet commented Jan 14, 2015

interesting bitswap test hang: https://build.protocol-dev.com/job/gotest/666/console

@jbenet
Copy link
Member

jbenet commented Jan 14, 2015

"fuck it" -jenkins https://build.protocol-dev.com/job/build%20docker%20image/730/console


nevermind, that's correct. I read "docker image" as "docker test". my bad.

@whyrusleeping
Copy link
Member Author

no idea on that bitswap hang, never seen that test hang before. ill look into it in a little bit, but i doubt we will see it again... (so there goes any hope of getting a debug log! )

@jbenet
Copy link
Member

jbenet commented Jan 14, 2015

I screwed up including davecheney's go-crosscompile. just removed.

godep should use git. omg. can't wait till we build a real dep manager with ipfs.

@jbenet
Copy link
Member

jbenet commented Jan 14, 2015

Before merging this in, it should have a test. maybe:

  1. spin up 2 nodes, A and B. A with a blockstore with a bunch of blocks. B should get provide messages.

@whyrusleeping
Copy link
Member Author

I think I also want to add a command so a user can manually trigger the reprovide.

@jbenet
Copy link
Member

jbenet commented Jan 15, 2015

@whyrusleeping is that test ready? if you cant get to it to day lmk and i'll do it (nbd, just want to push the ball forward)

@jbenet jbenet added this to the α milestone Jan 15, 2015
@whyrusleeping
Copy link
Member Author

Yeah, the test is pushed. The jenkins failure is one of the race conditions from #569

@whyrusleeping
Copy link
Member Author

@jbenet RFM?

@jbenet
Copy link
Member

jbenet commented Jan 16, 2015

@whyrusleeping not ready, @briantigerchow commits need squashing. I can do it for you if you want just lmk

@whyrusleeping
Copy link
Member Author

@jbenet I can get to it in about 30 minutes, otherwise you can do it if you want.

@whyrusleeping
Copy link
Member Author

Alright, all the tests are passing, but I have one issue, if you start the daemon and fail to bootstrap quickly enough, the reprovide will fail since there wont be any peers in the routing table to provide to. I think that the bootstrapping operation performed in core should block until it completes the first round of bootstrapping, this will solve the reprovides issue and provide what I think are better semantics to the creation of a node.

@jbenet
Copy link
Member

jbenet commented Jan 16, 2015

if you start the daemon and fail to bootstrap quickly enough, the reprovide will fail since there wont be any peers in the routing table to provide to.

We should have a test case with precisely this. should this be an error? it probably should silently drop "no connections" errors coming from routing. (i.e. maybe log them, but should the reprovider semantics be fulfilled? @briantigerchow thoughts?

I think that the bootstrapping operation performed in core should block until it completes the first round of bootstrapping, this will solve the reprovides issue and provide what I think are better semantics to the creation of a node.

Hm, that may slow down other things. but might be good. @briantigerchow ?

@btc
Copy link
Contributor

btc commented Jan 16, 2015

We should have a test case with precisely this. should this be an error? it probably should silently drop "no connections" errors coming from routing. (i.e. maybe log them, but should the reprovider semantics be fulfilled? @briantigerchow thoughts?

It's probably a good thing that routing returns an error if it was unable to provide the value to at least one peer. And errors shouldn't be dropped in this case. We happen to be in a position to handle them.

Here, it might be alright to retry until a routing.Provide succeeds (exponential back-off with a reasonable cap could work). Doesn't make sense to skip the key.

github.com/cenkalti/backoff would make it simple.

It might be sufficient to log a Warning to the console if routing.Provide is unsuccessful for more than N seconds (15? 30? 60?). Unlikely to happen. But it makes sure that things don't get swept under the rug.

Hm, that may slow down other things. but might be good. @briantigerchow ?

Same thoughts as you. I'd be down to try it and see how it affects usage. Low risk experiment.

@whyrusleeping
Copy link
Member Author

I like the idea of a retry with a backoff. Ill hack that up

@whyrusleeping
Copy link
Member Author

There we go! @jbenet final once over?

@whyrusleeping whyrusleeping added codereview and removed status/in-progress In progress labels Jan 17, 2015
@jbenet
Copy link
Member

jbenet commented Jan 17, 2015

@whyrusleeping LGTM! i'll merge.

jbenet added a commit that referenced this pull request Jan 17, 2015
basic reprovider implementation
@jbenet jbenet merged commit 2963f48 into master Jan 17, 2015
@jbenet jbenet deleted the feat/reprovide branch January 17, 2015 11:03
ariescodescream pushed a commit to ariescodescream/go-ipfs that referenced this pull request Oct 23, 2021
fix incorrect error handling during provider record lookups
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.

3 participants