JobHistoryUtils { public static FsPermission getConfiguredHistoryIntermediateUserDoneDirPermissions( Configuration conf) { String userDoneDirPermissions = conf.get( JHAdminConfig.MR_HISTORY_INTERMEDIATE_USER_DONE_DIR_PERMISSIONS); if (userDoneDirPermissions == null) { return new FsPermission( JHAdminConfig.DEFAULT_MR_HISTORY_INTERMEDIATE_USER_DONE_DIR_PERMISSIONS); } FsPermission permission = new FsPermission(userDoneDirPermissions); if (permission.getUserAction() != FsAction.ALL || permission.getGroupAction() != FsAction.ALL) { permission = new FsPermission(FsAction.ALL, FsAction.ALL, permission.getOtherAction(), permission.getStickyBit()); LOG.warn("Unsupported permission configured in " + JHAdminConfig.MR_HISTORY_INTERMEDIATE_USER_DONE_DIR_PERMISSIONS + ", the user and the group permission must be 7 (rwx). " + "The permission was set to " + permission.toString()); } return permission; }  static boolean isValidJobHistoryFileName(String pathString); static JobID getJobIDFromHistoryFilePath(String pathString); static PathFilter getConfFileFilter(); static PathFilter getHistoryFileFilter(); static String getConfiguredHistoryStagingDirPrefix(Configuration conf, String jobId); static String getConfiguredHistoryIntermediateDoneDirPrefix(
      Configuration conf); static FsPermission getConfiguredHistoryIntermediateUserDoneDirPermissions(
            Configuration conf); static String getConfiguredHistoryServerDoneDirPrefix(
      Configuration conf); static String getHistoryIntermediateDoneDirForUser(Configuration conf); static boolean shouldCreateNonUserDirectory(Configuration conf); static Path getStagingJobHistoryFile(Path dir, JobId jobId, int attempt); static Path getStagingJobHistoryFile(Path dir, String jobId, int attempt); static String getIntermediateConfFileName(JobId jobId); static String getIntermediateSummaryFileName(JobId jobId); static Path getStagingConfFile(Path logDir, JobId jobId, int attempt); static String serialNumberDirectoryComponent(JobId id, String serialNumberFormat); static String getTimestampPartFromPath(String path); static String historyLogSubdirectory(JobId id, String timestampComponent, String serialNumberFormat); static String timestampDirectoryComponent(long millisecondTime); static String doneSubdirsBeforeSerialTail(); static int jobSerialNumber(JobId id); static List<FileStatus> localGlobber(FileContext fc, Path root, String tail); static List<FileStatus> localGlobber(FileContext fc, Path root, String tail,
      PathFilter filter); static List<FileStatus> localGlobber(FileContext fc, Path root, String tail,
      PathFilter filter, AtomicBoolean hasFlatFiles); static Path getPreviousJobHistoryPath(
      Configuration conf, ApplicationAttemptId applicationAttemptId); static List<FileStatus> getHistoryDirsForCleaning(FileContext fc,
      Path root, long cutoff); static final FsPermission HISTORY_STAGING_DIR_PERMISSIONS; static final FsPermission HISTORY_STAGING_USER_DIR_PERMISSIONS; static final FsPermission HISTORY_DONE_DIR_PERMISSION; static final FsPermission HISTORY_DONE_FILE_PERMISSION; static final FsPermission HISTORY_DONE_DIR_UMASK; static final FsPermission HISTORY_INTERMEDIATE_DONE_DIR_PERMISSIONS; static final FsPermission HISTORY_INTERMEDIATE_FILE_PERMISSIONS; static final String CONF_FILE_NAME_SUFFIX; static final String SUMMARY_FILE_NAME_SUFFIX; static final String JOB_HISTORY_FILE_EXTENSION; static final int VERSION; static final int SERIAL_NUMBER_DIRECTORY_DIGITS; static final String TIMESTAMP_DIR_REGEX; static final Pattern TIMESTAMP_DIR_PATTERN; }
@Test public void testGetConfiguredHistoryIntermediateUserDoneDirPermissions() { Configuration conf = new Configuration(); Map<String, FsPermission> parameters = ImmutableMap.of( "775", new FsPermission(0775), "123", new FsPermission(0773), "-rwx", new FsPermission(0770) , "+rwx", new FsPermission(0777) ); for (Map.Entry<String, FsPermission> entry : parameters.entrySet()) { conf.set(JHAdminConfig.MR_HISTORY_INTERMEDIATE_USER_DONE_DIR_PERMISSIONS, entry.getKey()); Assert.assertEquals(entry.getValue(), getConfiguredHistoryIntermediateUserDoneDirPermissions(conf)); } }