From 4bd9229183ff9bc883bc35074ed11400794faaf0 Mon Sep 17 00:00:00 2001 From: Jim Witschey Date: Fri, 2 Jun 2017 17:17:57 -0400 Subject: [PATCH] deprecate whitelist LBP --- CHANGELOG.rst | 4 ++++ cassandra/policies.py | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 643cc5b4..35d9e032 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,6 +9,10 @@ Bug Fixes --------- * is_idempotent flag is not propagated from PreparedStatement to BoundStatement (PYTHON-736) +Other +----- +* Deprecate WhiteListRoundRobinPolicy (PYTHON-759) + 3.10.0 ====== May 24, 2017 diff --git a/cassandra/policies.py b/cassandra/policies.py index 1cafcce3..c617c95c 100644 --- a/cassandra/policies.py +++ b/cassandra/policies.py @@ -17,6 +17,7 @@ import logging from random import randint, shuffle from threading import Lock import socket +from warnings import warn from cassandra import ConsistencyLevel, OperationTimedOut @@ -396,6 +397,10 @@ class TokenAwarePolicy(LoadBalancingPolicy): class WhiteListRoundRobinPolicy(RoundRobinPolicy): """ + |wlrrp| **is deprecated. It will be removed in 4.0.** It can effectively be + reimplemented using :class:`.HostFilterPolicy`. For more information, see + PYTHON-758_. + A subclass of :class:`.RoundRobinPolicy` which evenly distributes queries across all nodes in the cluster, regardless of what datacenter the nodes may be in, but @@ -405,12 +410,24 @@ class WhiteListRoundRobinPolicy(RoundRobinPolicy): https://datastax-oss.atlassian.net/browse/JAVA-145 Where connection errors occur when connection attempts are made to private IP addresses remotely + + .. |wlrrp| raw:: html + + WhiteListRoundRobinPolicy + + .. _PYTHON-758: https://datastax-oss.atlassian.net/browse/PYTHON-758 + """ def __init__(self, hosts): """ The `hosts` parameter should be a sequence of hosts to permit connections to. """ + msg = ('WhiteListRoundRobinPolicy is deprecated. ' + 'It will be removed in 4.0.') + warn(msg, DeprecationWarning) + # DeprecationWarnings are silent by default so we also log the message + log.warning(msg) self._allowed_hosts = hosts self._allowed_hosts_resolved = [endpoint[4][0] for a in self._allowed_hosts