-
Notifications
You must be signed in to change notification settings - Fork 205
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
Update request-resolve mechanism for full archive network #5347
Update request-resolve mechanism for full archive network #5347
Conversation
added separate preferred peers holder for the new network
Full archive integration test
…//github.com/multiversx/mx-chain-go into requesters_resolvers_full_archive_network # Conflicts: # factory/processing/processComponents.go # factory/processing/processComponentsHandler_test.go # integrationTests/multiShard/hardFork/hardFork_test.go # update/factory/exportHandlerFactory.go
…_full_archive_network
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## feat/multiple_p2p_messengers #5347 +/- ##
================================================================
- Coverage 80.34% 80.33% -0.01%
================================================================
Files 695 695
Lines 90370 90497 +127
================================================================
+ Hits 72604 72698 +94
- Misses 12599 12630 +31
- Partials 5167 5169 +2
☔ View full report in Codecov by Sentry. |
// Get does nothing as it is disabled | ||
func (holder *preferredPeersHolder) Get() map[uint32][]core.PeerID { | ||
return make(map[uint32][]core.PeerID) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Get does nothing as it is disabled | |
func (holder *preferredPeersHolder) Get() map[uint32][]core.PeerID { | |
return make(map[uint32][]core.PeerID) | |
} | |
// Get returns empty map as it is disabled | |
func (holder *preferredPeersHolder) Get() map[uint32][]core.PeerID { | |
return make(map[uint32][]core.PeerID) | |
} |
?
func (mnc *managedNetworkComponents) FullArchivePreferredPeersHolderHandler() factory.PreferredPeersHolderHandler { | ||
mnc.mutNetworkComponents.RLock() | ||
defer mnc.mutNetworkComponents.RUnlock() | ||
|
||
if mnc.networkComponents == nil { | ||
return nil | ||
} | ||
|
||
return mnc.mainNetworkHolder.preferredPeersHolder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func (mnc *managedNetworkComponents) FullArchivePreferredPeersHolderHandler() factory.PreferredPeersHolderHandler { | |
mnc.mutNetworkComponents.RLock() | |
defer mnc.mutNetworkComponents.RUnlock() | |
if mnc.networkComponents == nil { | |
return nil | |
} | |
return mnc.mainNetworkHolder.preferredPeersHolder | |
func (mnc *managedNetworkComponents) FullArchivePreferredPeersHolderHandler() factory.PreferredPeersHolderHandler { | |
mnc.mutNetworkComponents.RLock() | |
defer mnc.mutNetworkComponents.RUnlock() | |
if mnc.networkComponents == nil { | |
return nil | |
} | |
return mnc.fullArchiveNetworkHolder.preferredPeersHolder |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated, good catch
cmd/node/config/prefs.toml
Outdated
# "127.0.0.10", | ||
# "16Uiu2HAm6yvbp1oZ6zjnWsn9FdRqBSaQkbhELyaThuq48ybdorrr" | ||
# ] | ||
PreferredFullArchiveConnections = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can use the same PreferredConnections
list for all network messengers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed and reused the old one
@@ -31,7 +31,11 @@ func NewTopicResolverSender(arg ArgTopicResolverSender) (*topicResolverSender, e | |||
// Send is used to send an array buffer to a connected peer | |||
// It is used when replying to a request | |||
func (trs *topicResolverSender) Send(buff []byte, peer core.PeerID) error { | |||
return trs.sendToConnectedPeer(trs.topicName, buff, peer) | |||
if trs.fullArchiveMessenger.IsConnected(peer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this is how we manage to send on the "correct" network
The other possibility was to provide the dataretriever.MessageHandler
instance on this function. This variant will ensure that performance degradation will not occur.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added TODO and will be fixed in the next PR, as discussed
@@ -259,6 +259,18 @@ func (mnc *managedNetworkComponents) FullArchivePeersRatingMonitor() p2p.PeersRa | |||
return mnc.fullArchiveNetworkHolder.peersRatingMonitor | |||
} | |||
|
|||
// FullArchivePreferredPeersHolderHandler returns the preferred peers holder of the full archive network | |||
func (mnc *managedNetworkComponents) FullArchivePreferredPeersHolderHandler() factory.PreferredPeersHolderHandler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think this is required
@@ -111,12 +113,103 @@ func TestPeersRatingAndResponsiveness(t *testing.T) { | |||
assert.Equal(t, finalMaliciousExpectedRating, maliciousRating) | |||
} | |||
|
|||
func createNodeWithPeersRatingHandler(shardID uint32, numShards uint32) *integrationTests.TestProcessorNode { | |||
func TestPeersRatingAndResponsivenessOnFullArchive(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
very good test for ensuring that the feature works
Reasoning behind the pull request
Proposed changes
Testing procedure
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
feat
branch created?feat
branch merging, do all satellite projects have a proper tag insidego.mod
?