private static void ensureArchiveDirectoryExists(FileSystem fs, Path baseArchiveDir)
    throws IOException {
    if (!fs.exists(baseArchiveDir) && !fs.mkdirs(baseArchiveDir)) {
      throw new IOException("Failed to create the archive directory: " + baseArchiveDir);
    }
    LOG.trace("Archive directory ready: {}", baseArchiveDir);
  }
Resolve any conflict with an existing archive file via timestamp-append renaming of the
existing file and then archive the passed in files.
@param fs             {@link FileSystem} on which to archive the files
@param baseArchiveDir base archive directory to store the files. If any of the files to archive
                      are directories, will append the name of the directory to the base
                      archive directory name, creating a parallel structure.
@param toArchive      files/directories that need to be archvied
@param start          time the archiving started - used for resolving archive conflicts.
@return the list of failed to archive files.
@throws IOException if an unexpected file operation exception occurred
hbase-server/src/main/java/org/apache/hadoop/hbase/backup/HFileArchiver.java