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

refactor: refactor peer store #2964

Merged
merged 5 commits into from
Aug 30, 2021
Merged

Conversation

driftluo
Copy link
Collaborator

@driftluo driftluo commented Aug 23, 2021

What problem does this PR solve?

  1. Peer store‘s detection and eviction efficiency is too low
  2. There is a certain conflict between the peer store obtaining available nodes and the nodes that need to be probed
  3. There is a problem with interval's choice of MissedTickBehavior
  4. When a node is disconnected, based on the peer store strategy, the node information may be lost

What is changed and how it works?

  1. Made some adjustments to the peer store's strategy of randomly obtaining node information
| -- choose to identify --| --- choose to feeler --- | --      delete     -- |
| 1      | 2     | 3      | 4    | 5    | 6   | 7    | More than seven days  |
  1. Made some adjustments to the use of interval:
  • Removed the immediate execution behavior of dump peer store startup
  • Adjust interval default MissedTickBehavior to delay or skip
  1. The detection behavior is adjusted to not conflict with the behavior of completing outbound and will be executed permanently
  2. When no valid completion node can be found continuously, try to connect to boot node randomly
  3. Remove ban list from peer store
  4. Evict connectable nodes by network segment
  5. Remove nodes that have been connected within 15s

Check List

Tests

  • Unit test
  • Integration test

Release note

Title Only: Include only the PR title in the release note.

@driftluo driftluo requested a review from a team as a code owner August 23, 2021 07:02
@driftluo driftluo force-pushed the refactor-peer-store branch 4 times, most recently from 78159f9 to 3493083 Compare August 23, 2021 07:35
@driftluo driftluo requested review from doitian and quake and removed request for liya2017 August 24, 2021 12:50
network/src/peer_store/peer_store_impl.rs Show resolved Hide resolved
network/src/peer_store/peer_store_impl.rs Outdated Show resolved Hide resolved
network/src/peer_store/peer_store_impl.rs Outdated Show resolved Hide resolved
network/src/peer_store/peer_store_impl.rs Outdated Show resolved Hide resolved
network/src/peer_store/types.rs Outdated Show resolved Hide resolved
network/src/peer_store/types.rs Outdated Show resolved Hide resolved
network/src/services/outbound_peer.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@yangby-cryptape yangby-cryptape left a comment

Choose a reason for hiding this comment

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

I have read all related issues (I found two).
Two participants disappeared after several comments, I'm not sure they agreed or disagreed this PR.
I don't know whether our team have reached a consensus with this PR.

I only approve that the code is same as the issue described.

@driftluo
Copy link
Collaborator Author

bors r=quake,yangby-cryptape

@bors
Copy link
Contributor

bors bot commented Aug 30, 2021

Build succeeded:

@bors bors bot merged commit d255d4f into nervosnetwork:develop Aug 30, 2021
@driftluo driftluo deleted the refactor-peer-store branch August 30, 2021 08:36
@driftluo driftluo removed the s:waiting-on-reviewers Status: Waiting for Review label Aug 31, 2021
@doitian doitian mentioned this pull request Sep 3, 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.

3 participants