@Override
  public List<BackupInfo> getHistory(int n, BackupInfo.Filter... filters) throws IOException {
    if (filters.length == 0) {
      return getHistory(n);
    }

    try (final BackupSystemTable table = new BackupSystemTable(conn)) {
      List<BackupInfo> history = table.getBackupHistory();
      List<BackupInfo> result = new ArrayList<>();
      for (BackupInfo bi : history) {
        if (result.size() == n) {
          break;
        }

        boolean passed = true;
        for (int i = 0; i < filters.length; i++) {
          if (!filters[i].apply(bi)) {
            passed = false;
            break;
          }
        }
        if (passed) {
          result.add(bi);
        }
      }
      return result;
    }
  }
Clean up the data at target directory
@throws IOException if cleaning up the backup directory fails
hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupAdminImpl.java