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);
      }
    }
  }
Back up compactionPolicySwitchInfo to file in tempDir.
@param tempDir the dir which stores the compactionPolicySwitchInfo file
@param compactionPolicySwitchInfo the {@link CompactionPolicySwitchInfo} which contains the info for compaction policy switching.
ambry-store/src/test/java/com/github/ambry/store/IndexTest.java