PUT to cluster send to all nodes rather than none
If the location log says all nodes contain content, pass in all nodes, rather than none. The location log can be wrong. While it's good to avoid unncessessary connections to nodes that already contain a key, it would be bad to refuse to accept an upload at all when the location log is wrong. Also, passing in no nodes leaves the proxy in an untenable state. It can't proxy to no nodes. So it closes the connection. Passing in all nodes means it has to do the work to connect to all of them, and see that they say they already have the content, and then it can tell the client that.
This commit is contained in:
parent
202ea3ff2a
commit
a23b0abf28
1 changed files with 7 additions and 2 deletions
|
@ -67,10 +67,15 @@ clusterProxySelector clusteruuid protocolversion = do
|
|||
return $ ProxySelector
|
||||
{ proxyCHECKPRESENT = nodecontaining remotesides
|
||||
, proxyGET = nodecontaining remotesides
|
||||
-- Send the key to every node that does not yet contain it.
|
||||
-- The key is sent to multiple nodes at the same time,
|
||||
-- skipping nodes where it's known/expected to already be
|
||||
-- present to avoid needing to connect to those.
|
||||
, proxyPUT = \k -> do
|
||||
locs <- S.fromList <$> loggedLocations k
|
||||
return $ filter (flip S.notMember locs . remoteUUID) remotesides
|
||||
let l = filter (flip S.notMember locs . remoteUUID) remotesides
|
||||
return $ if null l
|
||||
then remotesides
|
||||
else l
|
||||
-- Remove the key from every node that contains it.
|
||||
-- But, since it's possible the location log for some nodes
|
||||
-- could be out of date, actually try to remove from every
|
||||
|
|
Loading…
Add table
Reference in a new issue