/** * Converts message to it's legacy version if necessary. * * @param target Target version * @return Converted message or {@code this} if conversion isn't necessary. */ public GridCacheMessage convertIfNeeded(IgniteProductVersion target) { if (target.compareTo(VERSION_SINCE) <= 0) return new GridDhtPartitionDemandLegacyMessage(this); return this; }
/** * */ private void initializeMinimumVersion() { minNodeVer = null; for (TcpDiscoveryNode node : nodes) { if (minNodeVer == null || node.version().compareTo(minNodeVer) < 0) minNodeVer = node.version(); } }
/** * @param topVer Latch topology version. * @return Oldest alive server node with latch functionality. */ @Nullable private ClusterNode getLatchCoordinator(AffinityTopologyVersion topVer) { Collection<ClusterNode> aliveNodes = aliveNodesForTopologyVer(topVer); List<ClusterNode> applicableNodes = aliveNodes .stream() .filter(node -> node.version().compareTo(VERSION_SINCE) >= 0) .sorted(Comparator.comparing(ClusterNode::order)) .collect(Collectors.toList()); if (applicableNodes.isEmpty()) return null; if (canSkipJoiningNodes(topVer)) applicableNodes = excludeJoinedNodes(applicableNodes, topVer); return applicableNodes.get(0); }
/** * @param topVer Latch topology version. * @return Collection of alive server nodes with latch functionality. */ private Collection<ClusterNode> getLatchParticipants(AffinityTopologyVersion topVer) { Collection<ClusterNode> aliveNodes = aliveNodesForTopologyVer(topVer); List<ClusterNode> participantNodes = aliveNodes .stream() .filter(node -> node.version().compareTo(VERSION_SINCE) >= 0) .collect(Collectors.toList()); if (canSkipJoiningNodes(topVer)) return excludeJoinedNodes(participantNodes, topVer); return participantNodes; }
/** * Checks that latch manager can use V2 protocol and skip joining nodes from latch participants. * * @param topVer Topology version. */ public boolean canSkipJoiningNodes(AffinityTopologyVersion topVer) { Collection<ClusterNode> applicableNodes = topVer.equals(AffinityTopologyVersion.NONE) ? discovery.aliveServerNodes() : discovery.topology(topVer.topologyVersion()); return applicableNodes.stream() .allMatch(node -> node.version().compareTo(PROTOCOL_V2_VERSION_SINCE) >= 0); }
if (n.version().compareTo(NOT_NULLS_SUPPORT_VER) < 0) allNodesNew = false;
/** * Checks cache encryption supported by all nodes in cluster. * * @throws IgniteCheckedException If check fails. */ public void checkEncryptedCacheSupported() throws IgniteCheckedException { Collection<ClusterNode> nodes = ctx.grid().cluster().nodes(); for (ClusterNode node : nodes) { if (CACHE_ENCRYPTION_SINCE.compareTo(node.version()) > 0) { throw new IgniteCheckedException("All nodes in cluster should be 2.7.0 or greater " + "to create encrypted cache! [nodeId=" + node.id() + "]"); } } }
if (node != null && node.version().compareTo(SIZES_VALIDATION_AVAILABLE_SINCE) < 0) ignoringNodes.add(id);
/** * Executes appropriate version of idle_verify check. Old version will be used if there are old nodes in the * cluster. * * @param client Client. * @param cacheArgs Cache args. */ private void cacheIdleVerify(GridClient client, CacheArguments cacheArgs) throws GridClientException { Collection<GridClientNode> nodes = client.compute().nodes(GridClientNode::connectable); boolean idleVerifyV2 = true; for (GridClientNode node : nodes) { String nodeVerStr = node.attribute(IgniteNodeAttributes.ATTR_BUILD_VER); IgniteProductVersion nodeVer = IgniteProductVersion.fromString(nodeVerStr); if (nodeVer.compareTo(VerifyBackupPartitionsTaskV2.V2_SINCE_VER) < 0) { idleVerifyV2 = false; break; } } if (cacheArgs.dump()) cacheIdleVerifyDump(client, cacheArgs); else if (idleVerifyV2) cacheIdleVerifyV2(client, cacheArgs); else legacyCacheIdleVerify(client, cacheArgs); }
/** * Verifies all nodes in current cluster topology support BaselineTopology feature so compatibilityMode flag is * enabled to reset. * * @param discoCache */ private void verifyBaselineTopologySupport(DiscoCache discoCache) { if (discoCache.minimumServerNodeVersion().compareTo(MIN_BLT_SUPPORTING_VER) < 0) { SB sb = new SB("Cluster contains nodes that don't support BaselineTopology: ["); for (ClusterNode cn : discoCache.serverNodes()) { if (cn.version().compareTo(MIN_BLT_SUPPORTING_VER) < 0) sb .a("[") .a(cn.consistentId()) .a(":") .a(cn.version()) .a("], "); } sb.d(sb.length() - 2, sb.length()); throw new IgniteException(sb.a("]").toString()); } }
if (node.version().compareTo(SVC_POOL_SINCE_VER) >= 0) ctx.task().setThreadContext(TC_IO_POLICY, GridIoPolicy.SERVICE_POOL);
/** * @param part Partition id. * @return Future. */ private IgniteInternalFuture<?> executePreloadTask(int part) throws IgniteCheckedException { ClusterGroup grp = ctx.grid().cluster().forDataNodes(ctx.name()); @Nullable ClusterNode targetNode = ctx.affinity().primaryByPartition(part, ctx.topology().readyTopologyVersion()); if (targetNode == null || targetNode.version().compareTo(PRELOAD_PARTITION_SINCE) < 0) { if (!partPreloadBadVerWarned) { U.warn(log(), "Attempting to execute partition preloading task on outdated or not mapped node " + "[targetNodeVer=" + (targetNode == null ? "NA" : targetNode.version()) + ", minSupportedNodeVer=" + PRELOAD_PARTITION_SINCE + ']'); partPreloadBadVerWarned = true; } return new GridFinishedFuture<>(); } return ctx.closures().affinityRun(Collections.singleton(name()), part, new PartitionPreloadJob(ctx.name(), part), grp.nodes(), null); }
boolean sendErrMsg = demanderNode.version().compareTo(GridDhtPartitionSupplyMessageV2.AVAILABLE_SINCE) >= 0;
if (node.version().compareTo(CONT_QRY_WITH_TRANSFORMER_SINCE) < 0) { throw new IgniteException("Can't start ContinuousQueryWithTransformer, " + "because some nodes in cluster doesn't support this feature: " + node);
/** * Converts message to it's legacy version if necessary. * * @param target Target version * @return Converted message or {@code this} if conversion isn't necessary. */ public GridCacheMessage convertIfNeeded(IgniteProductVersion target) { if (target.compareTo(VERSION_SINCE) <= 0) return new GridDhtPartitionDemandLegacyMessage(this); return this; }
/** * */ private void initializeMinimumVersion() { minNodeVer = null; for (TcpDiscoveryNode node : nodes) { if (minNodeVer == null || node.version().compareTo(minNodeVer) < 0) minNodeVer = node.version(); } }
/** * @param topVer Latch topology version. * @return Collection of alive server nodes with latch functionality. */ private Collection<ClusterNode> getLatchParticipants(AffinityTopologyVersion topVer) { Collection<ClusterNode> aliveNodes = aliveNodesForTopologyVer(topVer); List<ClusterNode> participantNodes = aliveNodes .stream() .filter(node -> node.version().compareTo(VERSION_SINCE) >= 0) .collect(Collectors.toList()); if (canSkipJoiningNodes(topVer)) return excludeJoinedNodes(participantNodes, topVer); return participantNodes; }
/** * Checks that latch manager can use V2 protocol and skip joining nodes from latch participants. * * @param topVer Topology version. */ public boolean canSkipJoiningNodes(AffinityTopologyVersion topVer) { Collection<ClusterNode> applicableNodes = topVer.equals(AffinityTopologyVersion.NONE) ? discovery.aliveServerNodes() : discovery.topology(topVer.topologyVersion()); return applicableNodes.stream() .allMatch(node -> node.version().compareTo(PROTOCOL_V2_VERSION_SINCE) >= 0); }
/** * Checks cache encryption supported by all nodes in cluster. * * @throws IgniteCheckedException If check fails. */ public void checkEncryptedCacheSupported() throws IgniteCheckedException { Collection<ClusterNode> nodes = ctx.grid().cluster().nodes(); for (ClusterNode node : nodes) { if (CACHE_ENCRYPTION_SINCE.compareTo(node.version()) > 0) { throw new IgniteCheckedException("All nodes in cluster should be 2.7.0 or greater " + "to create encrypted cache! [nodeId=" + node.id() + "]"); } } }