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

dc: Prune peer map if we've pruned the id map #2319

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

Mark-Simulacrum
Copy link
Collaborator

Description of changes:

This ensures that when we prune entries from the map, we bound the size of the peer set as well, if slightly eventually consistently (but that's currently true for both maps). Our expectation is that the source of "truth" is always the ids map -- the peers map is essentially just an index over it. On the other hand, the peers map represents the important entries, since they are the latest negotiated secret for a given peer.

Call-outs:

Follow-up work is planned to replace these maps to remove the eventual consistency and hard-constrain memory usage up front, but this patches an immediate memory leak, so prioritizing the simple fix first.

Testing:

Invariant checking is updated -- more changes than I'd like, but previously we weren't testing the overflow at all in those tests (impossible to fill the 500,000 entry map) -- so needed a good chunk of changes to account for that. It would be good to explore changing those tests, I'm not sure how to best write assertions for what is at the end of the day a somewhat random problem.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

This ensures that when we prune entries from the map, we bound the size
of the peer set as well.

This also updates our test coverage to include a small-size map, which
causes us to need to tweak a few assertions to account for the now
semi-random removals. I'm not very happy with the result, but I think
it's OK for now. Mid-term it probably makes sense to figure out a better
way to make sure our logic is sound (e.g., probability of removing a
recently added peer should be near zero).
camshaft
camshaft previously approved these changes Sep 13, 2024
@camshaft
Copy link
Contributor

@camshaft camshaft enabled auto-merge (squash) September 13, 2024 19:18
@camshaft camshaft merged commit 132ba54 into aws:main Sep 13, 2024
117 of 119 checks passed
@Mark-Simulacrum Mark-Simulacrum deleted the prune-peers branch September 20, 2024 00:48
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.

2 participants