code: private boolean isGoodReplica(DatanodeDescriptor node, Block block) {
      Collection<Block> excessBlocks =
        excessReplicateMap.get(node.getStorageID());
      Collection<DatanodeDescriptor> nodesCorrupt = corruptReplicas.getNodes(block);
      return (nodesCorrupt == null || !nodesCorrupt.contains(node)) // not corrupt
          // not over scheduling for replication
          && (node.getNumberOfBlocksToBeReplicated() < maxReplicationStreams)
          // not alredy scheduled for removal
          && (excessBlocks == null || !excessBlocks.contains(block))
          && !node.isDecommissioned(); // not decommissioned
    }
docs: Decide if a replica is valid
  @param node datanode the block is located
  @param block a block
  @return true if a replica is valid