aerospike 2.23.0 → 2.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +303 -266
- data/lib/aerospike/client.rb +25 -25
- data/lib/aerospike/command/command.rb +3 -1
- data/lib/aerospike/command/field_type.rb +25 -28
- data/lib/aerospike/exp/exp.rb +1262 -0
- data/lib/aerospike/policy/query_policy.rb +35 -2
- data/lib/aerospike/policy/scan_policy.rb +0 -2
- data/lib/aerospike/query/query_command.rb +1 -1
- data/lib/aerospike/query/query_executor.rb +73 -0
- data/lib/aerospike/query/query_partition_command.rb +266 -0
- data/lib/aerospike/query/statement.rb +7 -0
- data/lib/aerospike/query/stream_command.rb +2 -1
- data/lib/aerospike/utils/buffer.rb +26 -7
- data/lib/aerospike/version.rb +1 -1
- data/lib/aerospike.rb +2 -0
- metadata +6 -3
data/lib/aerospike/client.rb
CHANGED
@@ -693,44 +693,44 @@ module Aerospike
|
|
693
693
|
# Query functions (Supported by Aerospike 3 servers only)
|
694
694
|
#--------------------------------------------------------
|
695
695
|
|
696
|
-
#
|
697
|
-
# The query executor puts records on
|
698
|
-
# The caller can concurrently
|
699
|
-
#
|
696
|
+
# Executes a query for specified partitions and returns a recordset.
|
697
|
+
# The query executor puts records on the queue from separate threads.
|
698
|
+
# The caller can concurrently pop records off the queue through the
|
699
|
+
# recordset.records API.
|
700
700
|
#
|
701
|
-
# This method is only supported by Aerospike
|
702
|
-
# If the policy is nil,
|
703
|
-
def
|
701
|
+
# This method is only supported by Aerospike 4.9+ servers.
|
702
|
+
# If the policy is nil, the default relevant policy will be used.
|
703
|
+
def query_partitions(partition_filter, statement, options = nil)
|
704
704
|
policy = create_policy(options, QueryPolicy, default_query_policy)
|
705
705
|
new_policy = policy.clone
|
706
706
|
|
707
707
|
nodes = @cluster.nodes
|
708
708
|
if nodes.empty?
|
709
|
-
raise Aerospike::Exceptions::Aerospike.new(Aerospike::ResultCode::SERVER_NOT_AVAILABLE, "
|
709
|
+
raise Aerospike::Exceptions::Aerospike.new(Aerospike::ResultCode::SERVER_NOT_AVAILABLE, "Query failed because cluster is empty.")
|
710
710
|
end
|
711
711
|
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
Thread.current.abort_on_exception = true
|
719
|
-
command = QueryCommand.new(node, new_policy, statement, recordset, partitions)
|
720
|
-
begin
|
721
|
-
execute_command(command)
|
722
|
-
rescue => e
|
723
|
-
Aerospike.logger.error(e.backtrace.join("\n")) unless e == QUERY_TERMINATED_EXCEPTION
|
724
|
-
recordset.cancel(e)
|
725
|
-
ensure
|
726
|
-
recordset.thread_finished
|
727
|
-
end
|
728
|
-
end
|
712
|
+
# result recordset
|
713
|
+
recordset = Recordset.new(policy.record_queue_size, 1, :query)
|
714
|
+
tracker = PartitionTracker.new(policy, nodes, partition_filter)
|
715
|
+
Thread.new do
|
716
|
+
Thread.current.abort_on_exception = true
|
717
|
+
QueryExecutor.query_partitions(@cluster, policy, tracker, statement, recordset)
|
729
718
|
end
|
730
719
|
|
731
720
|
recordset
|
732
721
|
end
|
733
722
|
|
723
|
+
# Query executes a query and returns a recordset.
|
724
|
+
# The query executor puts records on a channel from separate threads.
|
725
|
+
# The caller can concurrently pops records off the channel through the
|
726
|
+
# record channel.
|
727
|
+
#
|
728
|
+
# This method is only supported by Aerospike 3 servers.
|
729
|
+
# If the policy is nil, a default policy will be generated.
|
730
|
+
def query(statement, options = nil)
|
731
|
+
query_partitions(Aerospike::PartitionFilter.all, statement, options)
|
732
|
+
end
|
733
|
+
|
734
734
|
#-------------------------------------------------------
|
735
735
|
# User administration
|
736
736
|
#-------------------------------------------------------
|
@@ -34,6 +34,8 @@ module Aerospike
|
|
34
34
|
INFO1_READ = Integer(1 << 0)
|
35
35
|
# Get all bins.
|
36
36
|
INFO1_GET_ALL = Integer(1 << 1)
|
37
|
+
# Short query
|
38
|
+
INFO1_SHORT_QUERY = Integer(1 << 2)
|
37
39
|
|
38
40
|
|
39
41
|
INFO1_BATCH = Integer(1 << 3)
|
@@ -454,7 +456,7 @@ module Aerospike
|
|
454
456
|
# @data_buffer.write_byte(policy.scan_percent.to_i.ord, @data_offset)
|
455
457
|
# @data_offset += 1
|
456
458
|
|
457
|
-
write_field_header(4, Aerospike::FieldType::
|
459
|
+
write_field_header(4, Aerospike::FieldType::SOCKET_TIMEOUT)
|
458
460
|
@data_buffer.write_uint32(policy.socket_timeout.to_i, @data_offset)
|
459
461
|
@data_offset += 4
|
460
462
|
|
@@ -21,34 +21,31 @@ module Aerospike
|
|
21
21
|
|
22
22
|
module FieldType
|
23
23
|
|
24
|
-
NAMESPACE
|
25
|
-
TABLE
|
26
|
-
KEY
|
27
|
-
|
28
|
-
|
29
|
-
#
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
QUERY_BINLIST = 40
|
50
|
-
BATCH_INDEX = 41
|
51
|
-
PREDEXP = 43
|
24
|
+
NAMESPACE = 0
|
25
|
+
TABLE = 1
|
26
|
+
KEY = 2
|
27
|
+
DIGEST_RIPE = 4
|
28
|
+
DIGEST_RIPE_ARRAY = 6
|
29
|
+
TRAN_ID = 7 # user supplied transaction id, which is simply passed back
|
30
|
+
SCAN_OPTIONS = 8
|
31
|
+
SOCKET_TIMEOUT = 9
|
32
|
+
RECORDS_PER_SECOND = 10
|
33
|
+
PID_ARRAY = 11
|
34
|
+
DIGEST_ARRAY = 12
|
35
|
+
MAX_RECORDS = 13
|
36
|
+
BVAL_ARRAY = 15
|
37
|
+
INDEX_NAME = 21
|
38
|
+
INDEX_RANGE = 22
|
39
|
+
INDEX_CONTEXT = 23
|
40
|
+
INDEX_TYPE = 26
|
41
|
+
UDF_PACKAGE_NAME = 30
|
42
|
+
UDF_FUNCTION = 31
|
43
|
+
UDF_ARGLIST = 32
|
44
|
+
UDF_OP = 33
|
45
|
+
QUERY_BINLIST = 40
|
46
|
+
BATCH_INDEX = 41
|
47
|
+
BATCH_INDEX_WITH_SET = 42
|
48
|
+
FILTER_EXP = 43
|
52
49
|
|
53
50
|
end # module
|
54
51
|
|