protected void setPartitionDisabledState(String partitionName, boolean disable) {
    synchronized (helixAdministrationLock) {
      // 1. update disabled replica list in DataNodeConfig. This modifies ListFields only
      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");
        }

        // 2. If the DataNodeConfig was changed, invoke Helix native method to enable/disable partition on local node,
        //    this will trigger subsequent state transition on given replica. This method modifies MapFields in
        //    InstanceConfig.
        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);
    }
  }
Disable/enable partition on local node. This method will update both InstanceConfig and DataNodeConfig in PropertyStore.
@param partitionName name of partition on local node
@param disable if {@code true}, disable given partition on current node. {@code false} otherwise.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/HelixParticipant.java