Beispiel #1
0
        /// <summary>Is this inode in the latest snapshot?</summary>
        public bool IsInLatestSnapshot(int latestSnapshotId)
        {
            if (latestSnapshotId == Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot.
                CurrentStateId || latestSnapshotId == Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot
                .NoSnapshotId)
            {
                return(false);
            }
            // if parent is a reference node, parent must be a renamed node. We can
            // stop the check at the reference node.
            if (parent != null && parent.IsReference())
            {
                return(true);
            }
            INodeDirectory parentDir = GetParent();

            if (parentDir == null)
            {
                // root
                return(true);
            }
            if (!parentDir.IsInLatestSnapshot(latestSnapshotId))
            {
                return(false);
            }
            Org.Apache.Hadoop.Hdfs.Server.Namenode.INode child = parentDir.GetChild(GetLocalNameBytes
                                                                                        (), latestSnapshotId);
            if (this == child)
            {
                return(true);
            }
            return(child != null && child.IsReference() && this == child.AsReference().GetReferredINode
                       ());
        }