Skip to content
This repository was archived by the owner on Jan 9, 2024. It is now read-only.

Do not initialize cluster when cluster slots are empty for node #517

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion rediscluster/nodemanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ def initialize(self):
try:
r = self.get_redis_link(host=node["host"], port=node["port"], decode_responses=True)
cluster_slots = r.execute_command("cluster", "slots")
if len(cluster_slots) == 0:
raise ResponseError('CLUSTERSLOTEMPTY')

startup_nodes_reachable = True
except (ConnectionError, TimeoutError):
continue
Expand All @@ -232,7 +235,7 @@ def initialize(self):

# Isn't a cluster connection, so it won't parse these exceptions automatically
message = e.__str__()
if 'CLUSTERDOWN' in message or 'MASTERDOWN' in message:
if 'CLUSTERDOWN' in message or 'MASTERDOWN' in message or 'CLUSTERSLOTEMPTY' in message:
continue
else:
raise RedisClusterException("ERROR sending 'cluster slots' command to redis server: {0}".format(node))
Expand Down