LogAggregationIndexedFileController extends LogAggregationFileController { @Private @VisibleForTesting public long getRollOverLogMaxSize(Configuration conf) { boolean supportAppend = false; try { FileSystem fs = FileSystem.get(remoteRootLogDir.toUri(), conf); if (fs instanceof LocalFileSystem || fs.hasPathCapability( remoteRootLogDir, CommonPathCapabilities.FS_APPEND)) { supportAppend = true; } } catch (Exception ioe) { LOG.warn("Unable to determine if the filesystem supports " + "append operation", ioe); } if (supportAppend) { return 1024L * 1024 * 1024 * conf.getInt( LOG_ROLL_OVER_MAX_FILE_SIZE_GB, LOG_ROLL_OVER_MAX_FILE_SIZE_GB_DEFAULT); } else { return 0L; } } LogAggregationIndexedFileController(); @Override void initInternal(Configuration conf); @Override void initializeWriter(
      final LogAggregationFileControllerContext context); @Override void closeWriter(); @Override void write(LogKey logKey, LogValue logValue); @Override void postWrite(LogAggregationFileControllerContext record); @Override boolean readAggregatedLogs(ContainerLogsRequest logRequest,
      OutputStream os); @Override List<ContainerLogMeta> readAggregatedLogsMeta(
      ContainerLogsRequest logRequest); @Private Map<String, Long> parseCheckSumFiles(
      List<FileStatus> fileList); @Private List<FileStatus> getNodeLogFileToRead(
      List<FileStatus> nodeFiles, String nodeId, ApplicationId appId); @Private FileStatus getAllChecksumFiles(Map<String, FileStatus> fileMap,
      String fileName); @Override void renderAggregatedLogsBlock(Block html, ViewContext context); @Override String getApplicationOwner(Path aggregatedLogPath,
      ApplicationId appId); @Override Map<ApplicationAccessType, String> getApplicationAcls(
      Path aggregatedLogPath, ApplicationId appId); @Override Path getRemoteAppLogDir(ApplicationId appId, String user); @Override Path getOlderRemoteAppLogDir(ApplicationId appId, String user); @Private IndexedLogsMeta loadIndexedLogsMeta(Path remoteLogPath, long end,
      ApplicationId appId); @Private static int getFSOutputBufferSize(Configuration conf); @Private static int getFSInputBufferSize(Configuration conf); @Private @VisibleForTesting long getRollOverLogMaxSize(Configuration conf); @Private @VisibleForTesting boolean isRollover(final FileContext fc,
      final Path candidate); @Private @VisibleForTesting Clock getSystemClock(); @VisibleForTesting
  static final String CHECK_SUM_FILE_SUFFIX; }
@Test public void testGetRollOverLogMaxSize() { String fileControllerName = "testController"; String remoteDirConf = String.format( YarnConfiguration.LOG_AGGREGATION_REMOTE_APP_LOG_DIR_FMT, fileControllerName); Configuration conf = new Configuration(); LogAggregationIndexedFileController fileFormat = new LogAggregationIndexedFileController(); long defaultRolloverSize = 10L * 1024 * 1024 * 1024; fileFormat.initialize(conf, fileControllerName); assertThat(fileFormat.getRollOverLogMaxSize(conf)) .isEqualTo(defaultRolloverSize); conf.set(remoteDirConf, "webhdfs: fileFormat.initialize(conf, fileControllerName); assertThat(fileFormat.getRollOverLogMaxSize(conf)) .isEqualTo(defaultRolloverSize); conf.set(remoteDirConf, "s3a: fileFormat.initialize(conf, fileControllerName); assertThat(fileFormat.getRollOverLogMaxSize(conf)).isZero(); }