Example #1
0
        /// <summary>Set the given snapshottable directory to non-snapshottable.</summary>
        /// <exception cref="Org.Apache.Hadoop.Hdfs.Protocol.SnapshotException">if there are snapshots in the directory.
        ///     </exception>
        /// <exception cref="System.IO.IOException"/>
        public virtual void ResetSnapshottable(string path)
        {
            INodesInPath   iip = fsdir.GetINodesInPath4Write(path);
            INodeDirectory d   = INodeDirectory.ValueOf(iip.GetLastINode(), path);
            DirectorySnapshottableFeature sf = d.GetDirectorySnapshottableFeature();

            if (sf == null)
            {
                // the directory is already non-snapshottable
                return;
            }
            if (sf.GetNumSnapshots() > 0)
            {
                throw new SnapshotException("The directory " + path + " has snapshot(s). " + "Please redo the operation after removing all the snapshots."
                                            );
            }
            if (d == fsdir.GetRoot())
            {
                d.SetSnapshotQuota(0);
            }
            else
            {
                d.RemoveSnapshottableFeature();
            }
            RemoveSnapshottable(d);
        }