private static void archive(Configuration conf, FileSystem fs, RegionInfo regionInfo,
    byte[] family, Collection<HStoreFile> compactedFiles, Path storeArchiveDir) throws IOException {
    // sometimes in testing, we don't have rss, so we need to check for that
    if (fs == null) {
      LOG.warn(
        "Passed filesystem is null, so just deleting files without archiving for {}," + "family={}",
        Bytes.toString(regionInfo.getRegionName()), Bytes.toString(family));
      deleteStoreFilesWithoutArchiving(compactedFiles);
      return;
    }

    // short circuit if we don't have any files to delete
    if (compactedFiles.isEmpty()) {
      LOG.debug("No files to dispose of, done!");
      return;
    }

    // build the archive path
    if (regionInfo == null || family == null)
      throw new IOException("Need to have a region and a family to archive from.");
    // make sure we don't archive if we can't and that the archive dir exists
    if (!fs.mkdirs(storeArchiveDir)) {
      throw new IOException("Could not make archive directory (" + storeArchiveDir + ") for store:"
        + Bytes.toString(family) + ", deleting compacted files instead.");
    }

    // otherwise we attempt to archive the store files
    LOG.debug("Archiving compacted files.");

    // Wrap the storefile into a File
    StoreToFile getStorePath = new StoreToFile(fs);
    Collection<File> storeFiles =
      compactedFiles.stream().map(getStorePath).collect(Collectors.toList());

    // do the actual archive
    List<File> failedArchive = resolveAndArchive(conf, fs, storeArchiveDir, storeFiles,
      EnvironmentEdgeManager.currentTime());

    if (!failedArchive.isEmpty()) {
      throw new FailedArchiveException(
        "Failed to archive/delete all the files for region:"
          + Bytes.toString(regionInfo.getRegionName()) + ", family:" + Bytes.toString(family)
          + " into " + storeArchiveDir + ". Something is probably awry on the filesystem.",
        failedArchive.stream().map(FUNC_FILE_TO_PATH).collect(Collectors.toList()));
    }
  }
Archive recovered edits using existing logic for archiving store files. This is currently only
relevant when <b>hbase.region.archive.recovered.edits</b> is true, as recovered edits shouldn't
be kept after replay. In theory, we could use very same method available for archiving store
files, but supporting WAL dir and store files on different FileSystems added the need for extra
validation of the passed FileSystem instance and the path where the archiving edits should be
placed.
@param conf          {@link Configuration} to determine the archive directory.
@param fs            the filesystem used for storing WAL files.
@param regionInfo    {@link RegionInfo} a pseudo region representation for the archiving logic.
@param family        a pseudo familiy representation for the archiving logic.
@param replayedEdits the recovered edits to be archived.
@throws IOException if files can't be achived due to some internal error.
hbase-server/src/main/java/org/apache/hadoop/hbase/backup/HFileArchiver.java