/**
  * Scans old directories known by the idToDateString map for the specified jobId. If the number of
  * directories is higher than the supported size of the idToDateString cache, the jobId will not
  * be found.
  *
  * @param jobId the jobId.
  * @return
  * @throws IOException
  */
 private HistoryFileInfo scanOldDirsForJob(JobId jobId) throws IOException {
   String boxedSerialNumber =
       JobHistoryUtils.serialNumberDirectoryComponent(jobId, serialNumberFormat);
   Set<String> dateStringSet = serialNumberIndex.get(boxedSerialNumber);
   if (dateStringSet == null) {
     return null;
   }
   for (String timestampPart : dateStringSet) {
     Path logDir = canonicalHistoryLogPath(jobId, timestampPart);
     List<FileStatus> fileStatusList = scanDirectoryForHistoryFiles(logDir, doneDirFc);
     HistoryFileInfo fileInfo = getJobFileInfo(fileStatusList, jobId);
     if (fileInfo != null) {
       return fileInfo;
     }
   }
   return null;
 }