lib/mongo/cluster/sdam_flow.rb
def update_rs_with_primary_from_member
      if topology.replica_set_name != updated_desc.replica_set_name
        log_warn(
          "Removing server #{updated_desc.address.to_s} because it has an " +
          "incorrect replica set name (#{updated_desc.replica_set_name}); " +
          "current set name is #{topology.replica_set_name}"
        )
        remove
        check_if_has_primary
        return
      end

      if updated_desc.me_mismatch?
        log_warn(
          "Removing server #{updated_desc.address.to_s} because it " +
          "reported itself as #{updated_desc.me}"
        )
        remove
        check_if_has_primary
        return
      end

      have_primary = false
      servers_list.each do |server|
        if server.primary?
          have_primary = true
          break
        end
      end

      unless have_primary
        @topology = Topology::ReplicaSetNoPrimary.new(
          topology.options, topology.monitoring, self)
      end
    end
# Updates a ReplicaSetWithPrimary topology from a non-primary member.
Updates a ReplicaSetWithPrimary topology from a non-primary member.
Updates a ReplicaSetWithPrimary topology from a non - primary member .
def update_rs_with_primary_from_member
      if topology.replica_set_name != updated_desc.replica_set_name
        log_warn(
          "Removing server #{updated_desc.address.to_s} because it has an " +
          "incorrect replica set name (#{updated_desc.replica_set_name}); " +
          "current set name is #{topology.replica_set_name}"
        )
        remove
        check_if_has_primary
        return
      end
      if updated_desc.me_mismatch?
        log_warn(
          "Removing server #{updated_desc.address.to_s} because it " +
          "reported itself as #{updated_desc.me}"
        )
        remove
        check_if_has_primary
        return
      end
      have_primary = false
      servers_list.each do |server|
        if server.primary?
          have_primary = true
          break
        end
      end
      unless have_primary
        @topology = Topology::ReplicaSetNoPrimary.new(
          topology.options, topology.monitoring, self)
      end
    end
def update_rs_with_primary_from_member if topology . replica_set_name != updated_desc . replica_set_name log_warn ( "Removing server #{updated_desc.address.to_s} because it has an " + "incorrect replica set name (#{updated_desc.replica_set_name}); " + "current set name is #{topology.replica_set_name}" ) remove check_if_has_primary return end if updated_desc . me_mismatch? log_warn ( "Removing server #{updated_desc.address.to_s} because it " + "reported itself as #{updated_desc.me}" ) remove check_if_has_primary return end have_primary = false servers_list . each do | server | if server . primary? have_primary = true break end end unless have_primary @topology = Topology :: ReplicaSetNoPrimary . new ( topology . options , topology . monitoring , self ) end end
Updates a ReplicaSetWithPrimary topology from a non-primary member.
Updates a ReplicaSetWithPrimary topology from a non - primary member .