Collection<Account> getLatestAccounts(long latestTimeAllowedInSecond) {
    if (backupDirPath == null) {
      return null;
    }
    Map.Entry<Integer, BackupFileInfo> entry = backupFileInfos.lastEntry();
    if (entry == null) {
      logger.warn("No backup file found");
      return null;
    }
    if (entry.getKey() < 0) {
      // This is a backup file without version number.
      // It's very hard to deserialize the bytes to a map, so just return null;
      logger.warn("Latest backup is in old format that doesn't have version number");
      return null;
    }
    BackupFileInfo backupFileInfo = entry.getValue();
    if (backupFileInfo.getModifiedTimeInSecond() < latestTimeAllowedInSecond) {
      logger.warn("The latest backup was changed at timestamp: {}, but the requested time is {}",
          backupFileInfo.getModifiedTimeInSecond(), latestTimeAllowedInSecond);
      return null;
    }

    Path filepath = backupDirPath.resolve(backupFileInfo.getFilename());
    try {
      long startTimeInMs = System.currentTimeMillis();
      byte[] bytes = Files.readAllBytes(filepath);
      accountServiceMetrics.backupReadTimeInMs.update(System.currentTimeMillis() - startTimeInMs);
      return deserializeAccounts(bytes);
    } catch (IOException e) {
      accountServiceMetrics.backupErrorCount.inc();
      logger.error("Failed to read all bytes out from file {} {}", filepath, e.getMessage());
      return null;
    }
  }
Return the account map persisted in the latest backup file, but prior to the given {@param afterTimeInSecond}.
If the latest backup file is older then the given timetamp, then return null. This is to prevent that caller of
this function load up a out-of-date account map from the backup file.
<p>
  If data from the latest backup is corrupted, then this function returns null;
</p>
@param latestTimeAllowedInSecond The unix epoch time which the latest backup's modifiedTime must be greater than.
@return The account map from the latest backup file.
ambry-account/src/main/java/com/github/ambry/account/BackupFileManager.java