@Override
  public void snapshotRegions(List<Pair<RegionInfo, ServerName>> regionsAndLocations)
    throws IOException, KeeperException {
    try {
      // 1. get all the regions hosting this table.

      // extract each pair to separate lists
      Set<RegionInfo> regions = new HashSet<>();
      for (Pair<RegionInfo, ServerName> p : regionsAndLocations) {
        // Don't include non-default regions
        RegionInfo hri = p.getFirst();
        if (RegionReplicaUtil.isDefaultReplica(hri)) {
          regions.add(hri);
        }
      }
      // handle the mob files if any.
      boolean mobEnabled = MobUtils.hasMobColumns(htd);
      if (mobEnabled) {
        // snapshot the mob files as a offline region.
        RegionInfo mobRegionInfo = MobUtils.getMobRegionInfo(htd.getTableName());
        regions.add(mobRegionInfo);
      }

      // 2. for each region, write all the info to disk
      String msg = "Starting to write region info and WALs for regions for offline snapshot:"
        + ClientSnapshotDescriptionUtils.toString(snapshot);
      LOG.info(msg);
      status.setStatus(msg);

      ThreadPoolExecutor exec = SnapshotManifest.createExecutor(conf, "DisabledTableSnapshot");
      try {
        ModifyRegionUtils.editRegions(exec, regions, new ModifyRegionUtils.RegionEditTask() {
          @Override
          public void editRegion(final RegionInfo regionInfo) throws IOException {
            snapshotManifest.addRegion(CommonFSUtils.getTableDir(rootDir, snapshotTable),
              regionInfo);
          }
        });
      } finally {
        exec.shutdown();
      }
    } catch (Exception e) {
      // make sure we capture the exception to propagate back to the client later
      String reason = "Failed snapshot " + ClientSnapshotDescriptionUtils.toString(snapshot)
        + " due to exception:" + e.getMessage();
      ForeignException ee = new ForeignException(reason, e);
      monitor.receive(ee);
      status.abort("Snapshot of table: " + snapshotTable + " failed because " + e.getMessage());
    } finally {
      LOG.debug(
        "Marking snapshot" + ClientSnapshotDescriptionUtils.toString(snapshot) + " as finished.");
    }
  }
@param snapshot       descriptor of the snapshot to take
@param masterServices master services provider
@throws IOException if it cannot access the filesystem of the snapshot temporary directory
hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/DisabledTableSnapshotHandler.java