nebulex_redis_adapter icon indicating copy to clipboard operation
nebulex_redis_adapter copied to clipboard

Redis 7 issue

Open carlosescri opened this issue 2 years ago • 2 comments

Hi! I think there's some kind of difference in the Redis response for the CLUSTER SLOTS command between v6 and v7. In v7 I was getting this:

iex(5)> {:ok, cluster_slots} = Redix.command(conn, ["CLUSTER", "SLOTS"])
{:ok,
 [
   [
     0,
     16383,
     ["172.20.0.2", 6379, "71053754ec7ec7bba4396ec6355634afc1a9eb18", []]
   ]
 ]}

which made my project break:

** (Mix) Could not start application …
    ** (EXIT) shutdown: failed to start child: …
        ** (EXIT) shutdown: failed to start child: {Redix, {0, 16383}}
            ** (EXIT) an exception was raised:
                ** (MatchError) no match of right hand side value: [["172.20.0.2", 6379, "71053754ec7ec7bba4396ec6355634afc1a9eb18", []]]
                    (nebulex_redis_adapter 2.0.0) lib/nebulex_redis_adapter/redis_cluster/supervisor.ex:21: NebulexRedisAdapter.RedisCluster.Supervisor.init/1
                    (stdlib 3.15.2) supervisor.erl:330: :supervisor.init/1
                    (stdlib 3.15.2) gen_server.erl:423: :gen_server.init_it/2
                    (stdlib 3.15.2) gen_server.erl:390: :gen_server.init_it/6
                    (stdlib 3.15.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3

After some investigation I noticed that we were using redis:latest docker image so I compared versions with my teammates and they had v6. I switched to that version too and the project stopped breaking.

After rebuilding my docker container, v6 response for CLUSTER SLOTS was:

iex(3)> {:ok, cluster_slots} = Redix.command(conn, ["CLUSTER", "SLOTS"])
{:ok,
 [[0, 16383, ["172.20.0.15", 6379, "e191e13a8cef4f17b4412e8f7660aee00f655e0f"]]]}

Hope it helps.

carlosescri avatar May 10 '22 19:05 carlosescri

Hey there 👋 ! I've pushed I fix I hope solves the issue with Redis 7, please try it out and let me know, it is on the master branch for now, but as soon as we can confirm the fix works I can publish a new release, stay tuned! Thanks!!

cabol avatar May 15 '22 12:05 cabol

Thanks @cabol, I'll give a try ASAP.

carlosescri avatar May 17 '22 09:05 carlosescri