aerospike 2.27.0 → 2.29.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: 3fe67950bfa737ce26a8a0e823cd84424219c6ce41720e0202ca93d4dcab2c1d
4
- data.tar.gz: 83976d88565599f00136967bd86fe832a88783518c51be2789c1463fa06e795e
3
+ metadata.gz: a5f1927589fab415975f46da19cfc0de4dc00285abe0627f0472d1e8aa27f5c9
4
+ data.tar.gz: e8245b120f0f78882e6dba592169434372eaa99032b6542167c7a46296c2bff9
5
5
  SHA512:
6
- metadata.gz: e018d80b673081cdbf229aa5c48dd7ebbeb9a127492cc04c651a4e56bab92d7764aba82ffb3e3783f6a6f34755ded66be58c3bf5a9e110be61c0c21e20128932
7
- data.tar.gz: 8e02a4d37b620f838dde53b63d4af3fe20146905dd4f3a30c14f97a83453c69f0dccfbaf1f44a777bf4ab53e89583cc7a6e4343204e6749b1d4fb888f0a7200f
6
+ metadata.gz: 3915a6e8d1c82ddf1bdf80b66dcea019270f057b166071a24c1c52419afe9d69aeb97b10210fea58abd011ed4ddef89466823a06fbb807290899f010465314f2
7
+ data.tar.gz: 54c1776cece8e96ec07c75d0860aa2047f096352b2e329785e29c8317d4df7b856388d8fe4aeb506774fadc4fdee54f5e0eae7696ff294189ad9e54b7fe13c7a
data/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [2.29.0] 2023-08-24
6
+ - **Updates**
7
+ - [CLIENT-2526] Support for set quota for user defined roles
8
+
9
+ ## [2.28.0] 2023-06-23
10
+ - **New Features**
11
+ - [CLIENT-1432] Support minimum connections in connection pools
12
+
13
+ - **Updates**
14
+ - [CLIENT-1529] Removed Policy.priority, ScanPolicy.scanPercent and ScanPolicy.failOnClusterChange
15
+
5
16
  ## [2.27.0] 2023-05-18
6
17
  - **New Features**
7
18
  - [CLIENT-1176] Support write operations in background query
@@ -894,6 +894,13 @@ module Aerospike
894
894
  command.revoke_privileges(@cluster, policy, role_name, privileges)
895
895
  end
896
896
 
897
+ # Set or update quota for a role.
898
+ def set_quotas(role_name, read_quota, write_quota, options = nil)
899
+ policy = create_policy(options, AdminPolicy, default_admin_policy)
900
+ command = AdminCommand.new
901
+ command.set_quotas(@cluster, policy, role_name, read_quota, write_quota)
902
+ end
903
+
897
904
  private
898
905
 
899
906
  def set_default_policies(policies)
@@ -23,13 +23,8 @@ require 'aerospike/atomic/atomic'
23
23
 
24
24
  module Aerospike
25
25
  class Cluster
26
- attr_reader :connection_timeout, :connection_queue_size, :user, :password
27
- attr_reader :features, :tls_options
28
- attr_reader :cluster_id, :aliases
29
- attr_reader :cluster_name
30
- attr_reader :client_policy
31
- attr_accessor :rack_aware, :rack_id
32
- attr_accessor :session_token, :session_expiration
26
+ attr_reader :connection_timeout, :connection_queue_size, :user, :password, :features, :tls_options, :cluster_id, :aliases, :cluster_name, :client_policy
27
+ attr_accessor :rack_aware, :rack_id, :session_token, :session_expiration
33
28
 
34
29
  def initialize(policy, hosts)
35
30
  @client_policy = policy
@@ -63,6 +58,10 @@ module Aerospike
63
58
  end
64
59
 
65
60
  initialize_tls_host_names(hosts) if tls_enabled?
61
+
62
+ if policy.min_connections_per_node > policy.max_connections_per_node
63
+ raise Aerospike::Exceptions::Aerospike.new(Aerospike::ResultCode::PARAMETER_ERROR, "Invalid policy configuration: Minimum connections per node cannot be greater than maximum connections per node.")
64
+ end
66
65
  end
67
66
 
68
67
  def connect
@@ -584,7 +583,9 @@ module Aerospike
584
583
  end
585
584
 
586
585
  def create_node(nv)
587
- ::Aerospike::Node.new(self, nv)
586
+ node = ::Aerospike::Node.new(self, nv)
587
+ node.fill_connection_pool_up_to(@client_policy.min_connections_per_node)
588
+ node
588
589
  end
589
590
 
590
591
  def create_connection(host)
@@ -22,7 +22,7 @@ require 'aerospike/atomic/atomic'
22
22
  module Aerospike
23
23
  class Node
24
24
 
25
- attr_reader :reference_count, :responded, :name, :features, :cluster_name, :partition_generation, :rebalance_generation, :peers_generation, :failures, :cluster, :peers_count, :host
25
+ attr_reader :reference_count, :responded, :name, :features, :cluster_name, :partition_generation, :rebalance_generation, :peers_generation, :failures, :cluster, :peers_count, :host, :connections
26
26
 
27
27
  PARTITIONS = 4096
28
28
  FULL_HEALTH = 100
@@ -69,6 +69,17 @@ module Aerospike
69
69
  racks[ns] == rack_id
70
70
  end
71
71
 
72
+ def fill_connection_pool_up_to(min_connection_size)
73
+ current_number_of_connections = @connections.length
74
+ if min_connection_size > 0
75
+ while current_number_of_connections < min_connection_size
76
+ conn = @connections.create
77
+ @connections.offer(conn)
78
+ current_number_of_connections += 1
79
+ end
80
+ end
81
+ end
82
+
72
83
  # Get a connection to the node. If no cached connection is not available,
73
84
  # a new connection will be created
74
85
  def get_connection(timeout)
@@ -23,7 +23,7 @@ module Aerospike
23
23
  class ClientPolicy
24
24
 
25
25
  attr_accessor :user, :password, :auth_mode
26
- attr_accessor :timeout, :connection_queue_size, :fail_if_not_connected, :tend_interval
26
+ attr_accessor :timeout, :connection_queue_size, :fail_if_not_connected, :tend_interval, :max_connections_per_node, :min_connections_per_node
27
27
  attr_accessor :cluster_name
28
28
  attr_accessor :tls
29
29
  attr_accessor :policies
@@ -74,6 +74,26 @@ module Aerospike
74
74
  # ClientPolicy#rack_aware, Replica#PREFER_RACK and server rack
75
75
  # configuration must also be set to enable this functionality.
76
76
  @rack_id = opt[:rack_id] || 0
77
+
78
+ # Maximum number of synchronous connections allowed per server node. Transactions will go
79
+ # through retry logic and potentially fail with "ResultCode.NO_MORE_CONNECTIONS" if the maximum
80
+ # number of connections would be exceeded.
81
+ # The number of connections used per node depends on concurrent commands in progress
82
+ # plus sub-commands used for parallel multi-node commands (batch, scan, and query).
83
+ # One connection will be used for each command.
84
+ # Default: 100
85
+ @max_connections_per_node = opt[:max_connections_per_node] || 100
86
+
87
+ # MinConnectionsPerNode specifies the minimum number of synchronous connections allowed per server node.
88
+ # Preallocate min connections on client node creation.
89
+ # The client will periodically allocate new connections if count falls below min connections.
90
+ #
91
+ # Server proto-fd-idle-ms may also need to be increased substantially if min connections are defined.
92
+ # The proto-fd-idle-ms default directs the server to close connections that are idle for 60 seconds
93
+ # which can defeat the purpose of keeping connections in reserve for a future burst of activity.
94
+ #
95
+ # Default: 0
96
+ @min_connections_per_node = opt[:min_connections_per_node] || 0
77
97
  end
78
98
 
79
99
  def requires_authentication
@@ -51,8 +51,10 @@ module Aerospike
51
51
  # Default: false
52
52
  @fail_on_filtered_out = opt[:fail_on_filtered_out] || false
53
53
 
54
- # Priority of request relative to other transactions.
55
- # Currently, only used for scans.
54
+ # [:nodoc:]
55
+ # DEPRECATED
56
+ # The Aerospike server does not support this policy anymore
57
+ # TODO: Remove for next major release
56
58
  @priority = opt[:priority] || Priority::DEFAULT
57
59
 
58
60
  # Set optional predicate expression filters in postfix notation.
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Copyright 2014-2020 Aerospike, Inc.
2
+ # Copyright 2014-2023 Aerospike, Inc.
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -13,6 +13,10 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
 
16
+
17
+ #[:nodoc:]
18
+ # DEPRECATED
19
+ # TODO: Remove this module on the next major release
16
20
  module Aerospike
17
21
 
18
22
  module Priority
@@ -48,7 +48,10 @@ module Aerospike
48
48
  # Default is 100.
49
49
  @scan_percent = opt[:scan_percent] || 100
50
50
 
51
- # Issue scan requests in parallel or serially.
51
+ # [:nodoc:]
52
+ # DEPRECATED
53
+ # The Aerospike server does not support this policy anymore
54
+ # TODO: Remove for next major release
52
55
  @concurrent_nodes = opt.fetch(:concurrent_nodes) { true }
53
56
 
54
57
  # Indicates if bin data is retrieved. If false, only record digests (and
@@ -56,8 +59,10 @@ module Aerospike
56
59
  # Default is true.
57
60
  @include_bin_data = opt.fetch(:include_bin_data) { true }
58
61
 
59
- # Terminate scan if cluster in fluctuating state.
60
- # Default is true.
62
+ # [:nodoc:]
63
+ # DEPRECATED
64
+ # The Aerospike server does not support this policy anymore
65
+ # TODO: Remove for next major release
61
66
  @fail_on_cluster_change = opt.fetch(:fail_on_cluster_change) { true }
62
67
 
63
68
  # Determines network timeout for each attempt.
@@ -18,7 +18,7 @@ module Aerospike
18
18
 
19
19
  class Pool #:nodoc:
20
20
 
21
- attr_accessor :create_proc, :cleanup_proc, :check_proc
21
+ attr_accessor :create_proc, :cleanup_proc, :check_proc, :max_size
22
22
 
23
23
  def initialize(max_size = 256, &block)
24
24
  @create_proc = block
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Aerospike
3
- VERSION = "2.27.0"
3
+ VERSION = "2.29.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.27.0
4
+ version: 2.29.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Khosrow Afroozeh
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-05-18 00:00:00.000000000 Z
13
+ date: 2023-08-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: msgpack