@InterfaceAudience.Private
  @VisibleForTesting
  int scanActiveLogs() throws IOException {
    long startTime = Time.monotonicNow();
    // Store the Last Processed Time and Offset
    if (recoveryEnabled && appIdLogMap.size() > 0) {

      try (FSDataOutputStream checkPointStream = fs.create(checkpointFile, true)) {

        storeLogFiles(appIdLogMap.values(), checkPointStream);

      } catch (Exception e) {
        LOG.warn("Failed to checkpoint the summarylog files", e);
      }
    }
    int logsToScanCount = scanActiveLogs(activeRootPath);
    metrics.addActiveLogDirScanTime(Time.monotonicNow() - startTime);
    return logsToScanCount;
  }
@Test
  void testScanActiveLogsWithInvalidFile() throws Exception {
    Path invalidFile = new Path(testActiveDirPath, "invalidfile");
    try {
      if (!fs.exists(invalidFile)) {
        fs.createNewFile(invalidFile);
      }
      store.scanActiveLogs();
    } catch (StackOverflowError error) {
      fail("EntityLogScanner crashed with StackOverflowError");
    } finally {
      if (fs.exists(invalidFile)) {
        fs.delete(invalidFile, false);
      }
    }
  }