aerospike 2.12.0 → 2.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/aerospike.rb +3 -4
- data/lib/aerospike/aerospike_exception.rb +7 -1
- data/lib/aerospike/atomic/atomic.rb +1 -1
- data/lib/aerospike/bin.rb +1 -1
- data/lib/aerospike/cdt/list_operation.rb +1 -1
- data/lib/aerospike/cdt/map_operation.rb +1 -1
- data/lib/aerospike/cdt/map_order.rb +1 -1
- data/lib/aerospike/cdt/map_policy.rb +1 -1
- data/lib/aerospike/cdt/map_return_type.rb +1 -1
- data/lib/aerospike/cdt/map_write_mode.rb +1 -1
- data/lib/aerospike/client.rb +9 -9
- data/lib/aerospike/cluster.rb +92 -17
- data/lib/aerospike/cluster/partition.rb +1 -1
- data/lib/aerospike/cluster/partition_parser.rb +169 -0
- data/lib/aerospike/command/admin_command.rb +1 -1
- data/lib/aerospike/command/batch_direct_command.rb +1 -1
- data/lib/aerospike/command/batch_direct_exists_command.rb +1 -1
- data/lib/aerospike/command/batch_direct_node.rb +3 -3
- data/lib/aerospike/command/batch_index_node.rb +2 -2
- data/lib/aerospike/command/batch_item.rb +1 -1
- data/lib/aerospike/command/command.rb +21 -4
- data/lib/aerospike/command/delete_command.rb +5 -1
- data/lib/aerospike/command/execute_command.rb +1 -1
- data/lib/aerospike/command/exists_command.rb +5 -1
- data/lib/aerospike/command/field_type.rb +2 -1
- data/lib/aerospike/command/multi_command.rb +5 -1
- data/lib/aerospike/command/operate_command.rb +6 -1
- data/lib/aerospike/command/read_command.rb +5 -1
- data/lib/aerospike/command/read_header_command.rb +5 -1
- data/lib/aerospike/command/roles.rb +1 -1
- data/lib/aerospike/command/single_command.rb +9 -3
- data/lib/aerospike/command/touch_command.rb +5 -1
- data/lib/aerospike/command/unsupported_particle_type_validator.rb +1 -1
- data/lib/aerospike/command/write_command.rb +5 -1
- data/lib/aerospike/connection/create.rb +1 -1
- data/lib/aerospike/features.rb +1 -1
- data/lib/aerospike/geo_json.rb +1 -1
- data/lib/aerospike/host.rb +1 -1
- data/lib/aerospike/info.rb +1 -1
- data/lib/aerospike/key.rb +1 -1
- data/lib/aerospike/language.rb +1 -1
- data/lib/aerospike/node.rb +3 -6
- data/lib/aerospike/node/refresh/partitions.rb +6 -15
- data/lib/aerospike/node_validator.rb +4 -19
- data/lib/aerospike/operation.rb +1 -1
- data/lib/aerospike/policy/admin_policy.rb +1 -1
- data/lib/aerospike/policy/batch_policy.rb +1 -1
- data/lib/aerospike/policy/client_policy.rb +1 -1
- data/lib/aerospike/policy/commit_level.rb +1 -1
- data/lib/aerospike/policy/consistency_level.rb +1 -1
- data/lib/aerospike/policy/generation_policy.rb +1 -1
- data/lib/aerospike/policy/operate_policy.rb +1 -1
- data/lib/aerospike/policy/policy.rb +12 -3
- data/lib/aerospike/policy/priority.rb +1 -1
- data/lib/aerospike/policy/query_policy.rb +8 -1
- data/lib/aerospike/policy/record_bin_multiplicity.rb +1 -1
- data/lib/aerospike/policy/record_exists_action.rb +1 -1
- data/lib/aerospike/policy/replica.rb +38 -0
- data/lib/aerospike/policy/scan_policy.rb +8 -1
- data/lib/aerospike/policy/write_policy.rb +1 -1
- data/lib/aerospike/query/filter.rb +1 -1
- data/lib/aerospike/query/query_command.rb +10 -1
- data/lib/aerospike/query/recordset.rb +1 -1
- data/lib/aerospike/query/scan_command.rb +1 -1
- data/lib/aerospike/query/statement.rb +1 -1
- data/lib/aerospike/query/stream_command.rb +1 -1
- data/lib/aerospike/record.rb +1 -1
- data/lib/aerospike/result_code.rb +1 -1
- data/lib/aerospike/socket/base.rb +1 -1
- data/lib/aerospike/task/execute_task.rb +1 -1
- data/lib/aerospike/task/index_task.rb +1 -1
- data/lib/aerospike/task/task.rb +1 -1
- data/lib/aerospike/task/udf_register_task.rb +1 -1
- data/lib/aerospike/task/udf_remove_task.rb +1 -1
- data/lib/aerospike/ttl.rb +1 -1
- data/lib/aerospike/udf.rb +1 -1
- data/lib/aerospike/user_role.rb +1 -1
- data/lib/aerospike/utils/buffer.rb +1 -1
- data/lib/aerospike/utils/packer.rb +1 -1
- data/lib/aerospike/utils/pool.rb +1 -1
- data/lib/aerospike/utils/unpacker.rb +1 -1
- data/lib/aerospike/value/particle_type.rb +1 -1
- data/lib/aerospike/value/value.rb +1 -1
- data/lib/aerospike/version.rb +1 -1
- metadata +6 -6
- data/lib/aerospike/cluster/partition_tokenizer_new.rb +0 -130
- data/lib/aerospike/cluster/partition_tokenizer_old.rb +0 -135
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2014-
|
1
|
+
# Copyright 2014-2020 Aerospike, Inc.
|
2
2
|
#
|
3
3
|
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
4
4
|
# license agreements.
|
@@ -24,8 +24,8 @@ module Aerospike
|
|
24
24
|
attr_accessor :node
|
25
25
|
attr_accessor :batch_namespaces
|
26
26
|
|
27
|
-
def self.generate_list(cluster, keys)
|
28
|
-
keys.group_by { |key| cluster.get_node_for_key(key) }
|
27
|
+
def self.generate_list(cluster, replica_policy, keys)
|
28
|
+
keys.group_by { |key| cluster.get_node_for_key(replica_policy, key) }
|
29
29
|
.map { |node, keys_for_node| BatchDirectNode.new(node, keys_for_node) }
|
30
30
|
end
|
31
31
|
|
@@ -22,9 +22,9 @@ module Aerospike
|
|
22
22
|
attr_accessor :node
|
23
23
|
attr_accessor :keys_by_idx
|
24
24
|
|
25
|
-
def self.generate_list(cluster, keys)
|
25
|
+
def self.generate_list(cluster, replica_policy, keys)
|
26
26
|
keys.each_with_index
|
27
|
-
.group_by { |key, _| cluster.get_node_for_key(key) }
|
27
|
+
.group_by { |key, _| cluster.get_node_for_key(replica_policy, key) }
|
28
28
|
.map { |node, keys_with_idx| BatchIndexNode.new(node, keys_with_idx) }
|
29
29
|
end
|
30
30
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2014-
|
1
|
+
# Copyright 2014-2020 Aerospike, Inc.
|
2
2
|
#
|
3
3
|
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
4
4
|
# license agreements.
|
@@ -77,12 +77,15 @@ module Aerospike
|
|
77
77
|
|
78
78
|
class Command #:nodoc:
|
79
79
|
|
80
|
-
def initialize(node)
|
80
|
+
def initialize(node=nil)
|
81
81
|
@data_offset = 0
|
82
82
|
@data_buffer = nil
|
83
83
|
|
84
84
|
@node = node
|
85
85
|
|
86
|
+
# will add before use
|
87
|
+
@sequence = Atomic.new(-1)
|
88
|
+
|
86
89
|
self
|
87
90
|
end
|
88
91
|
|
@@ -324,6 +327,11 @@ module Aerospike
|
|
324
327
|
field_count += 1
|
325
328
|
end
|
326
329
|
|
330
|
+
if policy.records_per_second > 0
|
331
|
+
@data_offset += 4 + FIELD_HEADER_SIZE
|
332
|
+
field_count += 1
|
333
|
+
end
|
334
|
+
|
327
335
|
predexp_size = estimate_predexp(policy.predexp)
|
328
336
|
field_count += 1 if predexp_size > 0
|
329
337
|
|
@@ -363,6 +371,10 @@ module Aerospike
|
|
363
371
|
write_field_string(set_name, Aerospike::FieldType::TABLE)
|
364
372
|
end
|
365
373
|
|
374
|
+
if policy.records_per_second > 0
|
375
|
+
write_field_int(policy.records_per_second, Aerospike::FieldType::RECORDS_PER_SECOND)
|
376
|
+
end
|
377
|
+
|
366
378
|
write_predexp(policy.predexp, predexp_size)
|
367
379
|
|
368
380
|
write_field_header(2, Aerospike::FieldType::SCAN_OPTIONS)
|
@@ -410,6 +422,7 @@ module Aerospike
|
|
410
422
|
break if @policy.timeout > 0 && Time.now > limit
|
411
423
|
|
412
424
|
begin
|
425
|
+
@node = get_node
|
413
426
|
@conn = @node.get_connection(@policy.timeout)
|
414
427
|
rescue => e
|
415
428
|
# Socket connection error has occurred. Decrease health and retry.
|
@@ -746,15 +759,19 @@ module Aerospike
|
|
746
759
|
@data_offset += len
|
747
760
|
end
|
748
761
|
|
762
|
+
def write_field_int(i, ftype)
|
763
|
+
@data_buffer.write_int32(i, @data_offset+FIELD_HEADER_SIZE)
|
764
|
+
write_field_header(4, ftype)
|
765
|
+
@data_offset += 4
|
766
|
+
end
|
767
|
+
|
749
768
|
def write_field_bytes(bytes, ftype)
|
750
769
|
@data_buffer.write_binary(bytes, @data_offset+FIELD_HEADER_SIZE)
|
751
|
-
|
752
770
|
write_field_header(bytes.bytesize, ftype)
|
753
771
|
@data_offset += bytes.bytesize
|
754
772
|
end
|
755
773
|
|
756
774
|
def write_field_header(size, ftype)
|
757
|
-
# Buffer.Int32ToBytes(size+1), @data_buffer, @data_offset
|
758
775
|
@data_buffer.write_int32(size+1, @data_offset)
|
759
776
|
@data_offset += 4
|
760
777
|
@data_buffer.write_byte(ftype, @data_offset)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
# Copyright 2014-
|
2
|
+
# Copyright 2014-2020 Aerospike, Inc.
|
3
3
|
#
|
4
4
|
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
5
5
|
# license agreements.
|
@@ -33,6 +33,10 @@ module Aerospike
|
|
33
33
|
self
|
34
34
|
end
|
35
35
|
|
36
|
+
def get_node
|
37
|
+
@cluster.master_node(@partition)
|
38
|
+
end
|
39
|
+
|
36
40
|
def write_buffer
|
37
41
|
set_delete(@policy, @key)
|
38
42
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
# Copyright 2014-
|
2
|
+
# Copyright 2014-2020 Aerospike, Inc.
|
3
3
|
#
|
4
4
|
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
5
5
|
# license agreements.
|
@@ -33,6 +33,10 @@ module Aerospike
|
|
33
33
|
self
|
34
34
|
end
|
35
35
|
|
36
|
+
def get_node
|
37
|
+
@cluster.read_node(@partition, @policy.replica, @sequence)
|
38
|
+
end
|
39
|
+
|
36
40
|
def write_buffer
|
37
41
|
set_exists(@policy, @key)
|
38
42
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2014-
|
1
|
+
# Copyright 2014-2020 Aerospike, Inc.
|
2
2
|
#
|
3
3
|
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
4
4
|
# license agreements.
|
@@ -31,6 +31,7 @@ module Aerospike
|
|
31
31
|
TRAN_ID = 7 # user supplied transaction id, which is simply passed back
|
32
32
|
SCAN_OPTIONS = 8
|
33
33
|
SCAN_TIMEOUT = 9
|
34
|
+
RECORDS_PER_SECOND = 10
|
34
35
|
INDEX_NAME = 21
|
35
36
|
INDEX_RANGE = 22
|
36
37
|
INDEX_FILTER = 23
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2014-
|
1
|
+
# Copyright 2014-2020 Aerospike, Inc.
|
2
2
|
#
|
3
3
|
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
4
4
|
# license agreements.
|
@@ -32,6 +32,10 @@ module Aerospike
|
|
32
32
|
self
|
33
33
|
end
|
34
34
|
|
35
|
+
def get_node
|
36
|
+
@node
|
37
|
+
end
|
38
|
+
|
35
39
|
def parse_result
|
36
40
|
# Read socket into receive buffer one record at a time. Do not read entire receive size
|
37
41
|
# because the receive buffer would be too big.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
# Copyright 2014-
|
2
|
+
# Copyright 2014-2020 Aerospike, Inc.
|
3
3
|
#
|
4
4
|
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
5
5
|
# license agreements.
|
@@ -28,6 +28,11 @@ module Aerospike
|
|
28
28
|
@operations = operations
|
29
29
|
end
|
30
30
|
|
31
|
+
def get_node
|
32
|
+
@cluster.master_node(@partition)
|
33
|
+
end
|
34
|
+
|
35
|
+
|
31
36
|
def write_bins
|
32
37
|
@operations.select{|op| op.op_type == Aerospike::Operation::WRITE}.map(&:bin).compact
|
33
38
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2014-
|
3
|
+
# Copyright 2014-2020 Aerospike, Inc.
|
4
4
|
#
|
5
5
|
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
6
6
|
# license agreements.
|
@@ -39,6 +39,10 @@ module Aerospike
|
|
39
39
|
self
|
40
40
|
end
|
41
41
|
|
42
|
+
def get_node
|
43
|
+
@cluster.read_node(@partition, @policy.replica, @sequence)
|
44
|
+
end
|
45
|
+
|
42
46
|
def write_buffer
|
43
47
|
set_read(@policy, @key, @bin_names)
|
44
48
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
# Copyright 2014-
|
2
|
+
# Copyright 2014-2020 Aerospike, Inc.
|
3
3
|
#
|
4
4
|
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
5
5
|
# license agreements.
|
@@ -33,6 +33,10 @@ module Aerospike
|
|
33
33
|
self
|
34
34
|
end
|
35
35
|
|
36
|
+
def get_node
|
37
|
+
@cluster.read_node(@partition, @policy.replica, @sequence)
|
38
|
+
end
|
39
|
+
|
36
40
|
def write_buffer
|
37
41
|
set_read_header(@policy, @key)
|
38
42
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2014-
|
1
|
+
# Copyright 2014-2020 Aerospike, Inc.
|
2
2
|
#
|
3
3
|
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
4
4
|
# license agreements.
|
@@ -27,12 +27,18 @@ module Aerospike
|
|
27
27
|
@cluster = cluster
|
28
28
|
@key = key
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
@partition = Partition.new_by_key(key)
|
31
|
+
|
32
|
+
super()
|
32
33
|
end
|
33
34
|
|
34
35
|
protected
|
35
36
|
|
37
|
+
def get_node
|
38
|
+
# abstract method
|
39
|
+
raise Aerospike::Exceptions::InvalidNode
|
40
|
+
end
|
41
|
+
|
36
42
|
def empty_socket
|
37
43
|
# There should not be any more bytes.
|
38
44
|
# Empty the socket to be safe.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
# Copyright 2014-
|
2
|
+
# Copyright 2014-2020 Aerospike, Inc.
|
3
3
|
#
|
4
4
|
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
5
5
|
# license agreements.
|
@@ -30,6 +30,10 @@ module Aerospike
|
|
30
30
|
self
|
31
31
|
end
|
32
32
|
|
33
|
+
def get_node
|
34
|
+
@cluster.master_node(@partition)
|
35
|
+
end
|
36
|
+
|
33
37
|
def write_buffer
|
34
38
|
set_touch(@policy, @key)
|
35
39
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
# Copyright 2014-
|
2
|
+
# Copyright 2014-2020 Aerospike, Inc.
|
3
3
|
#
|
4
4
|
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
5
5
|
# license agreements.
|
@@ -33,6 +33,10 @@ module Aerospike
|
|
33
33
|
self
|
34
34
|
end
|
35
35
|
|
36
|
+
def get_node
|
37
|
+
@cluster.master_node(@partition)
|
38
|
+
end
|
39
|
+
|
36
40
|
def write_bins
|
37
41
|
@bins
|
38
42
|
end
|
data/lib/aerospike/features.rb
CHANGED
data/lib/aerospike/geo_json.rb
CHANGED
data/lib/aerospike/host.rb
CHANGED
data/lib/aerospike/info.rb
CHANGED
data/lib/aerospike/key.rb
CHANGED
data/lib/aerospike/language.rb
CHANGED
data/lib/aerospike/node.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2014-
|
3
|
+
# Copyright 2014-2020 Aerospike, Inc.
|
4
4
|
#
|
5
5
|
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
6
6
|
# license agreements.
|
@@ -33,7 +33,6 @@ module Aerospike
|
|
33
33
|
@name = nv.name
|
34
34
|
@aliases = Atomic.new(nv.aliases)
|
35
35
|
@host = nv.host
|
36
|
-
@use_new_info = Atomic.new(nv.use_new_info)
|
37
36
|
@features = nv.features
|
38
37
|
@cluster_name = nv.cluster_name
|
39
38
|
|
@@ -52,6 +51,8 @@ module Aerospike
|
|
52
51
|
@active = Atomic.new(true)
|
53
52
|
@failures = Atomic.new(0)
|
54
53
|
|
54
|
+
@replica_index = Atomic.new(0)
|
55
|
+
|
55
56
|
@connections = ::Aerospike::ConnectionPool.new(cluster, host)
|
56
57
|
end
|
57
58
|
|
@@ -178,10 +179,6 @@ module Aerospike
|
|
178
179
|
end
|
179
180
|
alias eql? ==
|
180
181
|
|
181
|
-
def use_new_info?
|
182
|
-
@use_new_info.value
|
183
|
-
end
|
184
|
-
|
185
182
|
def hash
|
186
183
|
@name.hash
|
187
184
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2018 Aerospike, Inc.
|
3
|
+
# Copyright 2018-2020 Aerospike, Inc.
|
4
4
|
#
|
5
5
|
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
6
6
|
# license agreements.
|
@@ -25,24 +25,15 @@ module Aerospike
|
|
25
25
|
def call(node, peers)
|
26
26
|
return unless should_refresh?(node, peers)
|
27
27
|
|
28
|
-
|
28
|
+
Aerospike.logger.info("Updating partitions for node #{node.name}")
|
29
|
+
conn = node.tend_connection
|
30
|
+
parser = PartitionParser.new(node, conn)
|
31
|
+
node.cluster.update_partitions(parser)
|
29
32
|
rescue ::Aerospike::Exceptions::Aerospike => e
|
30
|
-
|
33
|
+
conn.close
|
31
34
|
Refresh::Failed.(node, e)
|
32
35
|
end
|
33
36
|
|
34
|
-
# Return correct tokenizer depending on version
|
35
|
-
def tokenizer(node)
|
36
|
-
conn = node.tend_connection
|
37
|
-
if node.use_new_info?
|
38
|
-
Aerospike.logger.info("Updating partitions for node #{node.name} using new protocol")
|
39
|
-
PartitionTokenizerNew.new(conn)
|
40
|
-
else
|
41
|
-
Aerospike.logger.info("Updating partitions for node #{node.name} using old protocol")
|
42
|
-
PartitionTokenizerOld.new(conn)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
37
|
# Do not refresh partitions when node connection has already failed
|
47
38
|
# during this cluster tend iteration. Also, avoid "split cluster"
|
48
39
|
# case where this node thinks it's a 1-node cluster. Unchecked, such
|