@Test
  public void testDisableSnapshotAndNotDeleteBackReference() throws Exception {
    Configuration conf = new Configuration();
    conf.setBoolean(SnapshotManager.HBASE_SNAPSHOT_ENABLED, false);
    SnapshotManager manager = getNewManager(conf);
    String cleaners = conf.get(HFileCleaner.MASTER_HFILE_CLEANER_PLUGINS);
    assertTrue(cleaners != null && cleaners.contains(HFileLinkCleaner.class.getName()));
    Path rootDir = UTIL.getDataTestDir();
    CommonFSUtils.setRootDir(conf, rootDir);

    TableName tableName = TableName.valueOf(name.getMethodName());
    TableName tableLinkName = TableName.valueOf(name.getMethodName() + "-link");
    String hfileName = "1234567890";
    String familyName = "cf";
    RegionInfo hri = RegionInfoBuilder.newBuilder(tableName).build();
    RegionInfo hriLink = RegionInfoBuilder.newBuilder(tableLinkName).build();
    Path archiveDir = HFileArchiveUtil.getArchivePath(conf);
    Path archiveStoreDir =
      HFileArchiveUtil.getStoreArchivePath(conf, tableName, hri.getEncodedName(), familyName);

    // Create hfile /hbase/table-link/region/cf/getEncodedName.HFILE(conf);
    Path familyPath = getFamilyDirPath(archiveDir, tableName, hri.getEncodedName(), familyName);
    Path hfilePath = new Path(familyPath, hfileName);
    fs.createNewFile(hfilePath);
    // Create link to hfile
    HRegionFileSystem regionFS = HRegionFileSystem.create(conf, fs,
      CommonFSUtils.getTableDir(rootDir, tableLinkName), hriLink);
    StoreFileTracker sft = StoreFileTrackerFactory.create(conf, true,
      StoreContext.getBuilder()
        .withFamilyStoreDirectoryPath(new Path(regionFS.getRegionDir(), familyName))
        .withColumnFamilyDescriptor(ColumnFamilyDescriptorBuilder.of(familyName))
        .withRegionFileSystem(regionFS).build());
    sft.createHFileLink(hri.getTable(), hri.getEncodedName(), hfileName, true);
    Path linkBackRefDir = HFileLink.getBackReferencesDir(archiveStoreDir, hfileName);
    assertTrue(fs.exists(linkBackRefDir));
    FileStatus[] backRefs = fs.listStatus(linkBackRefDir);
    assertEquals(1, backRefs.length);
    Path linkBackRef = backRefs[0].getPath();

    // Initialize cleaner
    HFileCleaner cleaner = new HFileCleaner(10000, Mockito.mock(Stoppable.class), conf, fs,
      archiveDir, DirScanPool.getHFileCleanerScanPool(conf));
    // Link backref and HFile cannot be removed
    cleaner.choreForTesting();
    assertTrue(fs.exists(linkBackRef));
    assertTrue(fs.exists(hfilePath));

    fs.rename(CommonFSUtils.getTableDir(rootDir, tableLinkName),
      CommonFSUtils.getTableDir(archiveDir, tableLinkName));
    // Link backref can be removed
    cleaner.choreForTesting();
    assertFalse("Link should be deleted", fs.exists(linkBackRef));
    // HFile can be removed
    cleaner.choreForTesting();
    assertFalse("HFile should be deleted", fs.exists(hfilePath));
  }
Verify the snapshot support based on the configuration.
hbase-server/src/test/java/org/apache/hadoop/hbase/master/snapshot/TestSnapshotManager.java