@Override
  public int copy(BackupInfo context, BackupManager backupManager, Configuration conf,
    BackupType copyType, String[] options) throws IOException {
    int res = 0;

    try {
      if (copyType == BackupType.FULL) {
        SnapshotCopy snapshotCp = new SnapshotCopy(context, context.getTableBySnapshot(options[1]));
        LOG.debug("Doing SNAPSHOT_COPY");
        // Make a new instance of conf to be used by the snapshot copy class.
        snapshotCp.setConf(new Configuration(conf));
        res = snapshotCp.run(options);

      } else if (copyType == BackupType.INCREMENTAL) {
        LOG.debug("Doing COPY_TYPE_DISTCP");
        setSubTaskPercntgInWholeTask(1f);

        BackupDistCp distcp =
          new BackupDistCp(new Configuration(conf), null, context, backupManager);
        // Handle a special case where the source file is a single file.
        // In this case, distcp will not create the target dir. It just take the
        // target as a file name and copy source file to the target (as a file name).
        // We need to create the target dir before run distcp.
        LOG.debug("DistCp options: " + Arrays.toString(options));
        Path dest = new Path(options[options.length - 1]);
        String[] newOptions = new String[options.length + 1];
        System.arraycopy(options, 0, newOptions, 1, options.length);
        newOptions[0] = "-async"; // run DisCp in async mode
        FileSystem destfs = dest.getFileSystem(conf);
        if (!destfs.exists(dest)) {
          destfs.mkdirs(dest);
        }

        List<String> distCpOptionsFromConf = parseDistCpOptions(conf);
        String[] finalOptions = new String[newOptions.length + distCpOptionsFromConf.size()];
        for (int i = 0; i < distCpOptionsFromConf.size(); i++) {
          finalOptions[i] = distCpOptionsFromConf.get(i);
        }
        System.arraycopy(newOptions, 0, finalOptions, distCpOptionsFromConf.size(),
          newOptions.length);
        res = distcp.run(finalOptions);
      }
      return res;

    } catch (Exception e) {
      throw new IOException(e);
    }
  }
Do backup copy based on different types.
@param context  The backup info
@param conf     The hadoop configuration
@param copyType The backup copy type
@param options  Options for customized ExportSnapshot or DistCp
@throws IOException exception
hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/mapreduce/MapReduceBackupCopyJob.java