|
75 | 75 | NoSpeculativeExecutionPolicy, DefaultLoadBalancingPolicy, |
76 | 76 | NeverRetryPolicy) |
77 | 77 | from cassandra.pool import (Host, _ReconnectionHandler, _HostReconnectionHandler, |
78 | | - HostConnectionPool, HostConnection, |
| 78 | + HostConnection, |
79 | 79 | NoConnectionsAvailable) |
80 | 80 | from cassandra.query import (SimpleStatement, PreparedStatement, BoundStatement, |
81 | 81 | BatchStatement, bind_params, QueryTrace, TraceUnavailable, |
@@ -731,9 +731,6 @@ def auth_provider(self): |
731 | 731 | be an instance of a subclass of :class:`~cassandra.auth.AuthProvider`, |
732 | 732 | such as :class:`~.PlainTextAuthProvider`. |
733 | 733 |
|
734 | | - When :attr:`~.Cluster.protocol_version` is 1, this should be |
735 | | - a function that accepts one argument, the IP address of a node, |
736 | | - and returns a dict of credentials for that node. |
737 | 734 |
|
738 | 735 | When not using authentication, this should be left as :const:`None`. |
739 | 736 | """ |
@@ -1452,18 +1449,6 @@ def __init__(self, |
1452 | 1449 |
|
1453 | 1450 | self._user_types = defaultdict(dict) |
1454 | 1451 |
|
1455 | | - self._min_requests_per_connection = { |
1456 | | - HostDistance.LOCAL_RACK: DEFAULT_MIN_REQUESTS, |
1457 | | - HostDistance.LOCAL: DEFAULT_MIN_REQUESTS, |
1458 | | - HostDistance.REMOTE: DEFAULT_MIN_REQUESTS |
1459 | | - } |
1460 | | - |
1461 | | - self._max_requests_per_connection = { |
1462 | | - HostDistance.LOCAL_RACK: DEFAULT_MAX_REQUESTS, |
1463 | | - HostDistance.LOCAL: DEFAULT_MAX_REQUESTS, |
1464 | | - HostDistance.REMOTE: DEFAULT_MAX_REQUESTS |
1465 | | - } |
1466 | | - |
1467 | 1452 | self._core_connections_per_host = { |
1468 | 1453 | HostDistance.LOCAL_RACK: DEFAULT_MIN_CONNECTIONS_PER_LOCAL_HOST, |
1469 | 1454 | HostDistance.LOCAL: DEFAULT_MIN_CONNECTIONS_PER_LOCAL_HOST, |
@@ -1666,48 +1651,6 @@ def add_execution_profile(self, name, profile, pool_wait_timeout=5): |
1666 | 1651 | if not_done: |
1667 | 1652 | raise OperationTimedOut("Failed to create all new connection pools in the %ss timeout.") |
1668 | 1653 |
|
1669 | | - def get_min_requests_per_connection(self, host_distance): |
1670 | | - return self._min_requests_per_connection[host_distance] |
1671 | | - |
1672 | | - def set_min_requests_per_connection(self, host_distance, min_requests): |
1673 | | - """ |
1674 | | - Sets a threshold for concurrent requests per connection, below which |
1675 | | - connections will be considered for disposal (down to core connections; |
1676 | | - see :meth:`~Cluster.set_core_connections_per_host`). |
1677 | | -
|
1678 | | - Pertains to connection pool management in protocol versions {1,2}. |
1679 | | - """ |
1680 | | - if self.protocol_version >= 3: |
1681 | | - raise UnsupportedOperation( |
1682 | | - "Cluster.set_min_requests_per_connection() only has an effect " |
1683 | | - "when using protocol_version 1 or 2.") |
1684 | | - if min_requests < 0 or min_requests > 126 or \ |
1685 | | - min_requests >= self._max_requests_per_connection[host_distance]: |
1686 | | - raise ValueError("min_requests must be 0-126 and less than the max_requests for this host_distance (%d)" % |
1687 | | - (self._min_requests_per_connection[host_distance],)) |
1688 | | - self._min_requests_per_connection[host_distance] = min_requests |
1689 | | - |
1690 | | - def get_max_requests_per_connection(self, host_distance): |
1691 | | - return self._max_requests_per_connection[host_distance] |
1692 | | - |
1693 | | - def set_max_requests_per_connection(self, host_distance, max_requests): |
1694 | | - """ |
1695 | | - Sets a threshold for concurrent requests per connection, above which new |
1696 | | - connections will be created to a host (up to max connections; |
1697 | | - see :meth:`~Cluster.set_max_connections_per_host`). |
1698 | | -
|
1699 | | - Pertains to connection pool management in protocol versions {1,2}. |
1700 | | - """ |
1701 | | - if self.protocol_version >= 3: |
1702 | | - raise UnsupportedOperation( |
1703 | | - "Cluster.set_max_requests_per_connection() only has an effect " |
1704 | | - "when using protocol_version 1 or 2.") |
1705 | | - if max_requests < 1 or max_requests > 127 or \ |
1706 | | - max_requests <= self._min_requests_per_connection[host_distance]: |
1707 | | - raise ValueError("max_requests must be 1-127 and greater than the min_requests for this host_distance (%d)" % |
1708 | | - (self._min_requests_per_connection[host_distance],)) |
1709 | | - self._max_requests_per_connection[host_distance] = max_requests |
1710 | | - |
1711 | 1654 | def get_core_connections_per_host(self, host_distance): |
1712 | 1655 | """ |
1713 | 1656 | Gets the minimum number of connections per Session that will be opened |
@@ -3101,13 +3044,11 @@ def _create_response_future(self, query, parameters, trace, custom_payload, |
3101 | 3044 | spec_exec_policy = execution_profile.speculative_execution_policy |
3102 | 3045 |
|
3103 | 3046 | fetch_size = query.fetch_size |
3104 | | - if fetch_size is FETCH_SIZE_UNSET and self._protocol_version >= 2: |
| 3047 | + if fetch_size is FETCH_SIZE_UNSET: |
3105 | 3048 | fetch_size = self.default_fetch_size |
3106 | | - elif self._protocol_version == 1: |
3107 | | - fetch_size = None |
3108 | 3049 |
|
3109 | 3050 | start_time = time.time() |
3110 | | - if self._protocol_version >= 3 and self.use_client_timestamp: |
| 3051 | + if self.use_client_timestamp: |
3111 | 3052 | timestamp = self.cluster.timestamp_generator() |
3112 | 3053 | else: |
3113 | 3054 | timestamp = None |
@@ -3378,11 +3319,7 @@ def add_or_renew_pool(self, host, is_host_addition): |
3378 | 3319 |
|
3379 | 3320 | def run_add_or_renew_pool(): |
3380 | 3321 | try: |
3381 | | - if self._protocol_version >= 3: |
3382 | | - new_pool = HostConnection(host, distance, self) |
3383 | | - else: |
3384 | | - # TODO remove host pool again ??? |
3385 | | - new_pool = HostConnectionPool(host, distance, self) |
| 3322 | + new_pool = HostConnection(host, distance, self) |
3386 | 3323 | except AuthenticationFailed as auth_exc: |
3387 | 3324 | conn_exc = ConnectionException(str(auth_exc), endpoint=host) |
3388 | 3325 | self.cluster.signal_connection_failure(host, conn_exc, is_host_addition) |
|
0 commit comments