@Override
    public void onPartitionBecomeInactiveFromStandby(String partitionName) {
      // check if partition exists on current node
      ReplicaId replica = partitionNameToReplicaId.get(partitionName);
      // if replica is null that means partition is not on current node (this shouldn't happen unless we use server admin
      // tool to remove the store before initiating decommission on this partition). We throw exception in this case.
      if (replica != null) {
        Store localStore = getStore(replica.getPartitionId(), true);
        if (localStore == null) {
          throw new StateTransitionException("Store " + partitionName + " is not found on current node",
              ReplicaNotFound);
        }
        if (localStore.isDisabled()) {
          // if store is disabled due to disk I/O error or by admin operation, we explicitly throw an exception to mark
          // partition in Helix ERROR state
          throw new StateTransitionException(
              "Store " + partitionName + " is already disabled due to I/O error or by " + "admin operation",
              ReplicaOperationFailure);
        }
        // 0. as long as local replica exists, we create a decommission file in its dir
        File decommissionFile = new File(replica.getReplicaPath(), BlobStore.DECOMMISSION_FILE_NAME);
        try {
          if (!decommissionFile.exists()) {
            // if not present, create one.
            decommissionFile.createNewFile();
            logger.info("Decommission file is created for replica {}", replica.getReplicaPath());
          }
        } catch (IOException e) {
          logger.error("IOException occurs when creating decommission file for replica " + partitionName, e);
          throw new StateTransitionException(
              "Couldn't create decommission file for replica " + replica.getReplicaPath(), ReplicaOperationFailure);
        }
        if (localStore.isStarted()) {
          // 1. set state to INACTIVE
          if (isPrimaryClusterManagerListener) {
            localStore.setCurrentState(ReplicaState.INACTIVE);
            logger.info("Store {} is set to INACTIVE", partitionName);
          }
          // 2. disable compaction on this store
          if (!controlCompactionForBlobStoreStub(replica.getPartitionId(), false)) {
            logger.error("Failed to disable compaction on store {}", partitionName);
            // we set error code to ReplicaNotFound because that is the only reason why compaction may fail.
            throw new StateTransitionException("Couldn't disable compaction on replica " + replica.getReplicaPath(),
                ReplicaNotFound);
          }
          logger.info("Compaction is successfully disabled on store {}", partitionName);
        } else {
          // this may happen when the disk holding this store crashes (or store is stopped by server admin tool)
          throw new StateTransitionException("Store " + partitionName + " is not started", StoreNotStarted);
        }
      } else {
        throw new StateTransitionException("Replica " + partitionName + " is not found on current node",
            ReplicaNotFound);
      }
    }
Constructor
@param isPrimaryClusterManagerListener Indicates whether it's a listener object for primary helix cluster-manager
ambry-store/src/main/java/com/github/ambry/store/StorageManager.java