module Aerospike::Node::Refresh::Partitions
Public Class Methods
call(node, peers)
click to toggle source
# File lib/aerospike/node/refresh/partitions.rb, line 25 def call(node, peers) return unless should_refresh?(node, peers) Aerospike.logger.info("Updating partitions for node #{node.name}") conn = node.tend_connection parser = PartitionParser.new(node, conn) node.cluster.update_partitions(parser) rescue ::Aerospike::Exceptions::Aerospike => e conn.close Refresh::Failed.(node, e) end
should_refresh?(node, peers)
click to toggle source
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.
# File lib/aerospike/node/refresh/partitions.rb, line 42 def should_refresh?(node, peers) return false if node.failed? || !node.active? return false if !node.has_peers? && peers.refresh_count > 1 true end