@@ -387,8 +387,7 @@ def __init__(
387
387
port = 6379 ,
388
388
startup_nodes = None ,
389
389
cluster_error_retry_attempts = 3 ,
390
- require_full_coverage = True ,
391
- skip_full_coverage_check = False ,
390
+ require_full_coverage = False ,
392
391
reinitialize_steps = 10 ,
393
392
read_from_replicas = False ,
394
393
url = None ,
@@ -404,16 +403,15 @@ def __init__(
404
403
:port: 'int'
405
404
Can be used to point to a startup node
406
405
:require_full_coverage: 'bool'
407
- If set to True, as it is by default, all slots must be covered.
408
- If set to False and not all slots are covered, the instance
409
- creation will succeed only if 'cluster-require-full-coverage'
410
- configuration is set to 'no' in all of the cluster's nodes.
411
- Otherwise, RedisClusterException will be thrown.
412
- :skip_full_coverage_check: 'bool'
413
- If require_full_coverage is set to False, a check of
414
- cluster-require-full-coverage config will be executed against all
415
- nodes. Set skip_full_coverage_check to True to skip this check.
416
- Useful for clusters without the CONFIG command (like ElastiCache)
406
+ When set to False (default value): the client will not require a
407
+ full coverage of the slots. However, if not all slots are covered,
408
+ and at least one node has 'cluster-require-full-coverage' set to
409
+ 'yes,' the server will throw a ClusterDownError for some key-based
410
+ commands. See -
411
+ https://redis.io/topics/cluster-tutorial#redis-cluster-configuration-parameters
412
+ When set to True: all slots must be covered to construct the
413
+ cluster client. If not all slots are covered, RedisClusterException
414
+ will be thrown.
417
415
:read_from_replicas: 'bool'
418
416
Enable read from replicas in READONLY mode. You can read possibly
419
417
stale data.
@@ -510,7 +508,6 @@ def __init__(
510
508
startup_nodes = startup_nodes ,
511
509
from_url = from_url ,
512
510
require_full_coverage = require_full_coverage ,
513
- skip_full_coverage_check = skip_full_coverage_check ,
514
511
** kwargs ,
515
512
)
516
513
@@ -1111,8 +1108,7 @@ def __init__(
1111
1108
self ,
1112
1109
startup_nodes ,
1113
1110
from_url = False ,
1114
- require_full_coverage = True ,
1115
- skip_full_coverage_check = False ,
1111
+ require_full_coverage = False ,
1116
1112
lock = None ,
1117
1113
** kwargs ,
1118
1114
):
@@ -1123,7 +1119,6 @@ def __init__(
1123
1119
self .populate_startup_nodes (startup_nodes )
1124
1120
self .from_url = from_url
1125
1121
self ._require_full_coverage = require_full_coverage
1126
- self ._skip_full_coverage_check = skip_full_coverage_check
1127
1122
self ._moved_exception = None
1128
1123
self .connection_kwargs = kwargs
1129
1124
self .read_load_balancer = LoadBalancer ()
@@ -1249,32 +1244,6 @@ def populate_startup_nodes(self, nodes):
1249
1244
for n in nodes :
1250
1245
self .startup_nodes [n .name ] = n
1251
1246
1252
- def cluster_require_full_coverage (self , cluster_nodes ):
1253
- """
1254
- if exists 'cluster-require-full-coverage no' config on redis servers,
1255
- then even all slots are not covered, cluster still will be able to
1256
- respond
1257
- """
1258
-
1259
- def node_require_full_coverage (node ):
1260
- try :
1261
- return (
1262
- "yes"
1263
- in node .redis_connection .config_get (
1264
- "cluster-require-full-coverage"
1265
- ).values ()
1266
- )
1267
- except ConnectionError :
1268
- return False
1269
- except Exception as e :
1270
- raise RedisClusterException (
1271
- 'ERROR sending "config get cluster-require-full-coverage"'
1272
- f" command to redis server: { node .name } , { e } "
1273
- )
1274
-
1275
- # at least one node should have cluster-require-full-coverage yes
1276
- return any (node_require_full_coverage (node ) for node in cluster_nodes .values ())
1277
-
1278
1247
def check_slots_coverage (self , slots_cache ):
1279
1248
# Validate if all slots are covered or if we should try next
1280
1249
# startup node
@@ -1450,29 +1419,9 @@ def initialize(self):
1450
1419
# isn't a full coverage
1451
1420
raise RedisClusterException (
1452
1421
f"All slots are not covered after query all startup_nodes. "
1453
- f"{ len (self . slots_cache )} of { REDIS_CLUSTER_HASH_SLOTS } "
1422
+ f"{ len (tmp_slots )} of { REDIS_CLUSTER_HASH_SLOTS } "
1454
1423
f"covered..."
1455
1424
)
1456
- elif not fully_covered and not self ._require_full_coverage :
1457
- # The user set require_full_coverage to False.
1458
- # In case of full coverage requirement in the cluster's Redis
1459
- # configurations, we will raise an exception. Otherwise, we may
1460
- # continue with partial coverage.
1461
- # see Redis Cluster configuration parameters in
1462
- # https://redis.io/topics/cluster-tutorial
1463
- if (
1464
- not self ._skip_full_coverage_check
1465
- and self .cluster_require_full_coverage (tmp_nodes_cache )
1466
- ):
1467
- raise RedisClusterException (
1468
- "Not all slots are covered but the cluster's "
1469
- "configuration requires full coverage. Set "
1470
- "cluster-require-full-coverage configuration to no on "
1471
- "all of the cluster nodes if you wish the cluster to "
1472
- "be able to serve without being fully covered."
1473
- f"{ len (self .slots_cache )} of { REDIS_CLUSTER_HASH_SLOTS } "
1474
- f"covered..."
1475
- )
1476
1425
1477
1426
# Set the tmp variables to the real variables
1478
1427
self .nodes_cache = tmp_nodes_cache
0 commit comments