@Override
  protected void chore() {
    for (Region r : regionServer.getOnlineRegionsLocalContext()) {
      if (
        !r.isReadOnly() || r.getRegionInfo().getReplicaId() == RegionInfo.DEFAULT_REPLICA_ID
          || r.getTableDescriptor().isReadOnly()
      ) {
        // Skip checking for this region if it can accept writes.
        // The refresher is only for refreshing secondary replicas. And if the table is readonly,
        // meaning no writes to the primary replica, skip checking the secondary replicas as well.
        continue;
      }
      // don't refresh unless enabled for all files, or it the meta region
      // meta region don't have WAL replication for replicas enabled yet
      if (onlyMetaRefresh && !r.getRegionInfo().isMetaRegion()) continue;
      String encodedName = r.getRegionInfo().getEncodedName();
      long time = EnvironmentEdgeManager.currentTime();
      if (!lastRefreshTimes.containsKey(encodedName)) {
        lastRefreshTimes.put(encodedName, time);
      }
      try {
        for (Store store : r.getStores()) {
          // TODO: some stores might see new data from flush, while others do not which
          // MIGHT break atomic edits across column families. We can fix this with setting
          // mvcc read numbers that we know every store has seen
          store.refreshStoreFiles();
        }
      } catch (IOException ex) {
        LOG.warn("Exception while trying to refresh store files for region:" + r.getRegionInfo()
          + ", exception:" + StringUtils.stringifyException(ex));

        // Store files have a TTL in the archive directory. If we fail to refresh for that long, we
        // stop serving reads
        if (isRegionStale(encodedName, time)) {
          ((HRegion) r).setReadsEnabled(false); // stop serving reads
        }
        continue;
      }
      lastRefreshTimes.put(encodedName, time);
      ((HRegion) r).setReadsEnabled(true); // restart serving reads
    }

    // remove closed regions
    Iterator<String> lastRefreshTimesIter = lastRefreshTimes.keySet().iterator();
    while (lastRefreshTimesIter.hasNext()) {
      String encodedName = lastRefreshTimesIter.next();
      if (regionServer.getRegion(encodedName) == null) {
        lastRefreshTimesIter.remove();
      }
    }
  }
Whether all storefiles should be refreshed, as opposed to just hbase:meta's Meta region doesn't
have WAL replication for replicas enabled yet
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StorefileRefresherChore.java