private CompactionPolicySwitchInfo getCompactionPolicySwitchInfo(String storeId, String dataDir,
      BlobStoreStats blobStoreStats) {
    if (!blobToCompactionPolicySwitchInfoMap.containsKey(storeId)) {
      File file = new File(dataDir, COMPACT_POLICY_INFO_FILE_NAME_V2);
      File oldFile = new File(dataDir, COMPACT_POLICY_INFO_FILE_NAME);
      if (oldFile.exists()) {
        if (!oldFile.delete()) {
          logger.error("Old compact policy info file has not been successfully deleted in dataDir: {}", dataDir);
        }
      }
      if (file.exists()) {
        CompactionPolicySwitchInfo compactionPolicySwitchInfo = recoverCompactionPolicySwitchInfo(file, blobStoreStats);
        blobToCompactionPolicySwitchInfoMap.put(storeId, compactionPolicySwitchInfo);
      } else {
        //Randomly start compactAllPolicy after deployment.
        blobToCompactionPolicySwitchInfoMap.put(storeId, new CompactionPolicySwitchInfo(
            INIT_COMPACT_ALL_TIME - TimeUnit.DAYS.toMillis(random.nextInt(DELTA_TIME_IN_DAYS)), false));
      }
    }
    return blobToCompactionPolicySwitchInfoMap.get(storeId);
  }
Get the CompactionPolicySwitchInfo from file or blobToCompactionPolicySwitchInfoMap.
@param dataDir The directory to store the file.
@param storeId id of the BlobStore
@return {@link CompactionPolicySwitchInfo} gets from map or recover from file if needed.
ambry-store/src/main/java/com/github/ambry/store/HybridCompactionPolicy.java