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

Credit first peer to return content #1447

Merged
merged 7 commits into from
Sep 13, 2024

Conversation

carver
Copy link
Collaborator

@carver carver commented Sep 13, 2024

What was wrong?

While working on #1395, a number of cleanups accumulated. But there's enough going on in that PR that it's nice to separate out the stuff that can be. This is a mashup of those changes, with more info in each commit.

Most prominent, and the only change in functionality, is that when content arrives twice, we ignore the 2nd to arrive (instead of ignoring the first to arrive). We would like to give credit to the fastest peer to return the content.

How was it fixed?

Just ignore additional content to come in. This of course continues to mean that if the first content to come in is invalid, then the whole query fails. #1395 is the next step toward improving that behavior.

Everything else is just:

  • more logging lines, or info in the lines
  • making Node ID loggable
  • skip an unnecessary clone of content (which can be quite large)
  • a new clippy warning on a recent nightly build of rust

To-Do

@carver carver changed the title [WIP] Natural connection ID for uTP Misc. cleanups: tests, logging, performance and clippy Sep 13, 2024
@carver carver force-pushed the natural-connection-id branch 2 times, most recently from 33e3129 to bad2ca3 Compare September 13, 2024 02:53
@carver carver changed the title Misc. cleanups: tests, logging, performance and clippy Credit first peer to return content Sep 13, 2024
@carver carver self-assigned this Sep 13, 2024
@carver carver marked this pull request as ready for review September 13, 2024 03:07
Copy link
Collaborator

@morph-dev morph-dev 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. 🚢

break;
}
// Split off the next up to `parallelism` expected peers.
else if expected.len() < max_parallelism {
else if remaining.len() < max_parallelism {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: can't we simplify this to:

expected = remaining.drain(..min(max_parallelism, remaining.len()));

Find Content tests were challenging to debug.

Add more logged info when the test fails, and showing important
milestones of the test cycle.

Additionally, refactor the naming of `remaining` and `expected` a bit to
make reading the test more welcoming to newcomers.
When multiple peers return the content, the result should give
credit to the first peer that responds, not the last.

Also, this bug was not found locally because 10 iterations wasn't enough
to expose the issue the first time. Increasing to 100, which still takes
only 200ms, and was reliably reproducing this issue.
In ethportal-peertest, it showed that a file was missing, but not which
one. That information is critical, and self_peertest runs slowly, so
reducing reruns is very valuable.
When checking for a local copy of content requested by a peer, the
comment explaining the case for missing content should match the order
of the pattern. Also, the pattern itself is made a little clearer.
@carver carver merged commit 4d17461 into ethereum:master Sep 13, 2024
9 checks passed
@carver carver deleted the natural-connection-id branch September 13, 2024 18:20
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