/// <summary>Concat all the blocks from srcs to trg and delete the srcs files</summary> /// <param name="fsd">FSDirectory</param> /// <exception cref="System.IO.IOException"/> internal static void UnprotectedConcat(FSDirectory fsd, INodesInPath targetIIP, INodeFile [] srcList, long timestamp) { System.Diagnostics.Debug.Assert(fsd.HasWriteLock()); if (NameNode.stateChangeLog.IsDebugEnabled()) { NameNode.stateChangeLog.Debug("DIR* FSNamesystem.concat to " + targetIIP.GetPath( )); } INodeFile trgInode = targetIIP.GetLastINode().AsFile(); QuotaCounts deltas = ComputeQuotaDeltas(fsd, trgInode, srcList); VerifyQuota(fsd, targetIIP, deltas); // the target file can be included in a snapshot trgInode.RecordModification(targetIIP.GetLatestSnapshotId()); INodeDirectory trgParent = targetIIP.GetINode(-2).AsDirectory(); trgInode.ConcatBlocks(srcList); // since we are in the same dir - we can use same parent to remove files int count = 0; foreach (INodeFile nodeToRemove in srcList) { if (nodeToRemove != null) { nodeToRemove.SetBlocks(null); nodeToRemove.GetParent().RemoveChild(nodeToRemove); fsd.GetINodeMap().Remove(nodeToRemove); count++; } } trgInode.SetModificationTime(timestamp, targetIIP.GetLatestSnapshotId()); trgParent.UpdateModificationTime(timestamp, targetIIP.GetLatestSnapshotId()); // update quota on the parent directory with deltas FSDirectory.UnprotectedUpdateCount(targetIIP, targetIIP.Length() - 1, deltas); }