aerospike 2.9.1 → 2.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ec864bf7ffd197e9badf516904193eb4e6260ac257335facc8e3df058307384
4
- data.tar.gz: '09fe60ac38789318a8739439d99490810129056614a479cafcecce01803c1bff'
3
+ metadata.gz: 61a847f7addabd7b9e7bf77326537e94cc437e99041e664fcd3496ffb7cba843
4
+ data.tar.gz: '033279bbc6e8410e585ace808aabf4ae469a4bd233c1d80f10c2a488894fc5ad'
5
5
  SHA512:
6
- metadata.gz: 0cf87d41d1b4b04121bbf8589974bfa931dea4ec96f17bdf94db737797afb60dc05932f6f56eed0b8f138bb6684a45eb4974c489e878ed5a949209734bf2dae7
7
- data.tar.gz: 65bccc5b55db802415541ae4b5307020477344bb2d771d7cc84b9554192fa97f76874c7538d2c62dbd0025780d91bd91c8dfc1e0143c2bd3753f092d1c391885
6
+ metadata.gz: 5b19a2653c7464e185a0d50faff2ac735b990188eee1021627d6eaab55020130797f14b20eb1f98a79a7cc846962d0d45ba47cd03f8e48ddafba48de6b4ac85f
7
+ data.tar.gz: b550a9058c7c2eed384f1b3635a6f56836aa250248bd48837d72e1ac466a6bb8b06c051122b750e5ccc9f61c7f5736bad12627742e91cf61f215188d1e3dfce8
@@ -4,10 +4,15 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [2.10.0] - 2019-05-10
8
+
9
+ * **New Features**
10
+ * Add support for LB discovery / seeding. Thanks to [@filiptepper](https://github.com/filiptepper)! [[#80](https://github.com/aerospike/aerospike-client-ruby/issues/80)]
11
+
7
12
  ## [2.9.1] - 2019-04-03
8
13
 
9
14
  * **Bug Fixes**
10
- * Query fails if one or more cluster nodes do not have records in the set [[#77](https://github.com/aerospike/aerospike-client-ruby/issue/77)]
15
+ * Query fails if one or more cluster nodes do not have records in the set [[#77](https://github.com/aerospike/aerospike-client-ruby/issues/77)]
11
16
 
12
17
  * **Updates**
13
18
  * Change admin message version to 2 (from 0)
@@ -20,10 +25,10 @@ All notable changes to this project will be documented in this file.
20
25
  * Add INFINITY and WILDCARD values for use in CDT map/list comparators. [AER-5945]
21
26
 
22
27
  * **Bug Fixes**
23
- * Default policies set on Client instance do not get applied [[#74](https://github.com/aerospike/aerospike-client-ruby/issue/74)]
28
+ * Default policies set on Client instance do not get applied [[#74](https://github.com/aerospike/aerospike-client-ruby/issues/74)]
24
29
 
25
30
  * **Updates**
26
- * *BREAKING CHANGE*: Change default for send_key write policy to false [[#73](https://github.com/aerospike/aerospike-client-ruby/issue/73)]
31
+ * *BREAKING CHANGE*: Change default for send_key write policy to false [[#73](https://github.com/aerospike/aerospike-client-ruby/issues/73)]
27
32
  * Support truncate info command argument "lut=now" for servers that require it. [AER-5955]
28
33
 
29
34
  ## [2.8.0] - 2018-08-06
@@ -31,42 +31,53 @@ module Aerospike
31
31
  @cluster_name = cluster_name
32
32
  @tls_options = tls_options
33
33
 
34
- set_aliases(host)
35
- set_address(timeout)
34
+ @aliases = []
35
+
36
+ resolve(host.name).each do |address|
37
+ @aliases += get_hosts(address)
38
+ end
36
39
  end
37
40
 
38
41
  private
39
42
 
40
- def set_aliases(host)
41
- addresses = resolve(host.name)
42
- @aliases = addresses.map { |addr| Host.new(addr, host.port, host.tls_name) }
43
- Aerospike.logger.debug("Node Validator found #{aliases.length} addresses for host #{host}: #{@aliases}")
44
- end
43
+ def get_hosts(address)
44
+ aliases = [get_alias(address, host.port)]
45
+
46
+ begin
47
+ conn = Cluster::CreateConnection.(@cluster, Host.new(address, host.port, host.tls_name))
48
+
49
+ commands = %w[node build features]
50
+ commands << address_command unless is_loopback?(address)
51
+
52
+ info_map = Info.request(conn, *commands)
53
+
54
+ if node_name = info_map['node']
55
+ @name = node_name
56
+
57
+ # Set features
58
+ if features = info_map['features']
59
+ @features = features.split(';').to_set
60
+ end
45
61
 
46
- def set_address(timeout)
47
- @aliases.each do |aliass|
48
- begin
49
- conn = Cluster::CreateConnection.(@cluster, @host)
50
-
51
- info_map = Info.request(conn, 'node', 'build', 'features')
52
- if node_name = info_map['node']
53
- @name = node_name
54
-
55
- # Set features
56
- if features = info_map['features']
57
- @features = features.split(';').to_set
58
- end
59
-
60
- # Check new info protocol support for >= 2.6.6 build
61
- if build_version = info_map['build']
62
- v1, v2, v3 = parse_version_string(build_version)
63
- @use_new_info = v1.to_i > 2 || (v1.to_i == 2 && (v2.to_i > 6 || (v2.to_i == 6 && v3.to_i >= 6)))
64
- end
62
+ # Check new info protocol support for >= 2.6.6 build
63
+ if build_version = info_map['build']
64
+ v1, v2, v3 = parse_version_string(build_version)
65
+ @use_new_info = v1.to_i > 2 || (v1.to_i == 2 && (v2.to_i > 6 || (v2.to_i == 6 && v3.to_i >= 6)))
65
66
  end
66
- ensure
67
- conn.close if conn
68
67
  end
68
+
69
+ unless is_loopback?(address)
70
+ aliases = info_map[address_command].split(',').map { |address| get_alias(*address.split(':')) }
71
+ end
72
+ ensure
73
+ conn.close if conn
69
74
  end
75
+
76
+ aliases.map { |al| Host.new(al[:address], al[:port], host.tls_name) }
77
+ end
78
+
79
+ def get_alias(address, port)
80
+ { address: address, port: port }
70
81
  end
71
82
 
72
83
  def resolve(hostname)
@@ -79,6 +90,15 @@ module Aerospike
79
90
  end
80
91
  end
81
92
 
93
+ def address_command
94
+ @address_command ||= @cluster.tls_enabled? ? 'service-tls-std': 'service-clear-std'
95
+ end
96
+
97
+ def is_loopback?(address)
98
+ info = Addrinfo.ip(address)
99
+ info.ipv4_loopback? || info.ipv6_loopback?
100
+ end
101
+
82
102
  def is_ip?(hostname)
83
103
  !!((hostname =~ Resolv::IPv4::Regex) || (hostname =~ Resolv::IPv6::Regex))
84
104
  end
@@ -91,4 +111,4 @@ module Aerospike
91
111
  raise Aerospike::Exceptions::Parse.new("Invalid build version string in Info: #{version}")
92
112
  end
93
113
  end # class
94
- end #module
114
+ end # module
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Aerospike
3
- VERSION = "2.9.1"
3
+ VERSION = "2.10.0"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aerospike
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.1
4
+ version: 2.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Khosrow Afroozeh
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-04-03 00:00:00.000000000 Z
12
+ date: 2019-05-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: msgpack