Skip to content

Refactor handling OFFER req and update should_store db method #324

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

Merged
merged 1 commit into from
May 16, 2022

Conversation

ogenev
Copy link
Member

@ogenev ogenev commented May 9, 2022

What was wrong?

We were accepting any content offered without checking if we are interested in the content.

Subtask of #313.

How was it fixed?

  1. Update the should_store DB method to use get_pinned to avoid unnecessary memory copy and bump rocksdb crate version.
  2. Remove the dummy should_store method when handling OFFER requests and accept only content we are interested in.

To-Do

  • Add entry to the release notes (may forgo for trivial changes)
  • Clean up commit history

@mrferris
Copy link
Collaborator

mrferris commented May 10, 2022

Interesting, if I'm understanding correctly this will result in a node sometimes not accepting data that it should accept.

Have you done any analysis on why & how often these false positives from key_may_exist will occur? I've glanced at the code but haven't come to a conclusion. I wonder whether it's worth the performance increase (I don't doubt that it is).

Also for what it's worth (if anything), Facebook doesn't use this function in production, at least in 2018:
facebook/rocksdb#4149

@ogenev
Copy link
Member Author

ogenev commented May 10, 2022

Also for what it's worth (if anything), Facebook doesn't use this function in production, at least in 2018: facebook/rocksdb#4149

Hmm, It seems it is not as reliable as I expected, I will revert back to the get() method. Thanks for pointing this out!

@ogenev ogenev force-pushed the handle-offer-refactor branch from 8657967 to 376ff7d Compare May 11, 2022 07:22
@ogenev
Copy link
Member Author

ogenev commented May 11, 2022

Actually, get_pinned seems more appropriate to avoid unnecessary memory copy.

@ogenev ogenev force-pushed the handle-offer-refactor branch from 376ff7d to 6b8888f Compare May 12, 2022 07:31
@ogenev ogenev mentioned this pull request May 12, 2022
4 tasks
@ogenev ogenev marked this pull request as ready for review May 12, 2022 07:46
@ogenev ogenev force-pushed the handle-offer-refactor branch from 6b8888f to e7ece03 Compare May 12, 2022 14:11
Copy link
Collaborator

@mrferris mrferris left a comment

Choose a reason for hiding this comment

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

Great find on get_pinned, definitely looks like what we want to be using.

@ogenev ogenev requested a review from mrferris May 13, 2022 07:22
Copy link
Collaborator

@mrferris mrferris left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Collaborator

@carver carver left a comment

Choose a reason for hiding this comment

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

LGTM!

@ogenev ogenev force-pushed the handle-offer-refactor branch from a7916a0 to 6252f4b Compare May 16, 2022 07:57
@ogenev ogenev merged commit e909921 into ethereum:master May 16, 2022
@ogenev ogenev deleted the handle-offer-refactor branch May 16, 2022 08:22
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