Source:
public void onPartitionBecomeInactiveFromStandby(String partitionName) { ReplicaId replica = partitionNameToReplicaId.get(partitionName); 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.disabledOnError()) { throw new StateTransitionException("Store " + partitionName + " is disabled due to I/O error", ReplicaOperationFailure); } else { File decommissionFile = new File(replica.getReplicaPath(), BlobStore.DECOMMISSION_FILE_NAME); try { if (!decommissionFile.exists()) { 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()) { localStore.setCurrentState(ReplicaState.INACTIVE); logger.info("Store is set to INACTIVE", partitionName); if (!controlCompactionForBlobStore(replica.getPartitionId(), false)) { logger.error("Failed to disable compaction on store {}", partitionName); throw new StateTransitionException("Couldn't disable compaction on replica " + replica.getReplicaPath(), ReplicaNotFound); } logger.info("Compaction is successfully disabled on store {}", partitionName); } else { throw new StateTransitionException("Store " + partitionName + " is not started", StoreNotStarted); } } } else { throw new StateTransitionException("Replica " + partitionName + " is not found on current node", ReplicaNotFound); } }

Target:
public void onPartitionBecomeInactiveFromStandby(String partitionName) { ReplicaId replica = partitionNameToReplicaId.get(partitionName); 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.disabledOnError()) { throw new StateTransitionException("Store " + partitionName + " is disabled due to I/O error", ReplicaOperationFailure); } File decommissionFile = new File(replica.getReplicaPath(), BlobStore.DECOMMISSION_FILE_NAME); try { if (!decommissionFile.exists()) { 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()) { localStore.setCurrentState(ReplicaState.INACTIVE); logger.info("Store is set to INACTIVE", partitionName); if (!controlCompactionForBlobStore(replica.getPartitionId(), false)) { logger.error("Failed to disable compaction on store {}", partitionName); throw new StateTransitionException("Couldn't disable compaction on replica " + replica.getReplicaPath(), ReplicaNotFound); } logger.info("Compaction is successfully disabled on store {}", partitionName); } else { throw new StateTransitionException("Store " + partitionName + " is not started", StoreNotStarted); } } else { throw new StateTransitionException("Replica " + partitionName + " is not found on current node", ReplicaNotFound); } }