public static class INodeReference.DstReference extends INodeReference
INodeReference.DstReference, INodeReference.WithCount, INodeReference.WithName
INode.BlocksMapUpdateInfo, INode.Feature, INode.QuotaDelta, INode.ReclaimContext
INodeAttributes.SnapshotCopy
Constructor and Description |
---|
INodeReference.DstReference(INodeDirectory parent,
INodeReference.WithCount referred,
int dstSnapshotId) |
Modifier and Type | Method and Description |
---|---|
void |
cleanSubtree(INode.ReclaimContext reclaimContext,
int snapshot,
int prior)
Clean the subtree under this inode and collect the blocks from the descents
for further block deletion/update.
|
void |
destroyAndCollectBlocks(INode.ReclaimContext reclaimContext)
Destroy self and clear everything! If the INode is a file, this method
collects its blocks for further block deletion.
|
int |
getDstSnapshotId() |
asDirectory, asFile, asReference, asSymlink, clear, computeContentSummary, computeQuotaUsage, dumpTreeRecursively, getAccessTime, getFsPermission, getFsPermissionShort, getGroupName, getId, getLocalNameBytes, getLocalStoragePolicyID, getModificationTime, getPermissionLong, getPermissionStatus, getQuotaCounts, getReferredINode, getSnapshotINode, getStoragePolicyID, getUserName, isDirectory, isFile, isReference, isSymlink, setAccessTime, setLocalName, setModificationTime, setReferredINode, tryRemoveReference, updateModificationTime
addSpaceConsumed, compareTo, computeAndConvertContentSummary, computeContentSummary, computeQuotaUsage, computeQuotaUsage, dumpTreeRecursively, dumpTreeRecursively, equals, getAccessTime, getAclFeature, getFsPermission, getFullPathName, getGroupName, getKey, getLocalName, getModificationTime, getObjectString, getParent, getParentReference, getParentString, getPathComponents, getPathComponents, getPathNames, getStoragePolicyIDForQuota, getUserName, getXAttrFeature, hashCode, isAncestorDirectory, isInLatestSnapshot, isQuotaSet, setAccessTime, setModificationTime, setParent, setParentReference, shouldRecordInSrcSnapshot, toDetailString, toString
public INodeReference.DstReference(INodeDirectory parent, INodeReference.WithCount referred, int dstSnapshotId)
public final int getDstSnapshotId()
getDstSnapshotId
in class INodeReference
public void cleanSubtree(INode.ReclaimContext reclaimContext, int snapshot, int prior)
org.apache.hadoop.hdfs.server.namenode.INode
In general, we have the following rules. 1. When deleting a file/directory in the current tree, we have different actions according to the type of the node to delete. 1.1 The current inode (this) is anINodeFile
. 1.1.1 Ifprior
is null, there is no snapshot taken on ancestors before. Thus we simply destroy (i.e., to delete completely, no need to save snapshot copy) the current INode and collect its blocks for further cleansing. 1.1.2 Else do nothing since the current INode will be stored as a snapshot copy. 1.2 The current inode is anINodeDirectory
. 1.2.1 Ifprior
is null, there is no snapshot taken on ancestors before. Similarly, we destroy the whole subtree and collect blocks. 1.2.2 Else do nothing with the current INode. Recursively clean its children. 1.3 The current inode is a file with snapshot. Call recordModification(..) to capture the current states. Mark the INode as deleted. 1.4 The current inode is anINodeDirectory
with snapshot feature. Call recordModification(..) to capture the current states. Destroy files/directories created after the latest snapshot (i.e., the inodes stored in the created list of the latest snapshot). Recursively clean remaining children. 2. When deleting a snapshot. 2.1 To cleanINodeFile
: do nothing. 2.2 To cleanINodeDirectory
: recursively clean its children. 2.3 To clean INodeFile with snapshot: delete the corresponding snapshot in its diff list. 2.4 To cleanINodeDirectory
with snapshot: delete the corresponding snapshot in its diff list. Recursively clean its children.
cleanSubtree
in class INodeReference
reclaimContext
- Record blocks and inodes that need to be reclaimed.snapshot
- The id of the snapshot to delete.
Snapshot.CURRENT_STATE_ID
means to delete the current
file/directory.prior
- The id of the latest snapshot before the to-be-deleted snapshot.
When deleting a current inode, this parameter captures the latest
snapshot.public void destroyAndCollectBlocks(INode.ReclaimContext reclaimContext)
destroyAndCollectBlocks
in class INodeReference
reclaimContext
- Copyright © 2017 Apache Software Foundation. All Rights Reserved.