@Test public void testBackupsMoreThanThreshold() { List<ClusterNode> nodes = new ArrayList<>(); for (int i = 0; i < 10; i++) nodes.add(node(metrics, ver, "1" + i)); GridAffinityAssignment gridAffinityAssignment = new GridAffinityAssignment( new AffinityTopologyVersion(1, 0), new ArrayList<List<ClusterNode>>() {{ add(nodes); }}, new ArrayList<>() ); assertSame(gridAffinityAssignment.getIds(0), gridAffinityAssignment.getIds(0)); }
@Override public Collection<UUID> getIds(int part) { assert part >= 0 && part < assignment.size() : "Affinity partition is out of range" + " [part=" + part + ", partitions=" + assignment.size() + ']'; if (IGNITE_DISABLE_AFFINITY_MEMORY_OPTIMIZATION) return getOrCreateAssignmentsIds(part); else { List<ClusterNode> nodes = assignment.get(part); return nodes.size() > GridAffinityAssignmentV2.IGNITE_AFFINITY_BACKUPS_THRESHOLD ? getOrCreateAssignmentsIds(part) : F.viewReadOnly(nodes, F.node2id()); } }
GridAffinityAssignmentV2 extends IgniteDataTransferObject implements AffinityAssignment { @Override public Collection<UUID> getIds(int part) { assert part >= 0 && part < assignment.size() : "Affinity partition is out of range" + " [part=" + part + ", partitions=" + assignment.size() + ']'; if (IGNITE_DISABLE_AFFINITY_MEMORY_OPTIMIZATION) return getOrCreateAssignmentsIds(part); else { List<ClusterNode> nodes = assignment.get(part); return nodes.size() > GridAffinityAssignmentV2.IGNITE_AFFINITY_BACKUPS_THRESHOLD ? getOrCreateAssignmentsIds(part) : F.viewReadOnly(nodes, F.node2id()); } } }
GridAffinityAssignmentV2 extends IgniteDataTransferObject implements AffinityAssignment { @Override public Collection<UUID> getIds(int part) { assert part >= 0 && part < assignment.size() : "Affinity partition is out of range" + " [part=" + part + ", partitions=" + assignment.size() + ']'; if (IGNITE_DISABLE_AFFINITY_MEMORY_OPTIMIZATION) return getOrCreateAssignmentsIds(part); else { List<ClusterNode> nodes = assignment.get(part); return nodes.size() > GridAffinityAssignmentV2.IGNITE_AFFINITY_BACKUPS_THRESHOLD ? getOrCreateAssignmentsIds(part) : F.viewReadOnly(nodes, F.node2id()); } } GridAffinityAssignmentV2();   GridAffinityAssignmentV2(AffinityTopologyVersion topVer);  GridAffinityAssignmentV2(AffinityTopologyVersion topVer,
        List<List<ClusterNode>> assignment,
        List<List<ClusterNode>> idealAssignment
    );   GridAffinityAssignmentV2(AffinityTopologyVersion topVer, GridAffinityAssignmentV2 aff); }
GridAffinityAssignmentV2 extends IgniteDataTransferObject implements AffinityAssignment { @Override public Collection<UUID> getIds(int part) { assert part >= 0 && part < assignment.size() : "Affinity partition is out of range" + " [part=" + part + ", partitions=" + assignment.size() + ']'; if (IGNITE_DISABLE_AFFINITY_MEMORY_OPTIMIZATION) return getOrCreateAssignmentsIds(part); else { List<ClusterNode> nodes = assignment.get(part); return nodes.size() > GridAffinityAssignmentV2.IGNITE_AFFINITY_BACKUPS_THRESHOLD ? getOrCreateAssignmentsIds(part) : F.viewReadOnly(nodes, F.node2id()); } } GridAffinityAssignmentV2();   GridAffinityAssignmentV2(AffinityTopologyVersion topVer);  GridAffinityAssignmentV2(AffinityTopologyVersion topVer,
        List<List<ClusterNode>> assignment,
        List<List<ClusterNode>> idealAssignment
    );   GridAffinityAssignmentV2(AffinityTopologyVersion topVer, GridAffinityAssignmentV2 aff); @Override List<List<ClusterNode>> idealAssignment(); @Override List<List<ClusterNode>> assignment(); @Override AffinityTopologyVersion topologyVersion(); @Override List<ClusterNode> get(int part); @Override Collection<UUID> getIds(int part); @Override Set<ClusterNode> nodes(); @Override Set<ClusterNode> primaryPartitionNodes(); @Override Set<Integer> primaryPartitions(UUID nodeId); @Override Set<Integer> backupPartitions(UUID nodeId); @Override Set<Integer> partitionPrimariesDifferentToIdeal(); @Override int hashCode(); @SuppressWarnings("SimplifiableIfStatement") @Override boolean equals(Object o); @Override String toString(); }
GridAffinityAssignmentV2 extends IgniteDataTransferObject implements AffinityAssignment { @Override public Collection<UUID> getIds(int part) { assert part >= 0 && part < assignment.size() : "Affinity partition is out of range" + " [part=" + part + ", partitions=" + assignment.size() + ']'; if (IGNITE_DISABLE_AFFINITY_MEMORY_OPTIMIZATION) return getOrCreateAssignmentsIds(part); else { List<ClusterNode> nodes = assignment.get(part); return nodes.size() > GridAffinityAssignmentV2.IGNITE_AFFINITY_BACKUPS_THRESHOLD ? getOrCreateAssignmentsIds(part) : F.viewReadOnly(nodes, F.node2id()); } } GridAffinityAssignmentV2();   GridAffinityAssignmentV2(AffinityTopologyVersion topVer);  GridAffinityAssignmentV2(AffinityTopologyVersion topVer,
        List<List<ClusterNode>> assignment,
        List<List<ClusterNode>> idealAssignment
    );   GridAffinityAssignmentV2(AffinityTopologyVersion topVer, GridAffinityAssignmentV2 aff); @Override List<List<ClusterNode>> idealAssignment(); @Override List<List<ClusterNode>> assignment(); @Override AffinityTopologyVersion topologyVersion(); @Override List<ClusterNode> get(int part); @Override Collection<UUID> getIds(int part); @Override Set<ClusterNode> nodes(); @Override Set<ClusterNode> primaryPartitionNodes(); @Override Set<Integer> primaryPartitions(UUID nodeId); @Override Set<Integer> backupPartitions(UUID nodeId); @Override Set<Integer> partitionPrimariesDifferentToIdeal(); @Override int hashCode(); @SuppressWarnings("SimplifiableIfStatement") @Override boolean equals(Object o); @Override String toString();  }