-
Notifications
You must be signed in to change notification settings - Fork 38.7k
addrman: delete addresses that don't belong to the supported networks #29330
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
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
cc: @mzumsande |
c4dec94 to
cf44d43
Compare
|
🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the Possibly this is due to a silent merge conflict (the changes in this pull request being Leave a comment here, if you need help tracking down a confusing failure. |
This function deletes addresses from addrman that are not from the specified networks.
This flag controls whether the user wants to delete addresses from addrman that don't belong to the supported networks in initialization.
cf44d43 to
9019237
Compare
9019237 to
36fd704
Compare
|
Having these records around might be useful too, if you go back to those networks. Do we have any practical problems with these Select calls? Too much CPU time, orz disk reads, or memory use? Not only this would motivate this code change and review use better, but also it would help us understand under which circumstances a node operator might actually want to do this....And then maybe the right thing would be to trigger this cleaning automatically rather than thinking a user will trigger it. Or, what i think is even more likely, we may rather change Addrman architecture to facilitate this better in the first place. |
|
+1 to the questions asked by @naumenkogs. I agree with the statement in the OP that this change would "avoid a lot of unnecessary addrman in general I am hesitant to add init params since it increases the combinatoric space of startup possibilities & they are hard to deprecate over time. maybe one idea (if we want to support this feature) could be to add a param to |
This comment was marked as abuse.
This comment was marked as abuse.
|
@naumenkogs and @amitiuttarwar I just updated the description with more infos. Thanks!
@naumenkogs: What do you mean by changing addrman architecture? |
It would be good to have some intution for how big this effect is. For example, if you have an addrman with mostly IPv4/IPv6 addresses and a few onion ones then restart with |
|
What about setting Line 2682 in 7143d43
if Lines 2695 to 2697 in 7143d43
That would skew the outcome though. If addrman has 60% IPv4, 25% Tor and 15% I2P addresses right now it is more likely to select Tor over I2P. If we run with
clearnet addresses might be useful to Tor peers if they are multi-homed. I think it is good that we send any address type to any peer. Instead of e.g. only Tor addresses to Tor peers. |
Yes, I previously discussed this options with @mzumsande. It might be an alternative, sure.
Sure, we can extend addrman's
Sure, this is something we can dicuss because not ensuring we're sending Tor addresses to Tor peers is also not positive. But I agree on relaying clearnet addresses for those nodes. I do not have this data, but I suppose that most Tor peers also run on clearnet? |
Right, if we sent solely IPv4 addresses to a Tor peer while we have Tor addresses, that seems like something that can be improved. |
|
I'll close this PR to work on a "less aggressive" approach (extending Thanks, @vasild @mzumsande @naumenkogs @amitiuttarwar. |
…enConnections` e4e3b44 net: call `Select` with reachable networks in `ThreadOpenConnections` (brunoerg) 829becd addrman: change `Select` to support multiple networks (brunoerg) f698636 net: add `All()` in `ReachableNets` (brunoerg) Pull request description: This PR changes addrman's `Select` to support multiple networks and change `ThreadOpenConnections` to call it with reachable networks. It can avoid unnecessary `Select` calls and avoid exceeding the max number of tries (100), especially when turning a clearnet + Tor/I2P/CJDNS node to Tor/I2P/CJDNS. Compared to #29330, this approach is "less aggresive". It does not add a new init flag and does not impact address relay. I did an experiment of calling `Select` without passing a network until it finds an address from a network that compose 20% ~ 25% of the addrman (limited to 100 tries).  ACKs for top commit: achow101: ACK e4e3b44 vasild: ACK e4e3b44 naumenkogs: ACK e4e3b44 Tree-SHA512: e8466b72b85bbc2ad8bfb14471eb27d2c50d4e84218f5ede2c15a6fa3653af61b488cde492dbd398f7502bd847e95bfee1abb7e01092daba2236d3ce3d6d2268
This PR adds a new flag
-cleanupaddrman. When initializing a node with this flag, it will delete addresses from addrman (both new and tried tables) that do not belong to the supported networks (e.g.-onlynet). Deleting addresses that do not belong to the supported networks can avoid a lot of unnecessary addrmanSelectcalls (especially when turning from clearnet + Tor/I2P/CJDNS to Tor/I2P/CJDNS).ThreadOpenConnections.