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

seed: Don't error if self isn't found #392

Merged
merged 2 commits into from Oct 28, 2020
Merged

Conversation

cloudhead
Copy link
Contributor

No description provided.

@cloudhead cloudhead requested a review from a team as a code owner October 26, 2020 16:49
@cloudhead cloudhead changed the title Don't error if self isn't found seed: Don't error if self isn't found Oct 26, 2020
FintanH
FintanH previously approved these changes Oct 27, 2020
Copy link
Contributor

@xla xla left a comment

Choose a reason for hiding this comment

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

@FintanH If I understand correctly, this should never happen with the recent fixes you landed. If the peer is in the tracked there should be a valid id for it, right?

@FintanH
Copy link
Contributor

FintanH commented Oct 27, 2020

If I understand correctly, this should never happen with the recent fixes you landed. If the peer is in the tracked there should be a valid id for it, right?

I don't think so actually. We were able to get rad self before, possibly due to it being a symref -- but I'm honestly not sure.

I guess it depends on the semantics here anyway. If there is an error in trying to retrieve the user, is it show-stopping for the seed or can it function without it?

@kim
Copy link
Contributor

kim commented Oct 27, 2020

Iiuc, the code just walks the entire storage to find some rad/self branch corresponding to a given PeerId. It may not find one because a. we have no tracking relationship to this peer, b. we did not yet receive all data, c. we are not finished updating refs (nb. we do not have atomic operations in lieu of a custom refdb), or d. some other error occurred.

A more efficient approach would be to perform a search only on the refs (ie. refs/namespaces/*/refs/remotes/{}/rad/self, peer_id), and access the odb only if that yields a result. It should be noted that there is no guarantee that any two refs/remotes/<pid>/rad/self point to the same identity, nor that they point to the same head if they do.

Maintaining an index PeerId -> [Identity] for arbitrary PeerIds is not a trivial problem in general, as it requires to reverse the arrow (ie. replicate all possible identities on the network). I do not agree that there are any benefits in doing so -- it would be enough to look up given PeerId in the set of known (that is, tracked) identities (it is possible to do so relatively efficiently, as the remotes are set up in the form <identity root>/<peer id>). I'd be happy to review an RFC claiming otherwise, though.

In general, I think that ignoring all errors is not a good idea -- there's a plethora of things that can go wrong, and swallowing IO errors f.ex. will not improve the robustness of the seed node executable.

@cloudhead
Copy link
Contributor Author

A more efficient approach would be to perform a search only on the refs (ie. refs/namespaces/*/refs/remotes/{}/rad/self, peer_id), and access the odb only if that yields a result. It should be noted that there is no guarantee that any two refs/remotes//rad/self point to the same identity, nor that they point to the same head if they do.

Cool, maybe that's something we can implement in librad at some point, as this functionality is used in a couple of places now.

In general, I think that ignoring all errors is not a good idea -- there's a plethora of things that can go wrong, and swallowing IO errors f.ex. will not improve the robustness of the seed node executable.

Fixed!

@cloudhead cloudhead requested a review from kim October 28, 2020 11:50
Copy link
Contributor

@xla xla left a comment

Choose a reason for hiding this comment

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

🍠 🚌 🌒 💕

@cloudhead cloudhead merged commit 25a9bf4 into master Oct 28, 2020
@cloudhead cloudhead deleted the cloudhead/fix-guess-user branch October 28, 2020 13:13
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

4 participants