Пример #1
0
        public override QuotaCounts CleanSubtree(BlockStoragePolicySuite bsps, int snapshot
                                                 , int priorSnapshotId, INode.BlocksMapUpdateInfo collectedBlocks, IList <INode> removedINodes
                                                 )
        {
            FileWithSnapshotFeature sf = GetFileWithSnapshotFeature();

            if (sf != null)
            {
                return(sf.CleanFile(bsps, this, snapshot, priorSnapshotId, collectedBlocks, removedINodes
                                    ));
            }
            QuotaCounts counts = new QuotaCounts.Builder().Build();

            if (snapshot == Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot.CurrentStateId)
            {
                if (priorSnapshotId == Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot.NoSnapshotId)
                {
                    // this only happens when deleting the current file and the file is not
                    // in any snapshot
                    ComputeQuotaUsage(bsps, counts, false);
                    DestroyAndCollectBlocks(bsps, collectedBlocks, removedINodes);
                }
                else
                {
                    // when deleting the current file and the file is in snapshot, we should
                    // clean the 0-sized block if the file is UC
                    FileUnderConstructionFeature uc = GetFileUnderConstructionFeature();
                    if (uc != null)
                    {
                        uc.CleanZeroSizeBlock(this, collectedBlocks);
                    }
                }
            }
            return(counts);
        }