/// <summary> /// Check if the given INode (or one of its descendants) is snapshottable and /// already has snapshots. /// </summary> /// <param name="target">The given INode</param> /// <param name="snapshottableDirs"> /// The list of directories that are snapshottable /// but do not have snapshots yet /// </param> /// <exception cref="Org.Apache.Hadoop.Hdfs.Protocol.SnapshotException"/> internal static void CheckSnapshot(INode target, IList <INodeDirectory> snapshottableDirs ) { if (target.IsDirectory()) { INodeDirectory targetDir = target.AsDirectory(); DirectorySnapshottableFeature sf = targetDir.GetDirectorySnapshottableFeature(); if (sf != null) { if (sf.GetNumSnapshots() > 0) { string fullPath = targetDir.GetFullPathName(); throw new SnapshotException("The directory " + fullPath + " cannot be deleted since " + fullPath + " is snapshottable and already has snapshots"); } else { if (snapshottableDirs != null) { snapshottableDirs.AddItem(targetDir); } } } foreach (INode child in targetDir.GetChildrenList(Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot .CurrentStateId)) { CheckSnapshot(child, snapshottableDirs); } } }
private void CheckStoragespace(INodeDirectory dir, long computed) { if (-1 != quota.GetStorageSpace() && usage.GetStorageSpace() != computed) { NameNode.Log.Error("BUG: Inconsistent storagespace for directory " + dir.GetFullPathName () + ". Cached = " + usage.GetStorageSpace() + " != Computed = " + computed); } }