Skip to content

Commit 3a2ea45

Browse files
aboudreaultTheRealFalcon
authored andcommitted
Make sure to only query the native_transport_address column with DSE
1 parent c9da056 commit 3a2ea45

File tree

4 files changed

+22
-15
lines changed

4 files changed

+22
-15
lines changed

CHANGELOG.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ Features
66
--------
77
* Add all() function to the ResultSet API (PYTHON-1203)
88

9+
Bug Fixes
10+
---------
11+
* Make sure to only query the native_transport_address column with DSE (PYTHON-1205)
12+
913
3.21.0
1014
======
1115
January 15, 2020

build.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ schedules:
99
matrix:
1010
exclude:
1111
- python: [3.4, 3.6, 3.7, 3.8]
12-
- cassandra: ['2.1', '3.0', 'test-dse']
12+
- cassandra: ['2.1', '3.0', '4.0', 'test-dse']
1313

1414
commit_long_test:
1515
schedule: per_commit
@@ -21,7 +21,7 @@ schedules:
2121
matrix:
2222
exclude:
2323
- python: [3.4, 3.6, 3.7, 3.8]
24-
- cassandra: ['2.1', '3.0', 'test-dse']
24+
- cassandra: ['2.1', '3.0', '4.0', 'test-dse']
2525

2626
commit_branches:
2727
schedule: per_commit
@@ -34,7 +34,7 @@ schedules:
3434
matrix:
3535
exclude:
3636
- python: [3.4, 3.6, 3.7, 3.8]
37-
- cassandra: ['2.1', '3.0', 'test-dse']
37+
- cassandra: ['2.1', '3.0', '4.0', 'test-dse']
3838

3939
commit_branches_dev:
4040
schedule: per_commit
@@ -47,7 +47,7 @@ schedules:
4747
matrix:
4848
exclude:
4949
- python: [2.7, 3.4, 3.7, 3.6, 3.8]
50-
- cassandra: ['2.0', '2.1', '2.2', '3.0', '3.11', 'test-dse', 'dse-4.8', 'dse-5.0', 'dse-6.0', 'dse-6.7', 'dse-6.8']
50+
- cassandra: ['2.0', '2.1', '2.2', '3.0', '4.0', 'test-dse', 'dse-4.8', 'dse-5.0', 'dse-6.0', 'dse-6.8']
5151

5252
release_test:
5353
schedule: per_commit
@@ -139,7 +139,7 @@ schedules:
139139
matrix:
140140
exclude:
141141
- python: [3.4, 3.6, 3.7, 3.8]
142-
- cassandra: ['2.0', '2.1', '2.2', '3.0', 'test-dse']
142+
- cassandra: ['2.0', '2.1', '2.2', '3.0', '4.0', 'test-dse']
143143

144144
python:
145145
- 2.7
@@ -182,7 +182,7 @@ build:
182182
pip install --upgrade pip
183183
pip install -U setuptools
184184
185-
pip install git+ssh://[email protected]/riptano/ccm-private.git
185+
pip install $HOME/ccm
186186
187187
if [ -n "$CCM_IS_DSE" ]; then
188188
pip install -r test-datastax-requirements.txt

cassandra/cluster.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
from cassandra.marshal import int64_pack
8181
from cassandra.timestamps import MonotonicTimestampGenerator
8282
from cassandra.compat import Mapping
83-
from cassandra.util import _resolve_contact_points_to_string_map
83+
from cassandra.util import _resolve_contact_points_to_string_map, Version
8484

8585
from cassandra.datastax.insights.reporter import MonitorReporter
8686
from cassandra.datastax.insights.util import version_supports_insights
@@ -3324,7 +3324,7 @@ class ControlConnection(object):
33243324
_SELECT_SCHEMA_PEERS_TEMPLATE = "SELECT peer, host_id, {nt_col_name}, schema_version FROM system.peers"
33253325
_SELECT_SCHEMA_LOCAL = "SELECT schema_version FROM system.local WHERE key='local'"
33263326

3327-
_MINIMUM_NATIVE_ADDRESS_VERSION = "4.0"
3327+
_MINIMUM_NATIVE_ADDRESS_DSE_VERSION = Version("6.0.0")
33283328

33293329
_is_shutdown = False
33303330
_timeout = None
@@ -3884,14 +3884,17 @@ def _peers_query_for_version(self, connection, peers_query_template):
38843884
field named nt_col_name.
38853885
"""
38863886
host_release_version = self._cluster.metadata.get_host(connection.endpoint).release_version
3887-
if host_release_version:
3888-
use_native_address_query = host_release_version >= self._MINIMUM_NATIVE_ADDRESS_VERSION
3889-
if use_native_address_query:
3890-
select_peers_query = peers_query_template.format(nt_col_name="native_transport_address")
3891-
else:
3887+
host_dse_version = self._cluster.metadata.get_host(connection.endpoint).dse_version
3888+
uses_native_address_query = (
3889+
host_dse_version and Version(host_dse_version) >= self._MINIMUM_NATIVE_ADDRESS_DSE_VERSION)
3890+
3891+
if uses_native_address_query:
3892+
select_peers_query = peers_query_template.format(nt_col_name="native_transport_address")
3893+
elif host_release_version:
38923894
select_peers_query = peers_query_template.format(nt_col_name="rpc_address")
38933895
else:
38943896
select_peers_query = self._SELECT_PEERS
3897+
38953898
return select_peers_query
38963899

38973900
def _signal_error(self):

tests/integration/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def _get_dse_version_from_cass(cass_version):
172172
cassandra_version = Version(mcv_string)
173173

174174
CASSANDRA_VERSION = Version(mcv_string) if mcv_string else cassandra_version
175-
CCM_VERSION = mcv_string or cv_string
175+
CCM_VERSION = mcv_string if mcv_string else cv_string
176176

177177
CASSANDRA_IP = os.getenv('CLUSTER_IP', '127.0.0.1')
178178
CASSANDRA_DIR = os.getenv('CASSANDRA_DIR', None)
@@ -454,7 +454,7 @@ def use_cluster(cluster_name, nodes, ipformat=None, start=True, workloads=None,
454454
set_default_cass_ip()
455455

456456
if ccm_options is None and DSE_VERSION:
457-
ccm_options = {"version": DSE_VERSION}
457+
ccm_options = {"version": CCM_VERSION}
458458
elif ccm_options is None:
459459
ccm_options = CCM_KWARGS.copy()
460460

0 commit comments

Comments
 (0)