cassandra-driver 3.1.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +24 -27
- data/ext/cassandra_murmur3/cassandra_murmur3.c +1 -1
- data/lib/cassandra.rb +1 -1
- data/lib/cassandra/address_resolution.rb +1 -1
- data/lib/cassandra/address_resolution/policies/ec2_multi_region.rb +1 -1
- data/lib/cassandra/address_resolution/policies/none.rb +1 -1
- data/lib/cassandra/aggregate.rb +1 -1
- data/lib/cassandra/argument.rb +1 -1
- data/lib/cassandra/attr_boolean.rb +1 -1
- data/lib/cassandra/auth.rb +1 -1
- data/lib/cassandra/auth/providers.rb +1 -1
- data/lib/cassandra/auth/providers/password.rb +1 -1
- data/lib/cassandra/cassandra_logger.rb +1 -1
- data/lib/cassandra/cluster.rb +1 -1
- data/lib/cassandra/cluster/client.rb +11 -1
- data/lib/cassandra/cluster/connection_pool.rb +1 -1
- data/lib/cassandra/cluster/connector.rb +1 -1
- data/lib/cassandra/cluster/control_connection.rb +21 -8
- data/lib/cassandra/cluster/failed_connection.rb +1 -1
- data/lib/cassandra/cluster/metadata.rb +1 -1
- data/lib/cassandra/cluster/options.rb +1 -1
- data/lib/cassandra/cluster/registry.rb +14 -1
- data/lib/cassandra/cluster/schema.rb +1 -1
- data/lib/cassandra/cluster/schema/cql_type_parser.rb +2 -2
- data/lib/cassandra/cluster/schema/fetchers.rb +1 -1
- data/lib/cassandra/cluster/schema/fqcn_type_parser.rb +1 -1
- data/lib/cassandra/cluster/schema/partitioners.rb +1 -1
- data/lib/cassandra/cluster/schema/partitioners/murmur3.rb +1 -1
- data/lib/cassandra/cluster/schema/partitioners/ordered.rb +1 -1
- data/lib/cassandra/cluster/schema/partitioners/random.rb +1 -1
- data/lib/cassandra/cluster/schema/replication_strategies.rb +1 -1
- data/lib/cassandra/cluster/schema/replication_strategies/network_topology.rb +1 -1
- data/lib/cassandra/cluster/schema/replication_strategies/none.rb +1 -1
- data/lib/cassandra/cluster/schema/replication_strategies/simple.rb +1 -1
- data/lib/cassandra/column.rb +1 -1
- data/lib/cassandra/column_container.rb +1 -1
- data/lib/cassandra/compression.rb +1 -1
- data/lib/cassandra/compression/compressors/lz4.rb +1 -1
- data/lib/cassandra/compression/compressors/snappy.rb +1 -1
- data/lib/cassandra/custom_data.rb +1 -1
- data/lib/cassandra/driver.rb +1 -1
- data/lib/cassandra/errors.rb +1 -1
- data/lib/cassandra/execution/info.rb +1 -1
- data/lib/cassandra/execution/options.rb +1 -1
- data/lib/cassandra/execution/profile.rb +1 -1
- data/lib/cassandra/execution/profile_manager.rb +1 -1
- data/lib/cassandra/execution/trace.rb +1 -1
- data/lib/cassandra/executors.rb +1 -1
- data/lib/cassandra/function.rb +1 -1
- data/lib/cassandra/function_collection.rb +1 -1
- data/lib/cassandra/future.rb +1 -1
- data/lib/cassandra/host.rb +1 -1
- data/lib/cassandra/index.rb +1 -1
- data/lib/cassandra/keyspace.rb +1 -1
- data/lib/cassandra/listener.rb +1 -1
- data/lib/cassandra/load_balancing.rb +1 -1
- data/lib/cassandra/load_balancing/policies.rb +1 -1
- data/lib/cassandra/load_balancing/policies/dc_aware_round_robin.rb +1 -1
- data/lib/cassandra/load_balancing/policies/round_robin.rb +1 -1
- data/lib/cassandra/load_balancing/policies/token_aware.rb +1 -1
- data/lib/cassandra/load_balancing/policies/white_list.rb +1 -1
- data/lib/cassandra/materialized_view.rb +1 -1
- data/lib/cassandra/null_logger.rb +1 -1
- data/lib/cassandra/protocol.rb +1 -1
- data/lib/cassandra/protocol/coder.rb +1 -1
- data/lib/cassandra/protocol/cql_byte_buffer.rb +1 -1
- data/lib/cassandra/protocol/cql_protocol_handler.rb +1 -1
- data/lib/cassandra/protocol/request.rb +1 -1
- data/lib/cassandra/protocol/requests/auth_response_request.rb +1 -1
- data/lib/cassandra/protocol/requests/batch_request.rb +1 -1
- data/lib/cassandra/protocol/requests/credentials_request.rb +1 -1
- data/lib/cassandra/protocol/requests/execute_request.rb +1 -1
- data/lib/cassandra/protocol/requests/options_request.rb +1 -1
- data/lib/cassandra/protocol/requests/prepare_request.rb +1 -1
- data/lib/cassandra/protocol/requests/query_request.rb +1 -1
- data/lib/cassandra/protocol/requests/register_request.rb +1 -1
- data/lib/cassandra/protocol/requests/startup_request.rb +1 -1
- data/lib/cassandra/protocol/requests/void_query_request.rb +1 -1
- data/lib/cassandra/protocol/response.rb +1 -1
- data/lib/cassandra/protocol/responses/already_exists_error_response.rb +1 -1
- data/lib/cassandra/protocol/responses/auth_challenge_response.rb +1 -1
- data/lib/cassandra/protocol/responses/auth_success_response.rb +1 -1
- data/lib/cassandra/protocol/responses/authenticate_response.rb +1 -1
- data/lib/cassandra/protocol/responses/error_response.rb +1 -1
- data/lib/cassandra/protocol/responses/event_response.rb +1 -1
- data/lib/cassandra/protocol/responses/function_failure_error_response.rb +1 -1
- data/lib/cassandra/protocol/responses/prepared_result_response.rb +1 -1
- data/lib/cassandra/protocol/responses/raw_rows_result_response.rb +1 -1
- data/lib/cassandra/protocol/responses/read_failure_error_response.rb +1 -1
- data/lib/cassandra/protocol/responses/read_timeout_error_response.rb +1 -1
- data/lib/cassandra/protocol/responses/ready_response.rb +1 -1
- data/lib/cassandra/protocol/responses/result_response.rb +1 -1
- data/lib/cassandra/protocol/responses/rows_result_response.rb +1 -1
- data/lib/cassandra/protocol/responses/schema_change_event_response.rb +1 -1
- data/lib/cassandra/protocol/responses/schema_change_result_response.rb +1 -1
- data/lib/cassandra/protocol/responses/set_keyspace_result_response.rb +1 -1
- data/lib/cassandra/protocol/responses/status_change_event_response.rb +1 -1
- data/lib/cassandra/protocol/responses/supported_response.rb +1 -1
- data/lib/cassandra/protocol/responses/topology_change_event_response.rb +1 -1
- data/lib/cassandra/protocol/responses/unavailable_error_response.rb +1 -1
- data/lib/cassandra/protocol/responses/unprepared_error_response.rb +1 -1
- data/lib/cassandra/protocol/responses/void_result_response.rb +1 -1
- data/lib/cassandra/protocol/responses/write_failure_error_response.rb +1 -1
- data/lib/cassandra/protocol/responses/write_timeout_error_response.rb +1 -1
- data/lib/cassandra/protocol/v1.rb +1 -1
- data/lib/cassandra/protocol/v3.rb +1 -1
- data/lib/cassandra/protocol/v4.rb +1 -1
- data/lib/cassandra/reconnection.rb +1 -1
- data/lib/cassandra/reconnection/policies.rb +1 -1
- data/lib/cassandra/reconnection/policies/constant.rb +1 -1
- data/lib/cassandra/reconnection/policies/exponential.rb +1 -1
- data/lib/cassandra/result.rb +1 -1
- data/lib/cassandra/retry.rb +1 -1
- data/lib/cassandra/retry/policies.rb +1 -1
- data/lib/cassandra/retry/policies/default.rb +1 -1
- data/lib/cassandra/retry/policies/downgrading_consistency.rb +1 -1
- data/lib/cassandra/retry/policies/fallthrough.rb +1 -1
- data/lib/cassandra/session.rb +1 -1
- data/lib/cassandra/statement.rb +1 -1
- data/lib/cassandra/statements.rb +1 -1
- data/lib/cassandra/statements/batch.rb +1 -1
- data/lib/cassandra/statements/bound.rb +1 -1
- data/lib/cassandra/statements/prepared.rb +1 -1
- data/lib/cassandra/statements/simple.rb +1 -1
- data/lib/cassandra/statements/void.rb +1 -1
- data/lib/cassandra/table.rb +1 -1
- data/lib/cassandra/time.rb +1 -1
- data/lib/cassandra/time_uuid.rb +1 -1
- data/lib/cassandra/timestamp_generator.rb +1 -1
- data/lib/cassandra/timestamp_generator/simple.rb +1 -1
- data/lib/cassandra/timestamp_generator/ticking_on_duplicate.rb +1 -1
- data/lib/cassandra/trigger.rb +1 -1
- data/lib/cassandra/tuple.rb +1 -1
- data/lib/cassandra/types.rb +1 -1
- data/lib/cassandra/udt.rb +1 -1
- data/lib/cassandra/util.rb +2 -3
- data/lib/cassandra/uuid.rb +1 -1
- data/lib/cassandra/uuid/generator.rb +1 -1
- data/lib/cassandra/version.rb +2 -2
- data/lib/datastax/cassandra.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDY1NzlkZTRjOTYwNzU1ODA4NjQ5OGM4M2IwMmMzODlhMzAyMDIzOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZWMzZjcxOTQyN2Y3NjdlMjg5ZDJhYmM1NzVkOWRlMzJmOTA0MTcwZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODNiOWE0NTg5YTVjZGUzZDI1Y2EyZTkxNDBhMGUyM2M2YTQ4MzliNWM1MDM0
|
10
|
+
YjMxMjU2YjRlMjA5ODU3MjRjZDY0ZDgyZWI5YjE5ZTA2OTQ0ZmQ3MjEyMmY0
|
11
|
+
NDc3ZjJiMjZlMGI5MTk2N2I1NWJiNDA3MWIxODRlZGU1MjdlNWE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWYzMDU0NmQ3OTU4NDJiZTI4M2Y1ODNhMTQyMmU2NjUxNTU0YjA4M2Q1ZTZl
|
14
|
+
ZDNlYjg5NWY3NDBiMDAzMzE4ZWVlMTg0YTUyNzE0NDNlYzUxNGZiNDM1MTQ1
|
15
|
+
NGQ0ZmZjMGIwZGEyZjk4OGZmNmE4ZTNkNjFiOWIyYTMyMDE1NzU=
|
data/README.md
CHANGED
@@ -9,11 +9,14 @@ version [here](http://docs.datastax.com/en/developer/ruby-driver/latest).*
|
|
9
9
|
A Ruby client driver for Apache Cassandra. This driver works exclusively with
|
10
10
|
the Cassandra Query Language version 3 (CQL3) and Cassandra's native protocol.
|
11
11
|
|
12
|
+
Use the [Ruby DSE driver](https://github.com/datastax/ruby-dse-driver.git) for
|
13
|
+
better compatibility and support for DataStax Enterprise.
|
14
|
+
|
12
15
|
- Code: https://github.com/datastax/ruby-driver
|
13
16
|
- Docs: http://docs.datastax.com/en/developer/ruby-driver
|
14
17
|
- Jira: https://datastax-oss.atlassian.net/browse/RUBY
|
15
18
|
- Mailing List: https://groups.google.com/a/lists.datastax.com/forum/#!forum/ruby-driver-user
|
16
|
-
-
|
19
|
+
- Slack: `#datastax-drivers` channel at https://academy.datastax.com/slack
|
17
20
|
- Twitter: Follow the latest news about DataStax Drivers - [@stamhankar999](http://twitter.com/stamhankar999), [@avalanche123](http://twitter.com/avalanche123), [@al3xandru](https://twitter.com/al3xandru)
|
18
21
|
|
19
22
|
This driver is based on [the cql-rb gem](https://github.com/iconara/cql-rb) by [Theo Hultberg](https://github.com/iconara) and we added support for:
|
@@ -33,14 +36,13 @@ This driver is based on [the cql-rb gem](https://github.com/iconara/cql-rb) by [
|
|
33
36
|
|
34
37
|
This driver works exclusively with the Cassandra Query Language v3 (CQL3) and Cassandra's native protocol. The current version works with:
|
35
38
|
|
36
|
-
* Apache Cassandra versions
|
37
|
-
* DataStax Enterprise 4.
|
38
|
-
* Ruby (MRI) 2.2, 2.3
|
39
|
-
* JRuby 1.7
|
39
|
+
* Apache Cassandra versions 2.1, 2.2, and 3.x
|
40
|
+
* DataStax Enterprise 4.8 and above. However, the [Ruby DSE driver](https://github.com/datastax/ruby-dse-driver.git) provides more features and is recommended for use with DataStax Enterprise.
|
41
|
+
* Ruby (MRI) 2.2, 2.3, 2.4
|
42
|
+
* JRuby 1.7, 9k
|
40
43
|
|
41
|
-
__Note__:
|
42
|
-
|
43
|
-
and is likely to break in the release following 3.0.
|
44
|
+
__Note__: Rubinius is not supported. MRI 2.0, and 2.1 are not officially supported, but they should work. MRI 1.9.3 is deprecated
|
45
|
+
and may break in any release after 3.0.
|
44
46
|
|
45
47
|
## Feedback Requested
|
46
48
|
|
@@ -98,9 +100,18 @@ __Note__: if you want to use compression you should also install [snappy](http:/
|
|
98
100
|
|
99
101
|
Some of the new features added to the driver have unfortunately led to changes in the original cql-rb API.
|
100
102
|
In the examples directory, you can find [an example of how to wrap the ruby driver to achieve almost complete
|
101
|
-
interface parity with cql-rb](https://github.com/datastax/ruby-driver/blob/v3.
|
103
|
+
interface parity with cql-rb](https://github.com/datastax/ruby-driver/blob/v3.2.0/examples/cql-rb-wrapper.rb)
|
102
104
|
to assist you with gradual upgrade.
|
103
105
|
|
106
|
+
If you are upgrading to DataStax Enterprise, use the [Ruby DSE driver](https://github.com/datastax/ruby-dse-driver.git)
|
107
|
+
for more features and better compatibility.
|
108
|
+
|
109
|
+
## What's new in v3.2
|
110
|
+
This minor release adds support for MRI 2.4.x and also contains a few miscellaneous defect fixes.
|
111
|
+
|
112
|
+
See the [changelog](https://github.com/datastax/ruby-driver/blob/v3.2.0/CHANGELOG.md) for more information on all
|
113
|
+
changes in this version and past versions.
|
114
|
+
|
104
115
|
## What's new in v3.1
|
105
116
|
|
106
117
|
This minor release introduces features and fixes around resiliency, schema metadata, usability, and performance. One
|
@@ -110,9 +121,6 @@ Execution profiles allow you to group various execution options into a 'profile'
|
|
110
121
|
profile at execution time. Get the scoop
|
111
122
|
[here](http://docs.datastax.com/en/developer/ruby-driver/3.1/features/basics/execution_profiles).
|
112
123
|
|
113
|
-
See the [changelog](https://github.com/datastax/ruby-driver/blob/v3.1.0/CHANGELOG.md) for more information on all
|
114
|
-
changes in this version and past versions.
|
115
|
-
|
116
124
|
## What's new in v3.0
|
117
125
|
|
118
126
|
### Features:
|
@@ -159,16 +167,6 @@ batch.add(query, arguments: {p1: 'val1'})
|
|
159
167
|
Specify a positive value (or nil for unlimited) for `max_remote_hosts_to_use` when initializing the policy to allow remote node use.
|
160
168
|
* Unspecified variables in statements previously resulted in an exception. Now they are essentially ignored or treated as null.
|
161
169
|
|
162
|
-
### Bug Fixes:
|
163
|
-
|
164
|
-
* [[RUBY-120](https://datastax-oss.atlassian.net/browse/RUBY-120)] Tuples and UDTs can be used in sets and hash keys.
|
165
|
-
* [[RUBY-143](https://datastax-oss.atlassian.net/browse/RUBY-143)] Retry querying system table for metadata of new hosts when prior attempts fail, ultimately enabling use of new hosts.
|
166
|
-
* [[RUBY-150](https://datastax-oss.atlassian.net/browse/RUBY-150)] Fixed a protocol decoding error that occurred when multiple messages are available in a stream.
|
167
|
-
* [[RUBY-151](https://datastax-oss.atlassian.net/browse/RUBY-151)] Decode incomplete UDTs properly.
|
168
|
-
* [[RUBY-155](https://datastax-oss.atlassian.net/browse/RUBY-155)] Request timeout timer should not include request queuing time.
|
169
|
-
* [[RUBY-161](https://datastax-oss.atlassian.net/browse/RUBY-161)] Protocol version negotiation in mixed version clusters should not fall back to v1 unless it is truly warranted.
|
170
|
-
* [[RUBY-214](https://datastax-oss.atlassian.net/browse/RUBY-214)] Ensure client timestamps have microsecond precision in JRuby. Previously, some row updates would get lost in high transaction environments.
|
171
|
-
|
172
170
|
## Code examples
|
173
171
|
|
174
172
|
The DataStax Ruby Driver uses the awesome [Cucumber Framework](http://cukes.info/) for
|
@@ -179,7 +177,7 @@ examples in the `features/` directory.
|
|
179
177
|
## Running tests
|
180
178
|
|
181
179
|
If you don't feel like reading through the following instructions on how to run
|
182
|
-
ruby-driver tests, feel free to [check out .travis.yml for the entire build code](https://github.com/datastax/ruby-driver/blob/v3.
|
180
|
+
ruby-driver tests, feel free to [check out .travis.yml for the entire build code](https://github.com/datastax/ruby-driver/blob/v3.2.0/.travis.yml).
|
183
181
|
|
184
182
|
* Check out the driver codebase and install test dependencies:
|
185
183
|
|
@@ -197,13 +195,13 @@ bundle install --without docs
|
|
197
195
|
CASSANDRA_VERSION=3.1.1 bundle exec cucumber # runs end-to-end tests (or bundle exec rake cucumber)
|
198
196
|
CASSANDRA_VERSION=3.0.0 bundle exec rspec # runs unit tests (or bundle exec rake rspec)
|
199
197
|
CASSANDRA_VERSION=2.1.12 bundle exec rake integration # run integration tests
|
200
|
-
CASSANDRA_VERSION=2.
|
198
|
+
CASSANDRA_VERSION=2.1.12 bundle exec rake test # run both as well as integration tests
|
201
199
|
```
|
202
200
|
|
203
201
|
## Changelog & versioning
|
204
202
|
|
205
203
|
Check out the [releases on GitHub](https://github.com/datastax/ruby-driver/releases) and
|
206
|
-
[changelog](https://github.com/datastax/ruby-driver/blob/v3.
|
204
|
+
[changelog](https://github.com/datastax/ruby-driver/blob/v3.2.0/CHANGELOG.md). Version
|
207
205
|
numbering follows the [semantic versioning](http://semver.org/) scheme.
|
208
206
|
|
209
207
|
Private and experimental APIs, defined as whatever is not in the
|
@@ -223,7 +221,6 @@ the release.
|
|
223
221
|
|
224
222
|
* Specifying a `protocol_version` option of 1 or 2 in cluster options will fail with a
|
225
223
|
`NoHostsAvailable` error rather than a `ProtocolError` against Cassandra node versions 3.0-3.4.
|
226
|
-
* JRuby 1.6 is not officially supported, although 1.6.8 should work.
|
227
224
|
* Because the driver reactor is using `IO.select`, the maximum number of tcp connections allowed is 1024.
|
228
225
|
* Because the driver uses `IO#write_nonblock`, Windows is not supported.
|
229
226
|
|
@@ -245,7 +242,7 @@ Driver for Apache Cassandra will continue on this project, while
|
|
245
242
|
|
246
243
|
## Copyright
|
247
244
|
|
248
|
-
Copyright 2013-
|
245
|
+
Copyright 2013-2017 DataStax, Inc.
|
249
246
|
|
250
247
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
|
251
248
|
except in compliance with the License. You may obtain a copy of the License at
|
data/lib/cassandra.rb
CHANGED
data/lib/cassandra/aggregate.rb
CHANGED
data/lib/cassandra/argument.rb
CHANGED
data/lib/cassandra/auth.rb
CHANGED
data/lib/cassandra/cluster.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
#--
|
4
|
-
# Copyright 2013-
|
4
|
+
# Copyright 2013-2017 DataStax, Inc.
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
@@ -106,6 +106,16 @@ module Cassandra
|
|
106
106
|
|
107
107
|
failed_connections = connections.reject(&:connected?)
|
108
108
|
|
109
|
+
# convert Cassandra::Protocol::CqlProtocolHandler to something with a real host
|
110
|
+
failed_connections.map! do |c|
|
111
|
+
if c.host.is_a?(String)
|
112
|
+
host = @registry.each_host.detect { |h| h.ip.to_s == c.host } || raise("Unable to find host #{c.host}")
|
113
|
+
FailedConnection.new(c.error, host)
|
114
|
+
else
|
115
|
+
c
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
109
119
|
if failed_connections.size == connections.size
|
110
120
|
errors = {}
|
111
121
|
connections.each {|c| errors[c.host] = c.error unless c.error.nil?}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
#--
|
4
|
-
# Copyright 2013-
|
4
|
+
# Copyright 2013-2017 DataStax, Inc.
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
@@ -225,12 +225,11 @@ module Cassandra
|
|
225
225
|
else
|
226
226
|
case event.change
|
227
227
|
when 'UP'
|
228
|
-
address = event.address
|
229
|
-
|
228
|
+
address = @address_resolver.resolve(event.address)
|
230
229
|
if @registry.has_host?(address)
|
231
230
|
@registry.host_up(address)
|
232
231
|
else
|
233
|
-
refresh_host_async_maybe_retry(address)
|
232
|
+
refresh_host_async_maybe_retry(event.address)
|
234
233
|
refresh_schema_async_wrapper
|
235
234
|
end
|
236
235
|
when 'DOWN'
|
@@ -238,14 +237,14 @@ module Cassandra
|
|
238
237
|
# logic in connector.rb to call host_down when all connections to a node are lost,
|
239
238
|
# so that covers the requirement.
|
240
239
|
when 'NEW_NODE'
|
241
|
-
address = event.address
|
240
|
+
address = @address_resolver.resolve(event.address)
|
242
241
|
|
243
242
|
unless @registry.has_host?(address)
|
244
|
-
refresh_host_async_maybe_retry(address)
|
243
|
+
refresh_host_async_maybe_retry(event.address)
|
245
244
|
refresh_schema_async_wrapper
|
246
245
|
end
|
247
246
|
when 'REMOVED_NODE'
|
248
|
-
@registry.host_lost(event.address)
|
247
|
+
@registry.host_lost(@address_resolver.resolve(event.address))
|
249
248
|
refresh_schema_async_wrapper
|
250
249
|
end
|
251
250
|
end
|
@@ -480,7 +479,7 @@ module Cassandra
|
|
480
479
|
raise Errors::InternalError, "Unable to fetch connected host's metadata" if local.empty?
|
481
480
|
|
482
481
|
data = local.first
|
483
|
-
@registry.host_found(IPAddr.new(connection.host), data)
|
482
|
+
@registry.host_found(@address_resolver.resolve(IPAddr.new(connection.host)), data)
|
484
483
|
@metadata.update(data)
|
485
484
|
|
486
485
|
@logger.info("Completed refreshing connected host's metadata")
|
@@ -516,6 +515,9 @@ module Cassandra
|
|
516
515
|
end
|
517
516
|
end
|
518
517
|
|
518
|
+
# @param address [IPAddr] address node address, as reported from a C* event. Thus it is *not* resolved
|
519
|
+
# relative to the client, but rather is the address that other nodes would use to communicate with
|
520
|
+
# this node.
|
519
521
|
def refresh_host_async_maybe_retry(address)
|
520
522
|
synchronize do
|
521
523
|
return Ione::Future.resolved if @refreshing_hosts || @refreshing_host[address]
|
@@ -539,6 +541,9 @@ module Cassandra
|
|
539
541
|
end
|
540
542
|
end
|
541
543
|
|
544
|
+
# @param address [IPAddr] address node address, as reported from a C* event. Thus it is *not* resolved
|
545
|
+
# relative to the client, but rather is the address that other nodes would use to communicate with
|
546
|
+
# this node.
|
542
547
|
def refresh_host_async_retry(address, error, schedule)
|
543
548
|
timeout = schedule.next
|
544
549
|
@logger.info("Failed to refresh host #{address} (#{error.class.name}: " \
|
@@ -560,6 +565,9 @@ module Cassandra
|
|
560
565
|
end
|
561
566
|
end
|
562
567
|
|
568
|
+
# @param address [IPAddr] address node address, as reported from a C* event. Thus it is *not* resolved
|
569
|
+
# relative to the client, but rather is the address that other nodes would use to communicate with
|
570
|
+
# this node.
|
563
571
|
def refresh_host_async(address)
|
564
572
|
connection = @connection
|
565
573
|
return Ione::Future.failed(Errors::ClientError.new('Not connected')) if connection.nil?
|
@@ -581,6 +589,11 @@ module Cassandra
|
|
581
589
|
raise Errors::InternalError, "Unable to find host metadata: #{ip}" if rows.empty?
|
582
590
|
|
583
591
|
@logger.info("Completed refreshing host metadata: #{ip}")
|
592
|
+
address = if ip == connection.host
|
593
|
+
@address_resolver.resolve(address)
|
594
|
+
else
|
595
|
+
peer_ip(rows.first, connection.host)
|
596
|
+
end
|
584
597
|
@registry.host_found(address, rows.first)
|
585
598
|
|
586
599
|
self
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
#--
|
4
|
-
# Copyright 2013-
|
4
|
+
# Copyright 2013-2017 DataStax, Inc.
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
@@ -60,14 +60,18 @@ module Cassandra
|
|
60
60
|
end
|
61
61
|
alias hosts each_host
|
62
62
|
|
63
|
+
# @param address [IPAddr] resolved address of the node
|
63
64
|
def host(address)
|
64
65
|
@hosts[address.to_s]
|
65
66
|
end
|
66
67
|
|
68
|
+
# @param address [IPAddr] resolved address of the node
|
67
69
|
def has_host?(address)
|
68
70
|
@hosts.key?(address.to_s)
|
69
71
|
end
|
70
72
|
|
73
|
+
# @param address [IPAddr] resolved address of the node
|
74
|
+
# @param data [Hash<String, String>] attributes of the host, typically a row from system.local or system.peers.
|
71
75
|
def host_found(address, data = {})
|
72
76
|
ip = address.to_s
|
73
77
|
host = @hosts[ip]
|
@@ -108,6 +112,7 @@ module Cassandra
|
|
108
112
|
self
|
109
113
|
end
|
110
114
|
|
115
|
+
# @param address [IPAddr] resolved address of the node
|
111
116
|
def host_down(address)
|
112
117
|
ip = address.to_s
|
113
118
|
host = @hosts[ip]
|
@@ -125,6 +130,7 @@ module Cassandra
|
|
125
130
|
self
|
126
131
|
end
|
127
132
|
|
133
|
+
# @param address [IPAddr] resolved address of the node
|
128
134
|
def host_up(address)
|
129
135
|
ip = address.to_s
|
130
136
|
host = @hosts[ip]
|
@@ -142,6 +148,7 @@ module Cassandra
|
|
142
148
|
self
|
143
149
|
end
|
144
150
|
|
151
|
+
# @param address [IPAddr] resolved address of the node
|
145
152
|
def host_lost(address)
|
146
153
|
ip = address.to_s
|
147
154
|
host = nil
|
@@ -161,6 +168,8 @@ module Cassandra
|
|
161
168
|
|
162
169
|
private
|
163
170
|
|
171
|
+
# @param ip [String] resolved address of the node
|
172
|
+
# @param data [Hash<String, String>] attributes of the host, typically a row from system.local or system.peers.
|
164
173
|
def create_host(ip, data)
|
165
174
|
Host.new(ip,
|
166
175
|
data['host_id'],
|
@@ -173,6 +182,7 @@ module Cassandra
|
|
173
182
|
data['listen_address'])
|
174
183
|
end
|
175
184
|
|
185
|
+
# @param ip [Host] host that is found to be up.
|
176
186
|
def toggle_up(host)
|
177
187
|
host = Host.new(host.ip,
|
178
188
|
host.id,
|
@@ -194,6 +204,7 @@ module Cassandra
|
|
194
204
|
host
|
195
205
|
end
|
196
206
|
|
207
|
+
# @param ip [Host] host that is found to be down.
|
197
208
|
def toggle_down(host)
|
198
209
|
host = Host.new(host.ip,
|
199
210
|
host.id,
|
@@ -215,6 +226,7 @@ module Cassandra
|
|
215
226
|
host
|
216
227
|
end
|
217
228
|
|
229
|
+
# @param ip [Host] host that is lost.
|
218
230
|
def notify_lost(host)
|
219
231
|
if host.up?
|
220
232
|
@logger.debug("Host #{host.ip} is down and lost")
|
@@ -251,6 +263,7 @@ module Cassandra
|
|
251
263
|
end
|
252
264
|
end
|
253
265
|
|
266
|
+
# @param ip [Host] host that is found.
|
254
267
|
def notify_found(host)
|
255
268
|
@logger.debug("Host #{host.ip} is found and up")
|
256
269
|
@listeners.each do |listener|
|