@RestrictedApi(explanation = "Should only be called in TestHStore", link = "",
      allowedOnPath = ".*/(HStore|TestHStore).java")
  void replaceStoreFiles(Collection<HStoreFile> compactedFiles, Collection<HStoreFile> result,
    boolean writeCompactionMarker) throws IOException {
    storeEngine.replaceStoreFiles(compactedFiles, result, () -> {
      if (writeCompactionMarker) {
        writeCompactionWalRecord(compactedFiles, result);
      }
    }, () -> {
      synchronized (filesCompacting) {
        filesCompacting.removeAll(compactedFiles);
      }
    });
    // These may be null when the RS is shutting down. The space quota Chores will fix the Region
    // sizes later so it's not super-critical if we miss these.
    RegionServerServices rsServices = region.getRegionServerServices();
    if (rsServices != null && rsServices.getRegionServerSpaceQuotaManager() != null) {
      updateSpaceQuotaAfterFileReplacement(
        rsServices.getRegionServerSpaceQuotaManager().getRegionSizeStore(), getRegionInfo(),
        compactedFiles, result);
    }
  }
Writes the compaction WAL record.
@param filesCompacted Files compacted (input).
@param newFiles       Files from compaction.
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java