Beispiel #1
0
            internal virtual bool AddSourceToDestination()
            {
                INode dstParent = dstParentIIP.GetLastINode();

                byte[] dstChildName = dstIIP.GetLastLocalName();
                INode  toDst;

                if (withCount == null)
                {
                    srcChild.SetLocalName(dstChildName);
                    toDst = srcChild;
                }
                else
                {
                    withCount.GetReferredINode().SetLocalName(dstChildName);
                    toDst = new INodeReference.DstReference(dstParent.AsDirectory(), withCount, dstIIP
                                                            .GetLatestSnapshotId());
                }
                return(fsd.AddLastINodeNoQuotaCheck(dstParentIIP, toDst) != null);
            }
Beispiel #2
0
            /// <exception cref="Org.Apache.Hadoop.Hdfs.Protocol.QuotaExceededException"/>
            internal virtual void RestoreSource()
            {
                // Rename failed - restore src
                INode oldSrcChild = srcChild;

                // put it back
                if (withCount == null)
                {
                    srcChild.SetLocalName(srcChildName);
                }
                else
                {
                    if (!srcChildIsReference)
                    {
                        // src must be in snapshot
                        // the withCount node will no longer be used thus no need to update
                        // its reference number here
                        srcChild = withCount.GetReferredINode();
                        srcChild.SetLocalName(srcChildName);
                    }
                    else
                    {
                        withCount.RemoveReference(oldSrcChild.AsReference());
                        srcChild = new INodeReference.DstReference(srcParent, withCount, srcRefDstSnapshot
                                                                   );
                        withCount.GetReferredINode().SetLocalName(srcChildName);
                    }
                }
                if (isSrcInSnapshot)
                {
                    srcParent.UndoRename4ScrParent(oldSrcChild.AsReference(), srcChild);
                }
                else
                {
                    // srcParent is not an INodeDirectoryWithSnapshot, we only need to add
                    // the srcChild back
                    fsd.AddLastINodeNoQuotaCheck(srcParentIIP, srcChild);
                }
            }