lettuce icon indicating copy to clipboard operation
lettuce copied to clipboard

Does Lettuce use CLUSTER NODES instead of CLUSTER SLOTS to discover topology?

Open markobip opened this issue 3 weeks ago • 3 comments

Bug Report

In DefaultClusterTopologyRefresh, it seems to me that the topology is discovered using CLUSTER NODES.

If I understand correctly, clients should use CLUSTER SLOTS to discover topology.

Current Behavior

We sometimes get a LOADING Redis is loading the dataset in memory error when an instance comes online in the cluster.
I wasn't able to reproduce this reliably yet.

Input Code

We connect like this:

Input Code
RedisURI.Builder builder = RedisURI.Builder.sentinel("one")
        .withSentinel("two")
        .withSentinel("three");

redisUri = builder.get()
        .withSentinelMasterId(redisProperties.getSentinelMaster())
        .withAuthentication(
                redisProperties.getUsername(),
                redisProperties.getPassword().toCharArray()
        )
        .build();

client = RedisClient.create();
connection = MasterReplica.connect(client, codec, redisUri);
connection.setReadFrom(ReadFrom.LOWEST_LATENCY);
syncCommands = connection.sync();

Expected behavior/code

I expect Lettuce to never connect to a Redis instance that is still syncing.

Environment

  • Lettuce version: [6.3.2.RELEASE]
  • Redis version: [7.2.3]
  • Sentinel

Possible Solution

Use CLUSTER SLOTS instead of CLUSTER NODES when discovering topology.

Additional context

I'm not entirely sure I understand all the moving parts here, so I'm sorry if I am wrong here. Thanks anyway! :D

markobip avatar Jun 17 '24 08:06 markobip