public static StoreFileInfo getStoreFileInfo(Configuration conf, FileSystem fs,
    RegionInfo regionInfo, RegionInfo regionInfoForFs, String familyName, Path path,
    StoreFileTracker tracker) throws IOException {

    // if this is a primary region, just return the StoreFileInfo constructed from path
    if (RegionInfo.COMPARATOR.compare(regionInfo, regionInfoForFs) == 0) {
      return tracker.getStoreFileInfo(path, true);
    }

    // else create a store file link. The link file does not exists on filesystem though.
    if (HFileLink.isHFileLink(path) || StoreFileInfo.isHFile(path)) {
      HFileLink link = HFileLink.build(conf, regionInfoForFs.getTable(),
        regionInfoForFs.getEncodedName(), familyName, path.getName());
      return new StoreFileInfo(conf, fs, link.getFileStatus(fs), link);
    } else if (StoreFileInfo.isReference(path)) {
      Reference reference = tracker.readReference(path);
      Path referencePath = StoreFileInfo.getReferredToFile(path);
      if (HFileLink.isHFileLink(referencePath)) {
        // HFileLink Reference
        HFileLink link = HFileLink.buildFromHFileLinkPattern(conf, referencePath);
        return new StoreFileInfo(conf, fs, link.getFileStatus(fs), reference, link);
      } else {
        // Reference
        HFileLink link = HFileLink.build(conf, regionInfoForFs.getTable(),
          regionInfoForFs.getEncodedName(), familyName, path.getName());
        return new StoreFileInfo(conf, fs, link.getFileStatus(fs), reference);
      }
    } else {
      throw new IOException("path=" + path + " doesn't look like a valid StoreFile");
    }
  }
Returns a StoreFileInfo from the given FileStatus. Secondary replicas refer to the files of the
primary region, so an HFileLink is used to construct the StoreFileInfo. This way ensures that
the secondary will be able to continue reading the store files even if they are moved to
archive after compaction
hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java