Examples of INodeDirectorySnapshottable


Examples of org.apache.hadoop.hdfs.server.namenode.snapshot.INodeDirectorySnapshottable

  public INodeDirectorySnapshottable replaceSelf4INodeDirectorySnapshottable(
      int latestSnapshotId, final INodeMap inodeMap)
      throws QuotaExceededException {
    Preconditions.checkState(!(this instanceof INodeDirectorySnapshottable),
        "this is already an INodeDirectorySnapshottable, this=%s", this);
    final INodeDirectorySnapshottable s = new INodeDirectorySnapshottable(this);
    replaceSelf(s, inodeMap).getDirectoryWithSnapshotFeature().getDiffs()
        .saveSelf2Snapshot(latestSnapshotId, s, this);
    return s;
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.snapshot.INodeDirectorySnapshottable

      }

      // 2. Write INodeDirectorySnapshottable#snapshotsByNames to record all
      // Snapshots
      if (current instanceof INodeDirectorySnapshottable) {
        INodeDirectorySnapshottable snapshottableNode =
            (INodeDirectorySnapshottable) current;
        SnapshotFSImageFormat.saveSnapshots(snapshottableNode, out);
      } else {
        out.writeInt(-1); // # of snapshots
      }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.snapshot.INodeDirectorySnapshottable

      }
     
      // Step 2. Load snapshots if parent is snapshottable
      int numSnapshots = in.readInt();
      if (numSnapshots >= 0) {
        final INodeDirectorySnapshottable snapshottableParent
            = INodeDirectorySnapshottable.valueOf(parent, parent.getLocalName());
        // load snapshots and snapshotQuota
        SnapshotFSImageFormat.loadSnapshotList(snapshottableParent,
            numSnapshots, in, this);
        if (snapshottableParent.getSnapshotQuota() > 0) {
          // add the directory to the snapshottable directory list in
          // SnapshotManager. Note that we only add root when its snapshot quota
          // is positive.
          this.namesystem.getSnapshotManager().addSnapshottable(
              snapshottableParent);
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.snapshot.INodeDirectorySnapshottable

        dir.addDirectoryWithQuotaFeature(nsQuota, dsQuota);
      }
      if (withSnapshot) {
        dir.addSnapshotFeature(null);
      }
      return snapshottable ? new INodeDirectorySnapshottable(dir) : dir;
    } else if (numBlocks == -2) {
      //symlink
      if (!FileSystem.areSymlinksEnabled()) {
        throw new IOException("Symlinks not supported - please remove symlink before upgrading to this version of HDFS");
      }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.snapshot.INodeDirectorySnapshottable

        namesystem.createFsOwnerPermissions(new FsPermission((short) 0755)),
        0L);
    r.addDirectoryWithQuotaFeature(
        DirectoryWithQuotaFeature.DEFAULT_NAMESPACE_QUOTA,
        DirectoryWithQuotaFeature.DEFAULT_DISKSPACE_QUOTA);
    final INodeDirectorySnapshottable s = new INodeDirectorySnapshottable(r);
    s.setSnapshotQuota(0);
    return s;
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.snapshot.INodeDirectorySnapshottable

  private static void checkSnapshot(INode target,
      List<INodeDirectorySnapshottable> snapshottableDirs) throws SnapshotException {
    if (target.isDirectory()) {
      INodeDirectory targetDir = target.asDirectory();
      if (targetDir.isSnapshottable()) {
        INodeDirectorySnapshottable ssTargetDir =
            (INodeDirectorySnapshottable) targetDir;
        if (ssTargetDir.getNumSnapshots() > 0) {
          throw new SnapshotException("The directory " + ssTargetDir.getFullPathName()
              + " cannot be deleted since " + ssTargetDir.getFullPathName()
              + " is snapshottable and already has snapshots");
        } else {
          if (snapshottableDirs != null) {
            snapshottableDirs.add(ssTargetDir);
          }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.snapshot.INodeDirectorySnapshottable

   
    final String dirPath = normalizePath(src.substring(0,
        src.length() - HdfsConstants.DOT_SNAPSHOT_DIR.length()));
   
    final INode node = this.getINode(dirPath);
    final INodeDirectorySnapshottable dirNode = INodeDirectorySnapshottable
        .valueOf(node, dirPath);
    final ReadOnlyList<Snapshot> snapshots = dirNode.getSnapshotList();
    int skipSize = ReadOnlyList.Util.binarySearch(snapshots, startAfter);
    skipSize = skipSize < 0 ? -skipSize - 1 : skipSize + 1;
    int numOfListing = Math.min(snapshots.size() - skipSize, this.lsLimit);
    final HdfsFileStatus listing[] = new HdfsFileStatus[numOfListing];
    for (int i = 0; i < numOfListing; i++) {
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.snapshot.INodeDirectorySnapshottable

      }
     
      // Step 2. Load snapshots if parent is snapshottable
      int numSnapshots = in.readInt();
      if (numSnapshots >= 0) {
        final INodeDirectorySnapshottable snapshottableParent
            = INodeDirectorySnapshottable.valueOf(parent, parent.getLocalName());
        // load snapshots and snapshotQuota
        SnapshotFSImageFormat.loadSnapshotList(snapshottableParent,
            numSnapshots, in, this);
        if (snapshottableParent.getSnapshotQuota() > 0) {
          // add the directory to the snapshottable directory list in
          // SnapshotManager. Note that we only add root when its snapshot quota
          // is positive.
          this.namesystem.getSnapshotManager().addSnapshottable(
              snapshottableParent);
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.snapshot.INodeDirectorySnapshottable

      }
      final INodeDirectory dir = nsQuota >= 0 || dsQuota >= 0?
          new INodeDirectoryWithQuota(inodeId, localName, permissions,
              modificationTime, nsQuota, dsQuota)
          : new INodeDirectory(inodeId, localName, permissions, modificationTime);
      return snapshottable ? new INodeDirectorySnapshottable(dir)
          : withSnapshot ? new INodeDirectoryWithSnapshot(dir)
          : dir;
    } else if (numBlocks == -2) {
      //symlink
      if (!FileSystem.isSymlinksEnabled()) {
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.snapshot.INodeDirectorySnapshottable

      }
     
      // 2. Write INodeDirectorySnapshottable#snapshotsByNames to record all
      // Snapshots
      if (current instanceof INodeDirectorySnapshottable) {
        INodeDirectorySnapshottable snapshottableNode =
            (INodeDirectorySnapshottable) current;
        SnapshotFSImageFormat.saveSnapshots(snapshottableNode, out);
      } else {
        out.writeInt(-1); // # of snapshots
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.