private void addRegionToSnapshot(SnapshotProtos.SnapshotDescription snapshot, HRegion region,
    SnapshotManifest manifest) throws Exception {
    LOG.info("Adding region to snapshot: " + region.getRegionInfo().getRegionNameAsString());
    Path workingDir = SnapshotDescriptionUtils.getWorkingSnapshotDir(snapshot, rootDir, conf);
    SnapshotManifest.RegionVisitor visitor = createRegionVisitorWithDelay(snapshot, workingDir);
    manifest.addRegion(region, visitor);
    LOG.info("Added the region to snapshot: " + region.getRegionInfo().getRegionNameAsString());
  }
Tests adding a region to the snapshot manifest while compactions are running on the region. The
idea is to slow down the process of adding a store file to the manifest while triggering
compactions on the region, allowing the store files to be marked for archival while snapshot
operation is running. This test checks for the correct behavior in such a case that the
compacted files should not be moved around if a snapshot operation is in progress. See
HBASE-18398
hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestRegionSnapshotTask.java