code: @Override
    public DatanodeDescriptor chooseReplicaToDelete(FSInodeInfo inode,
        Block block, short replicationFactor,
        Collection<DatanodeDescriptor> first,
        Collection<DatanodeDescriptor> second) {
  
      DatanodeDescriptor chosenNode = null;
      try {
        String path = getFullPathName(inode);
        FileInfo info = getFileInfo(inode, path);
        if (info.type == FileType.NOT_RAID) {
          return super.chooseReplicaToDelete(
              inode, block, replicationFactor, first, second);
        }
        List<LocatedBlock> companionBlocks =
            getCompanionBlocks(path, info, block, inode);
        if (companionBlocks == null || companionBlocks.size() == 0) {
          // Use the default method if it is not a valid raided or parity file
          return super.chooseReplicaToDelete(
              inode, block, replicationFactor, first, second);
        }
        // Delete from the first collection first
        // This ensures the number of unique rack of this block is not reduced
        Collection<DatanodeDescriptor> all = new HashSet<DatanodeDescriptor>();
        all.addAll(first);
        all.addAll(second);
        chosenNode = chooseReplicaToDelete(companionBlocks, all);
        if (chosenNode != null) {
          return chosenNode;
        }
        return super.chooseReplicaToDelete(
            inode, block, replicationFactor, first, second);
      } catch (Exception e) {
        LOG.debug("Failed to choose the correct replica to delete", e);
        return super.chooseReplicaToDelete(
            inode, block, replicationFactor, first, second);
      }
    }
docs: {@inheritDoc}