@Override
  protected List<StoreFileInfo> doLoadStoreFiles(boolean readOnly) throws IOException {
    StoreFileList list = backedFile.load(readOnly);
    if (LOG.isTraceEnabled()) {
      LOG.trace("Loaded file list backed file, containing " + list.getStoreFileList().size()
        + " store file entries");
    }
    if (list == null) {
      return Collections.emptyList();
    }
    FileSystem fs = ctx.getRegionFileSystem().getFileSystem();
    List<StoreFileInfo> infos = new ArrayList<>();
    for (StoreFileEntry entry : list.getStoreFileList()) {
      infos.add(ServerRegionReplicaUtil.getStoreFileInfo(conf, fs, ctx.getRegionInfo(),
        ctx.getRegionFileSystem().getRegionInfoForFS(), ctx.getFamily().getNameAsString(),
        new Path(ctx.getFamilyStoreDirectoryPath(), entry.getName()), this));
    }
    // In general, for primary replica, the load method should only be called once when
    // initialization, so we do not need synchronized here. And for secondary replicas, though the
    // load method could be called multiple times, we will never call other methods so no
    // synchronized is also fine.
    // But we have a refreshStoreFiles method in the Region interface, which can be called by CPs,
    // and we have a RefreshHFilesEndpoint example to expose the refreshStoreFiles method as RPC, so
    // for safety, let's still keep the synchronized here.
    synchronized (storefiles) {
      for (StoreFileInfo info : infos) {
        storefiles.put(info.getPath().getName(), info);
      }
    }
    return infos;
  }
A file based store file tracker.
<p/>
For this tracking way, the store file list will be persistent into a file, so we can write the
new store files directly to the final data directory, as we will not load the broken files. This
will greatly reduce the time for flush and compaction on some object storages as a rename is
actual a copy on them. And it also avoid listing when loading store file list, which could also
speed up the loading of store files as listing is also not a fast operation on most object
storages.
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/storefiletracker/FileBasedStoreFileTracker.java