Examples of INodeDirectorySnapshottable


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

  private static INodeDirectoryWithQuota createRoot(FSNamesystem namesystem) {
    final INodeDirectoryWithQuota r = new INodeDirectoryWithQuota(
        INodeId.ROOT_INODE_ID,
        INodeDirectory.ROOT_NAME,
        namesystem.createFsOwnerPermissions(new FsPermission((short) 0755)));
    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 IOException {
    if (target.isDirectory()) {
      INodeDirectory targetDir = target.asDirectory();
      if (targetDir.isSnapshottable()) {
        INodeDirectorySnapshottable ssTargetDir =
            (INodeDirectorySnapshottable) targetDir;
        if (ssTargetDir.getNumSnapshots() > 0) {
          throw new IOException("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

        .numDataNodes(REPLICATION).build();
    cluster.waitActive();
    fsn = cluster.getNamesystem();
    hdfs = cluster.getFileSystem();
   
    INodeDirectorySnapshottable rootNode =
        (INodeDirectorySnapshottable) fsn.dir.getINode4Write(root.toString());
    assertTrue("The children list of root should be empty",
        rootNode.getChildrenList(null).isEmpty());
    // one snapshot on root: s1
    List<DirectoryDiff> diffList = rootNode.getDiffs().asList();
    assertEquals(1, diffList.size());
    assertEquals("s1", diffList.get(0).getSnapshot().getRoot().getLocalName());
   
    // check SnapshotManager's snapshottable directory list
    assertEquals(1, fsn.getSnapshotManager().getNumSnapshottableDirs());
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
View Full Code Here

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

  /** Replace itself with an {@link INodeDirectorySnapshottable}. */
  public INodeDirectorySnapshottable replaceSelf4INodeDirectorySnapshottable(
      Snapshot latest, 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).saveSelf2Snapshot(latest, 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

  private static INodeDirectoryWithQuota createRoot(FSNamesystem namesystem) {
    final INodeDirectoryWithQuota r = new INodeDirectoryWithQuota(
        INodeId.ROOT_INODE_ID,
        INodeDirectory.ROOT_NAME,
        namesystem.createFsOwnerPermissions(new FsPermission((short) 0755)));
    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 IOException {
    if (target.isDirectory()) {
      INodeDirectory targetDir = target.asDirectory();
      if (targetDir.isSnapshottable()) {
        INodeDirectorySnapshottable ssTargetDir =
            (INodeDirectorySnapshottable) targetDir;
        if (ssTargetDir.getNumSnapshots() > 0) {
          throw new IOException("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
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.