Closed
Description
Version: v4.3.4
Platform: Python 3.9 on linux/macOS
Description: When delete() is called in a pipeline (async cluster version), it unexpectedly hits the delete() implementation of ClusterMultiKeyCommands
class below,
def delete(self, *keys: KeyT) -> ResponseT:
"""
Deletes the given keys in the cluster.
The keys are first split up into slots
and then an DEL command is sent for every slot
Non-existant keys are ignored.
Returns the number of keys that were deleted.
For more information see https://redis.io/commands/del
"""
return self._split_command_across_slots("DEL", *keys)
This is how it is used on our end,
async with c.pipeline() as p:
for key in keys:
p.delete(key)
return await p.execute()
The reason we use pipeline instead of the multi-key delete is because keys are split by slots under the hood, and it is less performance than splitting by node that is already handled by the pipeline. The above behavior should be similar to what's being done in sync pipeline,
def delete(self, *names):
"""
"Delete a key specified by ``names``"
"""
if len(names) != 1:
raise RedisClusterException(
"deleting multiple keys is not " "implemented in pipeline command"
)
return self.execute_command("DEL", names[0])
Metadata
Metadata
Assignees
Labels
No labels