Package org.apache.hadoop.fs.permission

Examples of org.apache.hadoop.fs.permission.FsPermission$ImmutableFsPermission


   */
  public static DataNode makeInstance(String[] dataDirs, Configuration conf,
      SecureResources resources) throws IOException {
    LocalFileSystem localFS = FileSystem.getLocal(conf);
    ArrayList<File> dirs = new ArrayList<File>();
    FsPermission dataDirPermission =
      new FsPermission(conf.get(DATA_DIR_PERMISSION_KEY,
                                DEFAULT_DATA_DIR_PERMISSION));
    for (String dir : dataDirs) {
      try {
        DiskChecker.checkDir(localFS, new Path(dir), dataDirPermission);
        dirs.add(new File(dir));
View Full Code Here


    
     */
    void updateRestartCount() throws IOException {
      Path restartFile = getRestartCountFile();
      Path tmpRestartFile = getTempRestartCountFile();
      FsPermission filePerm = new FsPermission(SYSTEM_FILE_PERMISSION);

      // read the count from the jobtracker info file
      if (fs.exists(restartFile)) {
        fs.delete(tmpRestartFile, false); // delete the tmp file
      } else if (fs.exists(tmpRestartFile)) {
View Full Code Here

                " is not owned by " + getMROwner().getShortUserName());
          }
          if (!systemDirStatus.getPermission().equals(SYSTEM_DIR_PERMISSION)) {
            LOG.warn("Incorrect permissions on " + systemDir +
                ". Setting it to " + SYSTEM_DIR_PERMISSION);
            fs.setPermission(systemDir,new FsPermission(SYSTEM_DIR_PERMISSION));
          }
        } catch (FileNotFoundException fnf) {} //ignore
        // Make sure that the backup data is preserved
        FileStatus[] systemDirData = fs.listStatus(this.systemDir);
        // Check if the history is enabled .. as we cant have persistence with
        // history disabled
        if (conf.getBoolean("mapred.jobtracker.restart.recover", false)
            && !JobHistory.isDisableHistory()
            && systemDirData != null) {
          for (FileStatus status : systemDirData) {
            try {
              recoveryManager.checkAndAddJob(status);
            } catch (Throwable t) {
              LOG.warn("Failed to add the job " + status.getPath().getName(),
                       t);
            }
          }
         
          // Check if there are jobs to be recovered
          hasRestarted = recoveryManager.shouldRecover();
          if (hasRestarted) {
            break; // if there is something to recover else clean the sys dir
          }
        }
        LOG.info("Cleaning up the system directory");
        fs.delete(systemDir, true);
        if (FileSystem.mkdirs(fs, systemDir,
            new FsPermission(SYSTEM_DIR_PERMISSION))) {
          break;
        }
        LOG.error("Mkdirs failed to create " + systemDir);
      } catch (AccessControlException ace) {
        LOG.warn("Failed to operate on mapred.system.dir (" + systemDir
View Full Code Here

      // This is handled in the trunk/0.22
      if (!recovered) {
        // Store the information in a file so that the job can be recovered
        // later (if at all)
        Path jobDir = getSystemDirectoryForJob(jobId);
        FileSystem.mkdirs(fs, jobDir, new FsPermission(SYSTEM_DIR_PERMISSION));
        FSDataOutputStream out = fs.create(getSystemFileForJob(jobId));
        jobInfo.write(out);
        out.close();
      }
      return addJob(jobId, job);
View Full Code Here

   * @return  null if the child with this name already exists;
   *          node, otherwise
   */
  <T extends INode> T addChild(final T node, boolean inheritPermission) {
    if (inheritPermission) {
      FsPermission p = getFsPermission();
      //make sure the  permission has wx for the user
      if (!p.getUserAction().implies(FsAction.WRITE_EXECUTE)) {
        p = new FsPermission(p.getUserAction().or(FsAction.WRITE_EXECUTE),
            p.getGroupAction(), p.getOtherAction());
      }
      node.setPermission(p);
    }

    if (children == null) {
View Full Code Here

    } catch (InterruptedException e) {
      throw new IOException(e);
    }
   
    Path jobDirectory = new Path(stagingArea + NAME + "_" + randomId);
    FsPermission mapredSysPerms =
      new FsPermission(JobSubmissionFiles.JOB_DIR_PERMISSION);
    FileSystem.mkdirs(jClient.getFs(), jobDirectory, mapredSysPerms);
    jobConf.set(JOB_DIR_LABEL, jobDirectory.toString());

    long maxBytesPerMap = conf.getLong(BYTES_PER_MAP_LABEL, BYTES_PER_MAP);
View Full Code Here

    if (!mkdirsWithExistsAndPermissionCheck(localFS, dir, expected))
      throw new DiskErrorException("can not create directory: "
                                   + dir.toString());

    FileStatus stat = localFS.getFileStatus(dir);
    FsPermission actual = stat.getPermission();
   
    if (!stat.isDir())
      throw new DiskErrorException("not a directory: "
                                   + dir.toString());
           
    FsAction user = actual.getUserAction();
    if (!user.implies(FsAction.READ))
      throw new DiskErrorException("directory is not readable: "
                                   + dir.toString());
           
    if (!user.implies(FsAction.WRITE))
View Full Code Here

            HarStatus hstatus = new HarStatus(lineFeed);
            FileStatus childStatus = new FileStatus(hstatus.isDir() ? 0
                : hstatus.getLength(), hstatus.isDir(), (int) archiveIndexStat
                .getReplication(), archiveIndexStat.getBlockSize(),
                archiveIndexStat.getModificationTime(), archiveIndexStat
                    .getAccessTime(), new FsPermission(archiveIndexStat
                    .getPermission()), archiveIndexStat.getOwner(),
                archiveIndexStat.getGroup(), makeRelative(this.uri.toString(),
                    new Path(hstatus.name)));
            statuses.add(childStatus);
          }
View Full Code Here

    HarStatus hstatus = null;
    hstatus = new HarStatus(readStr);
    return new FileStatus(hstatus.isDir()?0:hstatus.getLength(), hstatus.isDir(),
        (int)archiveStatus.getReplication(), archiveStatus.getBlockSize(),
        archiveStatus.getModificationTime(), archiveStatus.getAccessTime(),
        new FsPermission(
        archiveStatus.getPermission()), archiveStatus.getOwner(),
        archiveStatus.getGroup(),
            makeRelative(this.uri.toString(), new Path(hstatus.name)));
  }
View Full Code Here

    if (!hstatus.isDir())
        statuses.add(new FileStatus(hstatus.getLength(),
            hstatus.isDir(),
            archiveStatus.getReplication(), archiveStatus.getBlockSize(),
            archiveStatus.getModificationTime(), archiveStatus.getAccessTime(),
            new FsPermission(archiveStatus.getPermission()),
            archiveStatus.getOwner(), archiveStatus.getGroup(),
            makeRelative(this.uri.toString(), new Path(hstatus.name))));
    else
      fileStatusesInIndex(hstatus, statuses, hstatus.children, archiveStatus);
   
View Full Code Here

TOP

Related Classes of org.apache.hadoop.fs.permission.FsPermission$ImmutableFsPermission

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.