Skip to content

JedisClusterInfoCache: refresh the nodes map #2550

@stillerrr

Description

@stillerrr

Expected behavior

Jedis would refresh the elements of nodes map when the cluster nodes changed

image

Actual behavior

this nodes parameter just add nodes if not exist in map, but not delete nodes when cluster nodes are deleted
image

Steps to reproduce:

it would cause a problem in this situation:

  1. create a redis cluster A with 10 master nodes and delete 9 nodes from cluster;
  2. use the 9 nodes create a new cluster B
  3. delete some slots from the cluster or give a large latency between client and the cluster A, make sure jedis throw JedisConnectionException;

JedisConnectionException would cause a slot refresh in JedisClusterCommand:

image

this method would use JedisClusterInfoCache paramter: nodes map values to refresh slot in JedisClusterInfoCache.renewClusterSlots():
image

image

There is a high probability(90%) that the jedis client will connect to cluster B because jedis use the cluster B nodes to refresh slot

Jedis version:

3.6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions