Closed whs closed 2 years ago
I'm confused why Group.Remove()
would cause an recursive issue. As the code is currently written no recursive issue is known of. Can you please explain the conditions where this would occur?
The recursion scenario would occur in out of tree code:
Remove
Remove
call removeFromPeer
for all other peersRemove
once removeFromPeer
request has been received (HttpPool use private API so it will only call localRemove
and not removeFromPeer
)I did some more work and turns out more API needs to be public to accommodate for out-of-tree ProtoGetter so I already moved to HTTP2 based ProtoGetter.
When implementing
groupcache.ProtoGetter
, callingGroup.Remove
is not an option as it would recursively resend the removal request to other peers. In the HTTP transport the private methodlocalRemove
is used to prevent such issue, but this would make out of package alternative transport (we're using gRPC) implementation impossible.Arguably, making this private API public would make it misuse-prone, but I believe other than shipping all possible transports, there's no alternative. Unlike
Get
,Remove
needs to be fired on all nodes so the terminating cause wouldn't be the same asGet
.I'm open to open sourcing our gRPC peer picker as well, if this upstream would accept it.