module Aerospike::Cluster::FindNodesToRemove
Calculates which nodes that should be removed from the cluster
Public Class Methods
call(cluster, refresh_count)
click to toggle source
# File lib/aerospike/cluster/find_nodes_to_remove.rb, line 25 def call(cluster, refresh_count) node_list = cluster.nodes remove_list = [] node_list.each do |node| unless node.active? # Inactive nodes must be removed. remove_list << node next end if refresh_count.zero? && node.failed?(5) # 5 or more failures counts as failed # All node info requests failed and this node had 5 consecutive failures. # Remove node. If no nodes are left, seeds will be tried in next cluster # tend iteration. remove_list << node next end if node_list.size > 1 && refresh_count >= 1 && !node.referenced? # Node is not referenced by other nodes. # Check if node responded to info request. if node.failed? remove_list << node else # Node is alive, but not referenced by other nodes. Check if mapped. unless cluster.find_node_in_partition_map(node) # Node doesn't have any partitions mapped to it. # There is no point in keeping it in the cluster. remove_list << node end end end end remove_list end