You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by seeday October 6, 2021
I'm attempting to broadcast commands to all the replicas in a Redis Cluster deployment, but I'm seeing some weird behavior. Code is below. Redis 6.0.9 and Lettuce 6.1.5.
doThing and doThing3 work just fine, however I feel like doThing2 should also work, and I don't quite understand why. The results from doThing2 return jumbled up, weirdly nested, and out of order, like there's multiple threads fighting over the single NestedMultiOutput. I've tried several ways of synchronizing a NestedMultiOutput, but neither locks nor threadlocals work properly.
While 3 does work, (specifically for custom commands), I'm curious as to what option 1 is doing to synchronize the responses properly, why option 2 is not equivalent to 1, and if it's doing it faster than my mess of CompletableFutures in option 3.
Thanks!
We need to document that dispatch cannot be used in its regular form as the CommandOutput is shared across connections and that messes up the result. We should also throw an exception there and consider a dispatch variant accepting a Supplier.
The text was updated successfully, but these errors were encountered:
…tput #1876
The command output from dispatch(…) on the NodeSelection API is being reused for all command instances and therefore it collects responses from all nodes. This is typically not desired. Therefore, we introduced dispatch(…) method overloads accepting Supplier of outputs to provide an individual output for each invocation to separate responses. dispatch(…) methods accepting just an output object are deprecated now.
Discussed in #1875
Originally posted by seeday October 6, 2021
I'm attempting to broadcast commands to all the replicas in a Redis Cluster deployment, but I'm seeing some weird behavior. Code is below. Redis 6.0.9 and Lettuce 6.1.5.
doThing
anddoThing3
work just fine, however I feel likedoThing2
should also work, and I don't quite understand why. The results fromdoThing2
return jumbled up, weirdly nested, and out of order, like there's multiple threads fighting over the singleNestedMultiOutput
. I've tried several ways of synchronizing aNestedMultiOutput
, but neither locks nor threadlocals work properly.While 3 does work, (specifically for custom commands), I'm curious as to what option 1 is doing to synchronize the responses properly, why option 2 is not equivalent to 1, and if it's doing it faster than my mess of
CompletableFuture
s in option 3.Thanks!
We need to document that
dispatch
cannot be used in its regular form as theCommandOutput
is shared across connections and that messes up the result. We should also throw an exception there and consider adispatch
variant accepting aSupplier
.The text was updated successfully, but these errors were encountered: