@Test
  public void testIsStoreFileSizeMatchFilesystemAndManifest() throws IOException {
    admin = UTIL.getAdmin();
    fs = UTIL.getTestFileSystem();
    UTIL.createTable(TABLE_NAME, FAMILY_NAME.getBytes());
    Table table = admin.getConnection().getTable(TABLE_NAME);
    UTIL.loadRandomRows(table, FAMILY_NAME.getBytes(), 3, 1000);
    admin.snapshot(SNAPSHOT_NAME, TABLE_NAME);

    Map<String, Long> storeFileInfoFromManifest = new HashMap<String, Long>();
    Map<String, Long> storeFileInfoFromFS = new HashMap<String, Long>();
    String storeFileName = "";
    long storeFilesize = 0L;
    Path snapshotDir =
      SnapshotDescriptionUtils.getCompletedSnapshotDir(SNAPSHOT_NAME, UTIL.getDefaultRootDirPath());
    SnapshotDescription snapshotDesc = SnapshotDescriptionUtils.readSnapshotInfo(fs, snapshotDir);
    SnapshotManifest snaphotManifest = SnapshotManifest.open(conf, fs, snapshotDir, snapshotDesc);
    List<SnapshotRegionManifest> regionManifest = snaphotManifest.getRegionManifests();
    for (int i = 0; i < regionManifest.size(); i++) {
      SnapshotRegionManifest.FamilyFiles family = regionManifest.get(i).getFamilyFiles(0);
      List<SnapshotRegionManifest.StoreFile> storeFiles = family.getStoreFilesList();
      for (int j = 0; j < storeFiles.size(); j++) {
        storeFileName = storeFiles.get(j).getName();
        storeFilesize = storeFiles.get(j).getFileSize();
        storeFileInfoFromManifest.put(storeFileName, storeFilesize);
      }
    }
    List<RegionInfo> regionsInfo = admin.getRegions(TABLE_NAME);
    Path path = CommonFSUtils.getTableDir(UTIL.getDefaultRootDirPath(), TABLE_NAME);
    for (RegionInfo regionInfo : regionsInfo) {
      HRegionFileSystem hRegionFileSystem =
        HRegionFileSystem.openRegionFromFileSystem(conf, fs, path, regionInfo, true);
      ColumnFamilyDescriptor hcd = ColumnFamilyDescriptorBuilder.of(FAMILY_NAME);
      StoreFileTracker sft =
        StoreFileTrackerFactory.create(conf, table.getDescriptor(), hcd, hRegionFileSystem);
      Collection<StoreFileInfo> storeFilesFS = sft.load();
      Iterator<StoreFileInfo> sfIterator = storeFilesFS.iterator();
      while (sfIterator.hasNext()) {
        StoreFileInfo sfi = sfIterator.next();
        FileStatus[] fileStatus = CommonFSUtils.listStatus(fs, sfi.getPath());
        storeFileName = fileStatus[0].getPath().getName();
        storeFilesize = fileStatus[0].getLen();
        storeFileInfoFromFS.put(storeFileName, storeFilesize);
      }
    }
    Assert.assertEquals(storeFileInfoFromManifest, storeFileInfoFromFS);
  }
Validate if storefile length match both snapshop manifest and filesystem.
hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestSnapshotStoreFileSize.java