RedisLabs / redis-cluster-proxy

A proxy for Redis clusters.
GNU Affero General Public License v3.0
993 stars 132 forks source link

Pipeline throws CROSSSLOT error with enable-cross-slot set #80

Closed antonioshadji closed 4 years ago

antonioshadji commented 4 years ago

I didn't see any mention of pipelines not being supported in the documentation.

Command that triggers the error

            p = RedisManager().pipeline()
            p.hgetall("{}_success".format(self.account))
            p.hgetall("{}_delivered".format(self.account))
            a, b = p.execute()

RedisManager is a thin wrapper around redis-py. It instantiates client with host, port and: decode_responses=True, socket_timeout=1.0

On execution of the pipeline this error is seen.

redis.exceptions.ResponseError: CROSSSLOT Keys in request don't hash to the same slot

enable-cross slot was enabled with PROXY command.

nxapp-as-app01d.sys.comcast.net:7777> PROXY config get enable-cross-slot
1) enable-cross-slot
2) (integer) 1

built on unstable branch, git commit ac83840d1108901a475e24232b7a0986e97e65dd

tested with redis-py 3.0.1 and 3.5.3 with same result. hiredis is installed in the environment.

antonioshadji commented 4 years ago

By default the redis-py libraries executes pipelines as atomic transactions. Setting transaction=False in pipeline allows this to work.

This was never an issue with the proxy server. It was the redis-py library that required a different configuration when moving code from redis-py-cluster library.

pnthai88 commented 3 years ago

i made the same pipeline connection but got the error

[2021-09-30 04:26:03.342/M] Accepted connection from 172.18.0.1:59038 [2021-09-30 04:26:03.342/M] Created client 1:25 with address 0x560b586af1e8 [2021-09-30 04:26:03.342/M] Client 1:25 connected from 172.18.0.1:59038 (thread: 1) [2021-09-30 04:26:03.342/1] Client 1:25 added to thread 1 [2021-09-30 04:26:03.342/1] Created Request 1:25:0 with address 0x560b59610508 [2021-09-30 04:26:03.342/1] Read 90 bytes into req. 1:25:0, buffer is 90 bytes [2021-09-30 04:26:03.342/1] Parsing request 1:25:0, status: -1 [2021-09-30 04:26:03.342/1] Request 1:25:0 buffer: "*4\r\n$4\r\nHSET\r\n$46\r\nARG::CHILD_COMPANY_USER_CONFIGS::srva\r\n$10\r\npermission\r\n$0\r\n\r\n" [2021-09-30 04:26:03.342/1] Req. 1:25:0 ARGV[0]: 'HSET' [2021-09-30 04:26:03.342/1] Req. 1:25:0 ARGV[1]: 'ARG::CHILD_COMPANY_USER_CONFIGS::srva' [2021-09-30 04:26:03.342/1] Req. 1:25:0 ARGV[2]: 'permission' [2021-09-30 04:26:03.342/1] Failed to parse request 1:25:0 [2021-09-30 04:26:03.342/1] Request 1:25:0 parsing error: 'Protocol error: invalid bulk length' [2021-09-30 04:26:03.342/1] Unlink client 1:25 [2021-09-30 04:26:03.342/1] Freeing client 1:25 (thread: 1) [2021-09-30 04:26:03.342/1] Free Request 1:25:0