Source:
private void updateStateOfReplicas(List<InstanceConfig> instanceConfigs) { for (InstanceConfig instanceConfig : instanceConfigs) { int schemaVersion = getSchemaVersion(instanceConfig); switch (schemaVersion) { case 0: String instanceName = instanceConfig.getInstanceName(); long instanceXid = getXid(instanceConfig); AmbryDataNode node = instanceNameToAmbryDataNode.get(instanceName); if (instanceXid <= currentXid) { if (node == null) { logger.info("Dynamic addition of new nodes is not yet supported, ignoring InstanceConfig {}", instanceConfig); } else { Set<String> sealedReplicas = new HashSet<>(getSealedReplicas(instanceConfig)); Set<String> stoppedReplicas = new HashSet<>(getStoppedReplicas(instanceConfig)); for (AmbryReplica replica : ambryDataNodeToAmbryReplicas.get(node)) { if (clusterMapConfig.clusterMapEnablePartitionOverride && partitionOverrideInfoMap.containsKey( replica.getPartitionId().toPathString())) { logger.trace( "Ignoring instanceConfig change for partition on instance because partition override is enabled", replica.getPartitionId().toPathString(), instanceName); } else { replica.setSealedState(sealedReplicas.contains(replica.getPartitionId().toPathString())); replica.setStoppedState(stoppedReplicas.contains(replica.getPartitionId().toPathString())); } } } } else { logger.trace( "Ignoring instanceConfig change for because the xid associated with it ({}) is later than current xid ({})", instanceName, instanceXid, currentXid); helixClusterManagerMetrics.ignoredUpdatesCount.inc(); } break; default: logger.error("Unknown InstanceConfig schema version: {}, ignoring.", schemaVersion); } } }

Target:
private void updateStateOfReplicas(List<InstanceConfig> instanceConfigs) { for (InstanceConfig instanceConfig : instanceConfigs) { int schemaVersion = getSchemaVersion(instanceConfig); switch (schemaVersion) { case 0: String instanceName = instanceConfig.getInstanceName(); long instanceXid = getXid(instanceConfig); AmbryDataNode node = instanceNameToAmbryDataNode.get(instanceName); if (instanceXid <= currentXid) { if (node == null) { logger.info("Dynamic addition of new nodes is not yet supported, ignoring InstanceConfig {}", instanceConfig); } else { Set<String> sealedReplicas = new HashSet<>(getSealedReplicas(instanceConfig)); Set<String> stoppedReplicas = new HashSet<>(getStoppedReplicas(instanceConfig)); for (AmbryReplica replica : ambryDataNodeToAmbryReplicas.get(node)) { String partitionId = replica.getPartitionId().toPathString(); if (clusterMapConfig.clusterMapEnablePartitionOverride && partitionOverrideInfoMap.containsKey( partitionId)) { logger.trace( "Ignoring instanceConfig change for partition on instance because partition override is enabled", partitionId, instanceName); } else { replica.setSealedState(sealedReplicas.contains(partitionId)); replica.setStoppedState(stoppedReplicas.contains(partitionId)); } } } } else { logger.trace( "Ignoring instanceConfig change for because the xid associated with it ({}) is later than current xid ({})", instanceName, instanceXid, currentXid); helixClusterManagerMetrics.ignoredUpdatesCount.inc(); } break; default: logger.error("Unknown InstanceConfig schema version: {}, ignoring.", schemaVersion); } } }