Beispiel #1
0
 public virtual INode GetChild(INodeDirectory currentINode, byte[] name, int snapshotId
                               )
 {
     DirectoryWithSnapshotFeature.DirectoryDiff diff = diffs.GetDiffById(snapshotId);
     return(diff != null?diff.GetChild(name, true, currentINode) : currentINode.GetChild
                    (name, Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot.CurrentStateId));
 }
Beispiel #2
0
        /// <summary>Load a node stored in the created list from fsimage.</summary>
        /// <param name="createdNodeName">The name of the created node.</param>
        /// <param name="parent">The directory that the created list belongs to.</param>
        /// <returns>The created node.</returns>
        /// <exception cref="System.IO.IOException"/>
        public static INode LoadCreated(byte[] createdNodeName, INodeDirectory parent)
        {
            // the INode in the created list should be a reference to another INode
            // in posterior SnapshotDiffs or one of the current children
            foreach (DirectoryWithSnapshotFeature.DirectoryDiff postDiff in parent.GetDiffs())
            {
                INode d = postDiff.GetChildrenDiff().Search(Diff.ListType.Deleted, createdNodeName
                                                            );
                if (d != null)
                {
                    return(d);
                }
            }
            // else go to the next SnapshotDiff
            // use the current child
            INode currentChild = parent.GetChild(createdNodeName, Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot
                                                 .CurrentStateId);

            if (currentChild == null)
            {
                throw new IOException("Cannot find an INode associated with the INode " + DFSUtil
                                      .Bytes2String(createdNodeName) + " in created list while loading FSImage.");
            }
            return(currentChild);
        }