deprecate whitelist LBP

This commit is contained in:
Jim Witschey
2017-06-02 17:17:57 -04:00
parent 36ff6f9580
commit 4bd9229183
2 changed files with 21 additions and 0 deletions

View File

@@ -9,6 +9,10 @@ Bug Fixes
--------- ---------
* is_idempotent flag is not propagated from PreparedStatement to BoundStatement (PYTHON-736) * is_idempotent flag is not propagated from PreparedStatement to BoundStatement (PYTHON-736)
Other
-----
* Deprecate WhiteListRoundRobinPolicy (PYTHON-759)
3.10.0 3.10.0
====== ======
May 24, 2017 May 24, 2017

View File

@@ -17,6 +17,7 @@ import logging
from random import randint, shuffle from random import randint, shuffle
from threading import Lock from threading import Lock
import socket import socket
from warnings import warn
from cassandra import ConsistencyLevel, OperationTimedOut from cassandra import ConsistencyLevel, OperationTimedOut
@@ -396,6 +397,10 @@ class TokenAwarePolicy(LoadBalancingPolicy):
class WhiteListRoundRobinPolicy(RoundRobinPolicy): 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 A subclass of :class:`.RoundRobinPolicy` which evenly
distributes queries across all nodes in the cluster, distributes queries across all nodes in the cluster,
regardless of what datacenter the nodes may be in, but 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 https://datastax-oss.atlassian.net/browse/JAVA-145
Where connection errors occur when connection Where connection errors occur when connection
attempts are made to private IP addresses remotely attempts are made to private IP addresses remotely
.. |wlrrp| raw:: html
<b><code>WhiteListRoundRobinPolicy</code></b>
.. _PYTHON-758: https://datastax-oss.atlassian.net/browse/PYTHON-758
""" """
def __init__(self, hosts): def __init__(self, hosts):
""" """
The `hosts` parameter should be a sequence of hosts to permit The `hosts` parameter should be a sequence of hosts to permit
connections to. 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 = hosts
self._allowed_hosts_resolved = [endpoint[4][0] for a in self._allowed_hosts self._allowed_hosts_resolved = [endpoint[4][0] for a in self._allowed_hosts