@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;
    }
  }
@Test
  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;

    // test local filesystem
    fileFormat.initialize(conf, fileControllerName);
    assertThat(fileFormat.getRollOverLogMaxSize(conf))
        .isEqualTo(defaultRolloverSize);

    // test file system supporting append
    conf.set(remoteDirConf, "webhdfs://localhost/path");
    fileFormat.initialize(conf, fileControllerName);
    assertThat(fileFormat.getRollOverLogMaxSize(conf))
        .isEqualTo(defaultRolloverSize);

    // test file system not supporting append
    conf.set(remoteDirConf, "s3a://test/path");
    fileFormat.initialize(conf, fileControllerName);
    assertThat(fileFormat.getRollOverLogMaxSize(conf)).isZero();
  }