private long countMobCellsInMetadata() throws IOException {
    long mobCellsCount = 0;
    Path mobDirPath = MobUtils.getMobFamilyPath(conf, tableDescriptor.getTableName(),
      familyDescriptor.getNameAsString());
    Configuration copyOfConf = new Configuration(conf);
    copyOfConf.setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0f);
    CacheConfig cacheConfig = new CacheConfig(copyOfConf);
    if (fs.exists(mobDirPath)) {
      // TODO: use sft.load() api here
      HRegionFileSystem regionFs = HRegionFileSystem.create(copyOfConf, fs,
        MobUtils.getMobTableDir(copyOfConf, tableDescriptor.getTableName()),
        region.getRegionInfo());
      StoreFileTracker sft = StoreFileTrackerFactory.create(copyOfConf, false,
        StoreContext.getBuilder().withColumnFamilyDescriptor(familyDescriptor)
          .withFamilyStoreDirectoryPath(mobDirPath).withCacheConfig(cacheConfig)
          .withRegionFileSystem(regionFs).build());
      FileStatus[] files = UTIL.getTestFileSystem().listStatus(mobDirPath);
      for (FileStatus file : files) {
        HStoreFile sf =
          new HStoreFile(fs, file.getPath(), conf, cacheConfig, BloomType.NONE, true, sft);
        sf.initReader();
        Map<byte[], byte[]> fileInfo = sf.getReader().loadFileInfo();
        byte[] count = fileInfo.get(MOB_CELLS_COUNT);
        assertTrue(count != null);
        mobCellsCount += Bytes.toLong(count);
      }
    }
    return mobCellsCount;
  }
This test will first generate store files, then bulk load them and trigger the compaction. When
compaction, the cell value will be larger than the threshold.
hbase-server/src/test/java/org/apache/hadoop/hbase/mob/TestMobStoreCompaction.java