Module: Aerospike::Node::Refresh::Partitions
- Defined in:
- lib/aerospike/node/refresh/partitions.rb
Class Method Summary collapse
- .call(node, peers) ⇒ Object
-
.should_refresh?(node, peers) ⇒ Boolean
Do not refresh partitions when node connection has already failed during this cluster tend iteration.
-
.tokenizer(node) ⇒ Object
Return correct tokenizer depending on version.
Class Method Details
.call(node, peers) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/aerospike/node/refresh/partitions.rb', line 25 def call(node, peers) return unless should_refresh?(node, peers) node.cluster.update_partitions(tokenizer(node), node) rescue ::Aerospike::Exceptions::Aerospike => e node.tend_connection.close Refresh::Failed.(node, e) end |
.should_refresh?(node, peers) ⇒ Boolean
Do not refresh partitions when node connection has already failed during this cluster tend iteration. Also, avoid “split cluster” case where this node thinks it’s a 1-node cluster. Unchecked, such a node can dominate the partition map and cause all other nodes to be dropped.
51 52 53 54 55 |
# File 'lib/aerospike/node/refresh/partitions.rb', line 51 def should_refresh?(node, peers) return false if node.failed? || !node.active? return false if !node.has_peers? && peers.refresh_count > 1 true end |
.tokenizer(node) ⇒ Object
Return correct tokenizer depending on version
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/aerospike/node/refresh/partitions.rb', line 35 def tokenizer(node) conn = node.tend_connection if node.use_new_info? Aerospike.logger.info("Updating partitions for node #{node.name} using new protocol") PartitionTokenizerNew.new(conn) else Aerospike.logger.info("Updating partitions for node #{node.name} using old protocol") PartitionTokenizerOld.new(conn) end end |