Package org.apache.hadoop.hdfs.server.namenode.snapshot

Examples of org.apache.hadoop.hdfs.server.namenode.snapshot.Snapshot$Root


        // check if ".snapshot" is the last element of components
        if (count == components.length - 1) {
          break;
        }
        // Resolve snapshot root
        final Snapshot s = ((INodeDirectorySnapshottable)dir).getSnapshot(
            components[count + 1]);
        if (s == null) {
          //snapshot not found
          curNode = null;
        } else {
          curNode = s.getRoot();
          existing.setSnapshotId(s.getId());
        }
        if (index >= -1) {
          existing.snapshotRootIndex = existing.numNonNull;
        }
      } else {
View Full Code Here


      if (withCount == null) {
        srcChild.setLocalName(dstChildName);
        toDst = srcChild;
      } else {
        withCount.getReferredINode().setLocalName(dstChildName);
        Snapshot dstSnapshot = dstIIP.getLatestSnapshot();
        final INodeReference.DstReference ref = new INodeReference.DstReference(
            dstParent.asDirectory(), withCount,
            dstSnapshot == null ? Snapshot.INVALID_ID : dstSnapshot.getId());
        toDst = ref;
      }
     
      added = addLastINodeNoQuotaCheck(dstIIP, toDst);
      if (added) {
View Full Code Here

      if (withCount == null) {
        srcChild.setLocalName(dstChildName);
        toDst = srcChild;
      } else {
        withCount.getReferredINode().setLocalName(dstChildName);
        Snapshot dstSnapshot = dstIIP.getLatestSnapshot();
        final INodeReference.DstReference ref = new INodeReference.DstReference(
            dstIIP.getINode(-2).asDirectory(), withCount,
            dstSnapshot == null ? Snapshot.INVALID_ID : dstSnapshot.getId());
        toDst = ref;
      }

      // add src as dst to complete rename
      if (addLastINodeNoQuotaCheck(dstIIP, toDst)) {
View Full Code Here

   
    final INodesInPath trgIIP = rootDir.getINodesInPath4Write(target, true);
    final INode[] trgINodes = trgIIP.getINodes();
    final INodeFile trgInode = trgIIP.getLastINode().asFile();
    INodeDirectory trgParent = trgINodes[trgINodes.length-2].asDirectory();
    final Snapshot trgLatestSnapshot = trgIIP.getLatestSnapshot();
   
    final INodeFile [] allSrcInodes = new INodeFile[srcs.length];
    for(int i = 0; i < srcs.length; i++) {
      final INodesInPath iip = getINodesInPath4Write(srcs[i]);
      final Snapshot latest = iip.getLatestSnapshot();
      final INode inode = iip.getLastINode();

      // check if the file in the latest snapshot
      if (inode.isInLatestSnapshot(latest)) {
        throw new SnapshotException("Concat: the source file " + srcs[i]
View Full Code Here

      final INode inode = inodesInPath.getINode(0);
      if (inode == null || !inode.isDirectory()) {
        //not found or not a directory
        return false;
      }
      final Snapshot s = inodesInPath.getPathSnapshot();
      return !inode.asDirectory().getChildrenList(s).isEmpty();
    } finally {
      readUnlock();
    }
  }
View Full Code Here

    if (targetNode == null) {
      return -1;
    }

    // record modification
    final Snapshot latestSnapshot = iip.getLatestSnapshot();
    targetNode = targetNode.recordModification(latestSnapshot, inodeMap);
    iip.setLastINode(targetNode);

    // Remove the node from the namespace
    long removed = removeLastINode(iip);
View Full Code Here

    try {
      if (srcs.endsWith(HdfsConstants.SEPARATOR_DOT_SNAPSHOT_DIR)) {
        return getSnapshotsListing(srcs, startAfter);
      }
      final INodesInPath inodesInPath = rootDir.getLastINodeInPath(srcs, true);
      final Snapshot snapshot = inodesInPath.getPathSnapshot();
      final INode targetNode = inodesInPath.getINode(0);
      if (targetNode == null)
        return null;
     
      if (!targetNode.isDirectory()) {
View Full Code Here

   *            reference nodes;
   *         >0 otherwise.
   */
  private long removeLastINode(final INodesInPath iip)
      throws QuotaExceededException {
    final Snapshot latestSnapshot = iip.getLatestSnapshot();
    final INode last = iip.getLastINode();
    final INodeDirectory parent = iip.getINode(-2).asDirectory();
    if (!parent.removeChild(last, latestSnapshot, inodeMap)) {
      return -1;
    }
View Full Code Here

      }
      if (dsQuota == HdfsConstants.QUOTA_DONT_SET) {
        dsQuota = oldDsQuota;
      }       

      final Snapshot latest = iip.getLatestSnapshot();
      if (dirNode instanceof INodeDirectoryWithQuota) {
        INodeDirectoryWithQuota quotaNode = (INodeDirectoryWithQuota) dirNode;
        Quota.Counts counts = null;
        if (!quotaNode.isQuotaSet()) {
          // dirNode must be an INodeDirectoryWithSnapshot whose quota has not
View Full Code Here

    }
   
    @Override
    public void destroyAndCollectBlocks(BlocksMapUpdateInfo collectedBlocks,
        final List<INode> removedINodes) {
      Snapshot snapshot = getSelfSnapshot();
      if (removeReference(this) <= 0) {
        getReferredINode().destroyAndCollectBlocks(collectedBlocks,
            removedINodes);
      } else {
        Snapshot prior = getPriorSnapshot(this);
        INode referred = getReferredINode().asReference().getReferredINode();
       
        if (snapshot != null) {
          if (prior != null && snapshot.getId() <= prior.getId()) {
            // the snapshot to be deleted has been deleted while traversing
            // the src tree of the previous rename operation. This usually
            // happens when rename's src and dst are under the same
            // snapshottable directory. E.g., the following operation sequence:
            // 1. create snapshot s1 on /test
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hdfs.server.namenode.snapshot.Snapshot$Root

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.