private void makeDoneSubdir(Path path) throws IOException { try { doneDirFc.getFileStatus(path); existingDoneSubdirs.add(path); } catch (FileNotFoundException fnfE) { try { FsPermission fsp = new FsPermission(JobHistoryUtils.HISTORY_DONE_DIR_PERMISSION); doneDirFc.mkdir(path, fsp, true); FileStatus fsStatus = doneDirFc.getFileStatus(path); /* LOG.info("Perms after creating "+fsStatus.getPermission().toShort()+", Expected: "+fsp.toShort()) */ LOG.perms_after_creating_expected( String.valueOf(fsStatus.getPermission().toShort()), String.valueOf(fsp.toShort())) .tag("methodCall") .info(); if (fsStatus.getPermission().toShort() != fsp.toShort()) { /* LOG.info("Explicitly setting permissions to : "+fsp.toShort()+", "+fsp) */ LOG.explicitly_setting_permissions(String.valueOf(fsp.toShort()), fsp.toString()) .tag("methodCall") .info(); doneDirFc.setPermission(path, fsp); } existingDoneSubdirs.add(path); } catch (FileAlreadyExistsException faeE) { // Nothing to do. } } }
private void mkdir(FileContext fc, Path path, FsPermission fsp) throws IOException { if (!fc.util().exists(path)) { try { fc.mkdir(path, fsp, true); FileStatus fsStatus = fc.getFileStatus(path); /* LOG.info("Perms after creating "+fsStatus.getPermission().toShort()+", Expected: "+fsp.toShort()) */ LOG.perms_after_creating_expected( String.valueOf(fsStatus.getPermission().toShort()), String.valueOf(fsp.toShort())) .tag("methodCall") .info(); if (fsStatus.getPermission().toShort() != fsp.toShort()) { /* LOG.info("Explicitly setting permissions to : "+fsp.toShort()+", "+fsp) */ LOG.explicitly_setting_permissions(String.valueOf(fsp.toShort()), fsp.toString()) .tag("methodCall") .info(); fc.setPermission(path, fsp); } } catch (FileAlreadyExistsException e) { /* LOG.info("Directory: ["+path+"] already exists.") */ LOG.directory_already_exists(path.toString()).info(); } } }