Source:
public void setReplicaDisabledState(ReplicaId replicaId, boolean disable) { if (!(replicaId instanceof AmbryReplica)) { throw new IllegalArgumentException( "HelixParticipant only works with the AmbryReplica implementation of ReplicaId"); } synchronized (helixAdministrationLock) { String partitionName = replicaId.getPartitionId().toPathString(); boolean instanceConfigUpdated = false; InstanceConfig instanceConfig = getInstanceConfig(); String resourceNameForPartition = getResourceNameOfPartition(helixAdmin, clusterName, partitionName); logger.info("{} replica on current node", disable ? "Disabling" : "Enabling", partitionName); boolean currentlyEnabled = instanceConfig.getInstanceEnabledForPartition(resourceNameForPartition, partitionName); if (currentlyEnabled == disable) { instanceConfig.setInstanceEnabledForPartition(resourceNameForPartition, partitionName, !disable); if (!helixAdmin.setInstanceConfig(clusterName, instanceName, instanceConfig)) { logger.warn("setReplicaDisabledState() failed InstanceConfig update"); } } boolean dataNodeConfigChanged = false; DataNodeConfig dataNodeConfig = getDataNodeConfig(); if (!disable && dataNodeConfig.getDisabledReplicas().remove(partitionName)) { logger.info("Removing the partition from disabledReplicas list", partitionName); dataNodeConfigChanged = true; } else if (disable && dataNodeConfig.getDisabledReplicas().add(partitionName)) { logger.info("Adding the partition to disabledReplicas list", partitionName); dataNodeConfigChanged = true; } if (dataNodeConfigChanged) { logger.info("Setting config with list of disabled replicas: {}", dataNodeConfig.getDisabledReplicas()); if (!dataNodeConfigSource.set(dataNodeConfig)) { logger.warn("setReplicaDisabledState() failed DataNodeConfig update"); } } logger.info("Disabled state of partition is updated", partitionName); } }

Target:
public void setReplicaDisabledState(ReplicaId replicaId, boolean disable) { if (!(replicaId instanceof AmbryReplica)) { throw new IllegalArgumentException( "HelixParticipant only works with the AmbryReplica implementation of ReplicaId"); } synchronized (helixAdministrationLock) { String partitionName = replicaId.getPartitionId().toPathString(); boolean dataNodeConfigChanged = false; DataNodeConfig dataNodeConfig = getDataNodeConfig(); if (!disable && dataNodeConfig.getDisabledReplicas().remove(partitionName)) { logger.info("Removing the partition from disabledReplicas list", partitionName); dataNodeConfigChanged = true; } else if (disable && dataNodeConfig.getDisabledReplicas().add(partitionName)) { logger.info("Adding the partition to disabledReplicas list", partitionName); dataNodeConfigChanged = true; } if (dataNodeConfigChanged) { logger.info("Setting config with list of disabled replicas: {}", dataNodeConfig.getDisabledReplicas()); if (!dataNodeConfigSource.set(dataNodeConfig)) { participantMetrics.setReplicaDisabledStateErrorCount.inc(); logger.warn("setReplicaDisabledState() failed DataNodeConfig update"); } InstanceConfig instanceConfig = getInstanceConfig(); String resourceNameForPartition = getResourceNameOfPartition(helixAdmin, clusterName, partitionName); logger.info("{} replica on current node", disable ? "Disabling" : "Enabling", partitionName); instanceConfig.setInstanceEnabledForPartition(resourceNameForPartition, partitionName, !disable); if (!helixAdmin.setInstanceConfig(clusterName, instanceName, instanceConfig)) { participantMetrics.setReplicaDisabledStateErrorCount.inc(); logger.warn("setReplicaDisabledState() failed InstanceConfig update"); } } logger.info("Disabled state of partition is updated", partitionName); } }