This repository has been archived by the owner on Feb 18, 2021. It is now read-only.
Replicator: don't keep the conn object forever #263
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
remoteReplicatorConn(similar for storehostConn) is a map we use to do dedups against incoming requests. For example, if there's already a connection for ext1, then we receive a new request for the same extent, we close the existing connection for ext1, remove the connection from the map, then creates a new connection and store the new connection in the map.
The problem is if there's no duplicate connection(as in the common case), we never delete the connection from the map, which causes memory leak
In fact the dedup in replicator is not needed, as we're already doing dedup in store host side. But the map is still useful for the admin API, so I repurposed the map to only be used by the admin API, and the connection will be deleted from the map at the end of the API call(as soon as the connection is closed)