private void backUpCompactionPolicyInfo(String tempDir, CompactionPolicySwitchInfo compactionPolicySwitchInfo) {
    if (tempDir != null) {
      File tempFile = new File(tempDir, COMPACT_POLICY_INFO_FILE_NAME_V2 + ".temp");
      try {
        tempFile.createNewFile();
        objectMapper.writerWithDefaultPrettyPrinter().writeValue(tempFile, compactionPolicySwitchInfo);
        tempFile.renameTo(new File(tempDir, COMPACT_POLICY_INFO_FILE_NAME_V2));
      } catch (IOException e) {
        logger.error("Exception while store compaction policy info for local report. Output file path - {}",
            tempFile.getAbsolutePath(), e);
      }
    }
  }
Compacts the {@code segmentsUnderCompaction} and verifies sanity of store and data.
@param segmentsUnderCompaction the names of the log segments under compaction.
@param deleteReferenceTimeMs the reference time in ms to use to decide whether deletes are valid.
@param changeExpected {@code true} if compaction will cause a change in size of data. {@code false} otherwise.
@throws Exception
ambry-store/src/test/java/com/github/ambry/store/BlobStoreCompactorTest.java