Class FSNamesystem
java.lang.Object
org.apache.hadoop.hdfs.server.namenode.FSNamesystem
- All Implemented Interfaces:
ECBlockGroupsMBean,FSNamesystemMBean,ReplicatedBlocksMBean,NameNodeMXBean,Namesystem,SafeMode,RwLock
@Private
@Metrics(context="dfs")
public class FSNamesystem
extends Object
implements Namesystem, FSNamesystemMBean, NameNodeMXBean, ReplicatedBlocksMBean, ECBlockGroupsMBean
FSNamesystem is a container of both transient
and persisted name-space state, and does all the book-keeping
work on a NameNode.
Its roles are briefly described below:
1) Is the container for BlockManager, DatanodeManager,
DelegationTokens, LeaseManager, etc. services.
2) RPC calls that modify or inspect the name-space
should get delegated here.
3) Anything that touches only blocks (eg. block reports),
it delegates to BlockManager.
4) Anything that touches only file information (eg. permissions, mkdirs),
it delegates to FSDirectory.
5) Anything that crosses two of the above components should be
coordinated here.
6) Logs mutations to FSEditLog.
This class and its contents keep:
1) Valid fsname --> blocklist (kept on disk, logged)
2) Set of all valid blocks (inverted #1)
3) block --> machinelist (kept in memory, rebuilt dynamically
from reports)
4) machine --> blocklist (inverted #2)
5) LRU cache of updated-heartbeat machines
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.slf4j.LoggerLogger for audit events, noting successful FSNamesystem operations.static final Stringstatic final booleanstatic final org.slf4j.Logger -
Method Summary
Modifier and TypeMethodDescriptionvoidCheck if snapshot roots are created for all existing snapshottable directories.voidcheckErasureCodingSupported(String operationName) Check whether operation is supported.voidvoidcpLock()Lock the checkpoint lockvoidLock the checkpoint lock interrupiblyvoidcpUnlock()Unlock the checkpoint lockvoidgcDeletedSnapshot(String snapshotRoot, String snapshotName) longReturn count of badly distributed blockslongintgetBlockCollection(long id) longTime when block deletions will beginGets the block pool id.longGet the total space used by the block pools of this namenode.getBlocks(org.apache.hadoop.hdfs.protocol.DatanodeID datanode, long size, long minimumBlockSize, long timeInterval, org.apache.hadoop.fs.StorageType storageType) return a list of blocks & their locations ondatanodewhose total size issizelongGet the total number of blocks in the system.longGets number of bytes in the blocks in future generation stamps.longReturn total bytes of erasure coded future block groups.longReturn total bytes of future blocks.longGets the total cache capacity of the datanode (in bytes).longGets the amount of cache used by the datanode (in bytes).longFree (unused) storage capacityfloatlongTotal storage capacityfloatlongUsed storage capacityfloatlongGets the cluster id.Get the compilation information which contains date, user and branch.longGet the total number of COMPLETE blocks in the system.longReturn count of erasure coded block groups that are corrupt.Get the list of corrupt files.intGet the length of the list of corrupt files.longReturns number of blocks with corrupt replicaslongReturn corrupt blocks count.longGet the current number of delegation tokens in memory.Returned information is a JSON representation of map with host name as the key and value is a map of dead node attribute keys to its values.Returned information is a JSON representation of map with host name as the key and value is a map of decommissioning node attribute keys to its values.intGet the number of distinct versions of live datanodes.Get the number of live datanodes for each distinct versions.org.apache.hadoop.hdfs.protocol.ECTopologyVerifierResultgetECTopologyResultForPolicies(String[] policyNames) Verifies if the given policies are supported in the given cluster setup.intReturns the layout version in effect.Get the enabled erasure coding policies separated with comma.Returned information is a JSON representation of map with host name of nodes entering maintenance as the key and value as a map of various node attributes to its values.longReturns an estimate of total capacity lost due to volume failures in bytes across all live data nodes.longintorg.apache.hadoop.fs.BatchedRemoteIterator.BatchedListEntries<org.apache.hadoop.hdfs.protocol.OpenFileEntry>getFilesBlockingDecom(long prevId, String path) longTotal number of files and directorieslonggetFree()Gets total non-used raw bytes.intReturns the length of the wait Queue for the FSNameSystemLock.The state of the file system: Safemode or OperationallongGets the total number of erasure coded low redundancy blocks on the cluster with the highest risk of loss.longGets the total number of replicated low redundancy blocks on the cluster with the highest risk of loss.Get information about the transaction ID, including the last applied transaction ID and the most recent checkpoint's transaction ID.longlonglongUsed as ad hoc to check the time stamp of the last full cycle oflazyPersistFileScrubberdaemon.longReturned information is a JSON representation of map with host name as the key and value is a map of live node attribute keys to its values.longGet aggregated count of all blocks with low redundancy.longReturn count of erasure coded block groups with low redundancy.longReturn low redundancy blocks count.intlonglongReturn the maximum number of inodes in the file systemlonglonglongReturn count of erasure coded block groups that are missing.longReturn missing blocks count.longReturn count of missing blocks with replication factor one.longGet namenode directory size.Get status information about the directories storing image and edits logs of the NN.Get status information about the journals of the NN.static Collection<URI>getNamespaceDirs(org.apache.hadoop.conf.Configuration conf) getNamespaceEditsDirs(org.apache.hadoop.conf.Configuration conf) Return an ordered list of edits directories to write to.getNamespaceEditsDirs(org.apache.hadoop.conf.Configuration conf, boolean includeShared) longGets the NN start time in milliseconds.Get Max, Median, Min and Standard Deviation of DataNodes usage.longGets total used space by data nodes for non DFS purposes such as storing temporary files on the local file system.longGet the total number of active clients holding lease in the system.longGets the total number of badly distributed blocks.longGets the total number of missing blocks on the cluster.longGets the total number of missing blocks on the cluster with replication factor 1.longGets the total number of snapshottable dirs in the system.intNumber of dead data nodesintNumber of decommissioned dead data nodesintNumber of decommissioned Live data nodesintNumber of data nodes that are in the decommissioning stateintReturn the number of encryption zones in the system.intlongGet the number of files under construction in the system.intintintintNumber of Live data nodeslonglongintintintNumber of stale data nodesintStorages are marked as "content stale" after NN restart or fails over and before NN receives the first Heartbeat followed by the first Blockreport.longintlongNumber of blocks pending deletionlongReturn count of erasure coded blocks that are pending deletion.longReturn count of blocks that are pending deletion.longGet aggregated count of all blocks pending to be reconstructed.longDeprecated.intReturns the number of paths to be processed by storage policy satisfier.floatGet the total space used by the block pool as percentage of total capacity.floatGets the total remaining space by data nodes as percentage of total capacity.floatGets the total used space by data nodes as percentage of total capacity.longlongGets capacity of the provided storage mounted, in bytes.longTotal PROVIDED storage capacity.org.apache.hadoop.crypto.key.KeyProviderCryptoExtensionintlongfloatGet the progress of the reconstruction queues initialisation.static Collection<URI>getRequiredNamespaceEditsDirs(org.apache.hadoop.conf.Configuration conf) Get all edits dirs which are required.org.apache.hadoop.ipc.RetryCacheorg.apache.hadoop.hdfs.protocol.RollingUpgradeInfoorg.apache.hadoop.hdfs.protocol.RollingUpgradeInfo.BeanGets the RollingUpgrade information.Gets the safemode status.longBlocks scheduled for replicationorg.apache.hadoop.fs.FsServerDefaultsgetSharedEditsDirs(org.apache.hadoop.conf.Configuration conf) Returns edit directories that are shared between primary and secondary.org.apache.hadoop.hdfs.protocol.SnapshotStatus[]getSnapshotListing(String snapshotRoot) Get the list of snapshots for a given snapshottable directory.The statistics of snapshotsorg.apache.hadoop.hdfs.protocol.SnapshottableDirectoryStatus[]Get the list of snapshottable directories that are owned by the current user.Get the version of software running on the Namenode.byte[]getSrcPathsHash(String[] srcs) longorg.apache.hadoop.ha.HAServiceProtocol.HAServiceStategetState()intGets the number of threads.Returns a nested JSON object listing the top users for different RPC operations over tracked time windows.longgetTotal()Gets total raw bytes including non-dfs used space.longGets the total numbers of blocks on the cluster.longReturn total number of erasure coded block groups.intTotal number of connections.longReturn total number of replicated blocks.longReturn total number of Sync Operations on FSEditLog.Return total time spent doing sync operations on FSEditLog.longlonglongDeprecated.longgetUsed()Gets the used space by data nodes.Verifies whether the cluster setup can support all enabled EC policies.Class representing Namenode information for JMX interfaces.intNumber of failed data volumes across all live data nodes.longbooleanhasReadLock(RwLockMode lockMode) Check if the current thread holds read lock.booleanhasWriteLock(RwLockMode lockMode) Check if the current thread holds write lock.booleanbooleanbooleanIs the system in safe mode?booleanisInSnapshot(long blockCollectionID) booleanbooleanIs the system in startup safe mode, i.e. the system is starting up with safe mode turned on automatically?booleanbooleanbooleanIs rolling upgrade in progress?booleanIs this name system running?booleanChecks if upgrade is finalized.voidlogExpireDelegationToken(org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier id) Log the cancellation of expired tokens to edit logs.voidlogUpdateMasterKey(org.apache.hadoop.security.token.delegation.DelegationKey key) Log the updateMasterKey operation to edit logs.voidprocessIncrementalBlockReport(org.apache.hadoop.hdfs.protocol.DatanodeID nodeID, StorageReceivedDeletedBlocks srdb) voidreadLock(RwLockMode lockMode) Acquire read lock.voidreadLockInterruptibly(RwLockMode lockMode) Acquire read lock, unless interrupted while waiting.voidreadUnlock(String opName, Supplier<String> lockReportInfoSupplier) voidreadUnlock(RwLockMode lockMode, String opName) Release read lock with operation name.voidreadUnlock(RwLockMode lockMode, String opName, Supplier<String> lockReportInfoSupplier) voidremoveXattr(long id, String xattrName) Remove xAttr from the inode.voidvoidsetCreatedRollbackImages(boolean created) voidvoidSet the FSDirectory.protected voidsetImageLoaded(boolean flag) voidsetMetricsEnabled(boolean metricsEnabled) voidsetNeedRollbackFsImage(boolean needRollbackFsImage) voidsetNNResourceChecker(NameNodeResourceChecker nnResourceChecker) voidsetReadLockReportingThresholdMs(long readLockReportingThresholdMs) voidsetWriteLockReportingThresholdMs(long writeLockReportingThresholdMs) voidvoidverifyToken(org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier identifier, byte[] password) Verifies that the given identifier and password are valid and match.voidwriteLock(RwLockMode lockMode) Acquire write lock.voidwriteLockInterruptibly(RwLockMode lockMode) Acquire write lock, unless interrupted while waiting.voidwriteUnlock(String opName, boolean suppressWriteLockReport) voidwriteUnlock(String opName, Supplier<String> lockReportInfoSupplier) voidwriteUnlock(RwLockMode lockMode, String opName) Release write lock with operation name.voidwriteUnlock(RwLockMode lockMode, String opName, boolean suppressWriteLockReport) voidwriteUnlock(RwLockMode lockMode, String opName, Supplier<String> lockReportInfoSupplier) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.hdfs.util.RwLock
hasReadLock, hasWriteLock, readLock, readLockInterruptibly, readUnlock, readUnlock, writeLock, writeLockInterruptibly, writeUnlock, writeUnlock
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG -
DFS_NAMENODE_SNAPSHOT_TRASHROOT_ENABLED
- See Also:
-
DFS_NAMENODE_SNAPSHOT_TRASHROOT_ENABLED_DEFAULT
public static final boolean DFS_NAMENODE_SNAPSHOT_TRASHROOT_ENABLED_DEFAULT- See Also:
-
AUDIT_LOG
public static final org.slf4j.Logger AUDIT_LOGLogger for audit events, noting successful FSNamesystem operations. Emits to FSNamesystem.audit at INFO. Each event causes a set of tab-separatedkey=valuepairs to be written for the following properties:ugi=<ugi in RPC> ip=<remote IP> cmd=<command> src=<src path> dst=<dst path (optional)> perm=<permissions (optional)>
-
-
Method Details
-
setImageLoaded
protected void setImageLoaded(boolean flag) -
getLazyPersistFileScrubberTS
@VisibleForTesting public long getLazyPersistFileScrubberTS()Used as ad hoc to check the time stamp of the last full cycle oflazyPersistFileScrubberdaemon. This is used by the Junit tests to block untillazyPersistFileScrubberTSis updated.- Returns:
- the current
lazyPersistFileScrubberTSiflazyPersistFileScrubberis not null.
-
isHaEnabled
public boolean isHaEnabled() -
getAuditLoggers
-
getRetryCache
@VisibleForTesting public org.apache.hadoop.ipc.RetryCache getRetryCache() -
getLeaseRecheckIntervalMs
@VisibleForTesting public long getLeaseRecheckIntervalMs() -
getMaxLockHoldToReleaseLeaseMs
@VisibleForTesting public long getMaxLockHoldToReleaseLeaseMs() -
getMaxListOpenFilesResponses
public int getMaxListOpenFilesResponses() -
getProvider
@VisibleForTesting public org.apache.hadoop.crypto.key.KeyProviderCryptoExtension getProvider() -
startSecretManagerIfNecessary
public void startSecretManagerIfNecessary()- Specified by:
startSecretManagerIfNecessaryin interfaceNamesystem
-
inTransitionToActive
public boolean inTransitionToActive()- Specified by:
inTransitionToActivein interfaceNamesystem- Returns:
- Whether the namenode is transitioning to active state and is in the middle of the starting active services.
-
checkOperation
public void checkOperation(NameNode.OperationCategory op) throws org.apache.hadoop.ipc.StandbyException - Throws:
org.apache.hadoop.ipc.StandbyException
-
getNamespaceDirs
-
getRequiredNamespaceEditsDirs
public static Collection<URI> getRequiredNamespaceEditsDirs(org.apache.hadoop.conf.Configuration conf) Get all edits dirs which are required. If any shared edits dirs are configured, these are also included in the set of required dirs.- Parameters:
conf- the HDFS configuration.- Returns:
- all required dirs.
-
getNamespaceEditsDirs
public static List<URI> getNamespaceEditsDirs(org.apache.hadoop.conf.Configuration conf) throws IOException Return an ordered list of edits directories to write to. The list is ordered such that all shared edits directories are ordered before non-shared directories, and any duplicates are removed. The order they are specified in the configuration is retained.- Returns:
- Collection of shared edits directories.
- Throws:
IOException- if multiple shared edits directories are configured
-
getNamespaceEditsDirs
public static List<URI> getNamespaceEditsDirs(org.apache.hadoop.conf.Configuration conf, boolean includeShared) throws IOException - Throws:
IOException
-
readLock
Description copied from interface:RwLockAcquire read lock. -
readLockInterruptibly
Description copied from interface:RwLockAcquire read lock, unless interrupted while waiting.- Specified by:
readLockInterruptiblyin interfaceRwLock- Parameters:
lockMode- The lock type for acquiring a read lock- Throws:
InterruptedException- if the thread is interrupted
-
readUnlock
Description copied from interface:RwLockRelease read lock with operation name.- Specified by:
readUnlockin interfaceRwLock- Parameters:
lockMode- The lock type for releasing the read lockopName- Option name.
-
readUnlock
-
readUnlock
-
writeLock
Description copied from interface:RwLockAcquire write lock. -
writeLockInterruptibly
Description copied from interface:RwLockAcquire write lock, unless interrupted while waiting.- Specified by:
writeLockInterruptiblyin interfaceRwLock- Parameters:
lockMode- The lock type for acquiring a write lock- Throws:
InterruptedException- if the thread is interrupted
-
writeUnlock
Description copied from interface:RwLockRelease write lock with operation name.- Specified by:
writeUnlockin interfaceRwLock- Parameters:
lockMode- The lock type for releasing the write lockopName- Option name.
-
writeUnlock
-
writeUnlock
-
writeUnlock
-
writeUnlock
public void writeUnlock(RwLockMode lockMode, String opName, Supplier<String> lockReportInfoSupplier) -
hasWriteLock
Description copied from interface:RwLockCheck if the current thread holds write lock.- Specified by:
hasWriteLockin interfaceRwLock- Parameters:
lockMode- The lock type used to check whether a write lock is held- Returns:
- true if the write lock is held by the current thread, else false.
-
hasReadLock
Description copied from interface:RwLockCheck if the current thread holds read lock.- Specified by:
hasReadLockin interfaceRwLock- Parameters:
lockMode- The lock type used to check whether a read lock is held- Returns:
- true if the read lock is held by the current thread, else false
-
getReadHoldCount
public int getReadHoldCount() -
cpLock
public void cpLock()Lock the checkpoint lock -
cpLockInterruptibly
Lock the checkpoint lock interrupibly- Throws:
InterruptedException
-
cpUnlock
public void cpUnlock()Unlock the checkpoint lock -
isRunning
public boolean isRunning()Description copied from interface:NamesystemIs this name system running?- Specified by:
isRunningin interfaceNamesystem
-
isInStandbyState
public boolean isInStandbyState() -
getBlocks
public BlocksWithLocations getBlocks(org.apache.hadoop.hdfs.protocol.DatanodeID datanode, long size, long minimumBlockSize, long timeInterval, org.apache.hadoop.fs.StorageType storageType) throws IOException return a list of blocks & their locations ondatanodewhose total size issize- Parameters:
datanode- on which blocks are locatedsize- total size of blocksminimumBlockSize- each block should be of this minimum Block SizetimeInterval- prefer to get blocks which are belong to the cold files accessed before the time intervalstorageType- the given storage typeStorageType- Throws:
IOException
-
getFilesBlockingDecom
public org.apache.hadoop.fs.BatchedRemoteIterator.BatchedListEntries<org.apache.hadoop.hdfs.protocol.OpenFileEntry> getFilesBlockingDecom(long prevId, String path) -
getServerDefaults
@VisibleForTesting public org.apache.hadoop.fs.FsServerDefaults getServerDefaults() throws org.apache.hadoop.ipc.StandbyException- Throws:
org.apache.hadoop.ipc.StandbyException
-
isInSnapshot
public boolean isInSnapshot(long blockCollectionID) - Specified by:
isInSnapshotin interfaceNamesystem
-
getBlockCollection
- Specified by:
getBlockCollectionin interfaceNamesystem
-
getSrcPathsHash
-
getFSImage
-
getEditLog
-
getMissingBlocksCount
@Metric({"MissingBlocks","Number of missing blocks"}) public long getMissingBlocksCount() -
getMissingReplOneBlocksCount
@Metric({"MissingReplOneBlocks","Number of missing blocks with replication factor 1"}) public long getMissingReplOneBlocksCount() -
getBadlyDistributedBlocksCount
@Metric({"BadlyDistBlocks","Number of Badly Distributed Blocks"}) public long getBadlyDistributedBlocksCount() -
getExpiredHeartbeats
@Metric(value={"ExpiredHeartbeats","Number of expired heartbeats"}, type=COUNTER) public int getExpiredHeartbeats() -
getTransactionsSinceLastCheckpoint
@Metric({"TransactionsSinceLastCheckpoint","Number of transactions since last checkpoint"}) public long getTransactionsSinceLastCheckpoint() -
getTransactionsSinceLastLogRoll
@Metric({"TransactionsSinceLastLogRoll","Number of transactions since last edit log roll"}) public long getTransactionsSinceLastLogRoll() -
getLastWrittenTransactionId
@Metric({"LastWrittenTransactionId","Transaction ID written to the edit log"}) public long getLastWrittenTransactionId() -
getLastCheckpointTime
@Metric({"LastCheckpointTime","Time in milliseconds since the epoch of the last checkpoint"}) public long getLastCheckpointTime() -
getCapacityTotal
@Metric({"CapacityTotal","Total raw capacity of data nodes in bytes"}) public long getCapacityTotal()Description copied from interface:FSNamesystemMBeanTotal storage capacity- Specified by:
getCapacityTotalin interfaceFSNamesystemMBean- Returns:
- - total capacity in bytes
-
getCapacityTotalGB
@Metric({"CapacityTotalGB","Total raw capacity of data nodes in GB"}) public float getCapacityTotalGB() -
getCapacityUsed
@Metric({"CapacityUsed","Total used capacity across all data nodes in bytes"}) public long getCapacityUsed()Description copied from interface:FSNamesystemMBeanUsed storage capacity- Specified by:
getCapacityUsedin interfaceFSNamesystemMBean- Returns:
- - used capacity in bytes
-
getCapacityUsedGB
@Metric({"CapacityUsedGB","Total used capacity across all data nodes in GB"}) public float getCapacityUsedGB() -
getCapacityRemaining
@Metric({"CapacityRemaining","Remaining capacity in bytes"}) public long getCapacityRemaining()Description copied from interface:FSNamesystemMBeanFree (unused) storage capacity- Specified by:
getCapacityRemainingin interfaceFSNamesystemMBean- Returns:
- - free capacity in bytes
-
getProvidedCapacityTotal
@Metric({"ProvidedCapacityTotal","Total space used in PROVIDED storage in bytes"}) public long getProvidedCapacityTotal()Description copied from interface:FSNamesystemMBeanTotal PROVIDED storage capacity.- Specified by:
getProvidedCapacityTotalin interfaceFSNamesystemMBean- Returns:
- - total PROVIDED storage capacity in bytes
-
getCapacityRemainingGB
@Metric({"CapacityRemainingGB","Remaining capacity in GB"}) public float getCapacityRemainingGB() -
getCapacityUsedNonDFS
@Metric({"CapacityUsedNonDFS","Total space used by data nodes for non DFS purposes in bytes"}) public long getCapacityUsedNonDFS() -
getTotalLoad
@Metric public int getTotalLoad()Total number of connections.- Specified by:
getTotalLoadin interfaceFSNamesystemMBean- Returns:
- - total load of FSNamesystem
-
getNumSnapshottableDirs
@Metric({"SnapshottableDirectories","Number of snapshottable directories"}) public int getNumSnapshottableDirs() -
getNumSnapshots
@Metric({"Snapshots","The number of snapshots"}) public int getNumSnapshots() -
getSnapshotStats
Description copied from interface:FSNamesystemMBeanThe statistics of snapshots- Specified by:
getSnapshotStatsin interfaceFSNamesystemMBean
-
getNumEncryptionZones
@Metric({"NumEncryptionZones","The number of encryption zones"}) public int getNumEncryptionZones()Description copied from interface:FSNamesystemMBeanReturn the number of encryption zones in the system.- Specified by:
getNumEncryptionZonesin interfaceFSNamesystemMBean
-
getCurrentTokensCount
@Metric({"CurrentTokensCount","The number of delegation tokens"}) public long getCurrentTokensCount()Description copied from interface:FSNamesystemMBeanGet the current number of delegation tokens in memory.- Specified by:
getCurrentTokensCountin interfaceFSNamesystemMBean- Returns:
- number of DTs
-
getPendingSPSPaths
@Metric({"PendingSPSPaths","The number of paths to be processed by storage policy satisfier"}) public int getPendingSPSPaths()Description copied from interface:FSNamesystemMBeanReturns the number of paths to be processed by storage policy satisfier.- Specified by:
getPendingSPSPathsin interfaceFSNamesystemMBean- Returns:
- The number of paths to be processed by sps.
-
getReconstructionQueuesInitProgress
@Metric public float getReconstructionQueuesInitProgress()Get the progress of the reconstruction queues initialisation.- Specified by:
getReconstructionQueuesInitProgressin interfaceFSNamesystemMBean- Returns:
- Returns values between 0 and 1 for the progress.
-
getFsLockQueueLength
@Metric({"LockQueueLength","Number of threads waiting to acquire FSNameSystemLock"}) public int getFsLockQueueLength()Returns the length of the wait Queue for the FSNameSystemLock. A larger number here indicates lots of threads are waiting for FSNameSystemLock.- Specified by:
getFsLockQueueLengthin interfaceFSNamesystemMBean- Returns:
- int - Number of Threads waiting to acquire FSNameSystemLock
-
getNumOfReadLockLongHold
@Metric(value={"ReadLockLongHoldCount","The number of time the read lock has been held for longer than the threshold"}, type=COUNTER) public long getNumOfReadLockLongHold() -
getNumOfWriteLockLongHold
@Metric(value={"WriteLockLongHoldCount","The number of time the write lock has been held for longer than the threshold"}, type=COUNTER) public long getNumOfWriteLockLongHold() -
getBlocksTotal
@Metric public long getBlocksTotal()Get the total number of blocks in the system.- Specified by:
getBlocksTotalin interfaceFSNamesystemMBean- Returns:
- - number of allocated blocks
-
getNumFilesUnderConstruction
@Metric({"NumFilesUnderConstruction","Number of files under construction"}) public long getNumFilesUnderConstruction()Get the number of files under construction in the system. -
getNumActiveClients
@Metric({"NumActiveClients","Number of active clients holding lease"}) public long getNumActiveClients()Get the total number of active clients holding lease in the system. -
getCompleteBlocksTotal
public long getCompleteBlocksTotal()Get the total number of COMPLETE blocks in the system. For safe mode only complete blocks are counted. This is invoked only during NN startup and checkpointing. -
isInSafeMode
public boolean isInSafeMode()Description copied from interface:SafeModeIs the system in safe mode?- Specified by:
isInSafeModein interfaceSafeMode
-
isInStartupSafeMode
public boolean isInStartupSafeMode()Description copied from interface:SafeModeIs the system in startup safe mode, i.e. the system is starting up with safe mode turned on automatically?- Specified by:
isInStartupSafeModein interfaceSafeMode
-
processIncrementalBlockReport
public void processIncrementalBlockReport(org.apache.hadoop.hdfs.protocol.DatanodeID nodeID, StorageReceivedDeletedBlocks srdb) throws IOException - Throws:
IOException
-
getMaxObjects
public long getMaxObjects()Description copied from interface:FSNamesystemMBeanReturn the maximum number of inodes in the file system- Specified by:
getMaxObjectsin interfaceFSNamesystemMBean
-
getFilesTotal
@Metric public long getFilesTotal()Description copied from interface:FSNamesystemMBeanTotal number of files and directories- Specified by:
getFilesTotalin interfaceFSNamesystemMBean- Returns:
- - num of files and directories
-
getPendingReplicationBlocks
Deprecated.Get aggregated count of all blocks pending to be reconstructed.- Specified by:
getPendingReplicationBlocksin interfaceFSNamesystemMBean
-
getPendingReconstructionBlocks
@Metric public long getPendingReconstructionBlocks()Get aggregated count of all blocks pending to be reconstructed.- Specified by:
getPendingReconstructionBlocksin interfaceFSNamesystemMBean- Returns:
- Number of blocks to be replicated.
-
getUnderReplicatedBlocks
Deprecated.- UsegetLowRedundancyBlocks()instead.Get aggregated count of all blocks with low redundancy.- Specified by:
getUnderReplicatedBlocksin interfaceFSNamesystemMBean
-
getLowRedundancyBlocks
@Metric public long getLowRedundancyBlocks()Get aggregated count of all blocks with low redundancy.- Specified by:
getLowRedundancyBlocksin interfaceFSNamesystemMBean- Returns:
- Number of blocks with low redundancy.
-
getCorruptReplicaBlocks
@Metric({"CorruptBlocks","Number of blocks with corrupt replicas"}) public long getCorruptReplicaBlocks()Returns number of blocks with corrupt replicas -
getScheduledReplicationBlocks
@Metric public long getScheduledReplicationBlocks()Description copied from interface:FSNamesystemMBeanBlocks scheduled for replication- Specified by:
getScheduledReplicationBlocksin interfaceFSNamesystemMBean- Returns:
- - num of blocks scheduled for replication
-
getPendingDeletionBlocks
@Metric public long getPendingDeletionBlocks()Description copied from interface:FSNamesystemMBeanNumber of blocks pending deletion- Specified by:
getPendingDeletionBlocksin interfaceFSNamesystemMBean- Returns:
- number of blocks pending deletion
-
getLowRedundancyReplicatedBlocks
@Metric({"LowRedundancyReplicatedBlocks","Number of low redundancy replicated blocks"}) public long getLowRedundancyReplicatedBlocks()Description copied from interface:ReplicatedBlocksMBeanReturn low redundancy blocks count.- Specified by:
getLowRedundancyReplicatedBlocksin interfaceReplicatedBlocksMBean
-
getCorruptReplicatedBlocks
@Metric({"CorruptReplicatedBlocks","Number of corrupted replicated blocks"}) public long getCorruptReplicatedBlocks()Description copied from interface:ReplicatedBlocksMBeanReturn corrupt blocks count.- Specified by:
getCorruptReplicatedBlocksin interfaceReplicatedBlocksMBean
-
getMissingReplicatedBlocks
@Metric({"MissingReplicatedBlocks","Number of missing replicated blocks"}) public long getMissingReplicatedBlocks()Description copied from interface:ReplicatedBlocksMBeanReturn missing blocks count.- Specified by:
getMissingReplicatedBlocksin interfaceReplicatedBlocksMBean
-
getMissingReplicationOneBlocks
@Metric({"MissingReplicationOneBlocks","Number of missing replicated blocks with replication factor 1"}) public long getMissingReplicationOneBlocks()Description copied from interface:ReplicatedBlocksMBeanReturn count of missing blocks with replication factor one.- Specified by:
getMissingReplicationOneBlocksin interfaceReplicatedBlocksMBean
-
getBadlyDistributedBlocks
@Metric({"BadlyDistributedBlocks","Number of badly distributed blocks"}) public long getBadlyDistributedBlocks()Description copied from interface:ReplicatedBlocksMBeanReturn count of badly distributed blocks- Specified by:
getBadlyDistributedBlocksin interfaceReplicatedBlocksMBean
-
getHighestPriorityLowRedundancyReplicatedBlocks
@Metric({"HighestPriorityLowRedundancyReplicatedBlocks","Number of replicated blocks which have the highest risk of loss."}) public long getHighestPriorityLowRedundancyReplicatedBlocks()Description copied from interface:NameNodeMXBeanGets the total number of replicated low redundancy blocks on the cluster with the highest risk of loss.- Specified by:
getHighestPriorityLowRedundancyReplicatedBlocksin interfaceNameNodeMXBean- Returns:
- the total number of low redundancy blocks on the cluster with the highest risk of loss.
-
getHighestPriorityLowRedundancyECBlocks
@Metric({"HighestPriorityLowRedundancyECBlocks","Number of erasure coded blocks which have the highest risk of loss."}) public long getHighestPriorityLowRedundancyECBlocks()Description copied from interface:NameNodeMXBeanGets the total number of erasure coded low redundancy blocks on the cluster with the highest risk of loss.- Specified by:
getHighestPriorityLowRedundancyECBlocksin interfaceNameNodeMXBean- Returns:
- the total number of low redundancy blocks on the cluster with the highest risk of loss.
-
getBytesInFutureReplicatedBlocks
@Metric({"BytesInFutureReplicatedBlocks","Total bytes in replicated blocks with future generation stamp"}) public long getBytesInFutureReplicatedBlocks()Description copied from interface:ReplicatedBlocksMBeanReturn total bytes of future blocks.- Specified by:
getBytesInFutureReplicatedBlocksin interfaceReplicatedBlocksMBean
-
getPendingDeletionReplicatedBlocks
@Metric({"PendingDeletionReplicatedBlocks","Number of replicated blocks that are pending deletion"}) public long getPendingDeletionReplicatedBlocks()Description copied from interface:ReplicatedBlocksMBeanReturn count of blocks that are pending deletion.- Specified by:
getPendingDeletionReplicatedBlocksin interfaceReplicatedBlocksMBean
-
getTotalReplicatedBlocks
@Metric({"TotalReplicatedBlocks","Total number of replicated blocks"}) public long getTotalReplicatedBlocks()Description copied from interface:ReplicatedBlocksMBeanReturn total number of replicated blocks.- Specified by:
getTotalReplicatedBlocksin interfaceReplicatedBlocksMBean
-
getLowRedundancyECBlockGroups
@Metric({"LowRedundancyECBlockGroups","Number of erasure coded block groups with low redundancy"}) public long getLowRedundancyECBlockGroups()Description copied from interface:ECBlockGroupsMBeanReturn count of erasure coded block groups with low redundancy.- Specified by:
getLowRedundancyECBlockGroupsin interfaceECBlockGroupsMBean
-
getCorruptECBlockGroups
@Metric({"CorruptECBlockGroups","Number of erasure coded block groups that are corrupt"}) public long getCorruptECBlockGroups()Description copied from interface:ECBlockGroupsMBeanReturn count of erasure coded block groups that are corrupt.- Specified by:
getCorruptECBlockGroupsin interfaceECBlockGroupsMBean
-
getMissingECBlockGroups
@Metric({"MissingECBlockGroups","Number of erasure coded block groups that are missing"}) public long getMissingECBlockGroups()Description copied from interface:ECBlockGroupsMBeanReturn count of erasure coded block groups that are missing.- Specified by:
getMissingECBlockGroupsin interfaceECBlockGroupsMBean
-
getBytesInFutureECBlockGroups
@Metric({"BytesInFutureECBlockGroups","Total bytes in erasure coded block groups with future generation stamp"}) public long getBytesInFutureECBlockGroups()Description copied from interface:ECBlockGroupsMBeanReturn total bytes of erasure coded future block groups.- Specified by:
getBytesInFutureECBlockGroupsin interfaceECBlockGroupsMBean
-
getPendingDeletionECBlocks
@Metric({"PendingDeletionECBlocks","Number of erasure coded blocks that are pending deletion"}) public long getPendingDeletionECBlocks()Description copied from interface:ECBlockGroupsMBeanReturn count of erasure coded blocks that are pending deletion.- Specified by:
getPendingDeletionECBlocksin interfaceECBlockGroupsMBean
-
getTotalECBlockGroups
@Metric({"TotalECBlockGroups","Total number of erasure coded block groups"}) public long getTotalECBlockGroups()Description copied from interface:ECBlockGroupsMBeanReturn total number of erasure coded block groups.- Specified by:
getTotalECBlockGroupsin interfaceECBlockGroupsMBean
-
getEnabledEcPolicies
@Metric({"EnabledEcPolicies","Enabled erasure coding policies"}) public String getEnabledEcPolicies()Get the enabled erasure coding policies separated with comma.- Specified by:
getEnabledEcPoliciesin interfaceECBlockGroupsMBean- Returns:
- the enabled erasure coding policies separated with comma.
-
getBlockDeletionStartTime
public long getBlockDeletionStartTime()Description copied from interface:FSNamesystemMBeanTime when block deletions will begin- Specified by:
getBlockDeletionStartTimein interfaceFSNamesystemMBean- Returns:
- time when block deletions will begin
-
getExcessBlocks
@Metric public long getExcessBlocks() -
getNumTimedOutPendingReconstructions
@Metric public long getNumTimedOutPendingReconstructions() -
getPostponedMisreplicatedBlocks
@Metric public long getPostponedMisreplicatedBlocks() -
getPendingDataNodeMessageCount
@Metric public int getPendingDataNodeMessageCount() -
getHAState
-
getMillisSinceLastLoadedEdits
@Metric public long getMillisSinceLastLoadedEdits() -
getBlockCapacity
@Metric public int getBlockCapacity() -
getState
public org.apache.hadoop.ha.HAServiceProtocol.HAServiceState getState() -
getFSState
Description copied from interface:FSNamesystemMBeanThe state of the file system: Safemode or Operational- Specified by:
getFSStatein interfaceFSNamesystemMBean- Returns:
- the state
-
getNumLiveDataNodes
@Metric({"NumLiveDataNodes","Number of datanodes which are currently live"}) public int getNumLiveDataNodes()Description copied from interface:FSNamesystemMBeanNumber of Live data nodes- Specified by:
getNumLiveDataNodesin interfaceFSNamesystemMBean- Returns:
- number of live data nodes
-
getNumDeadDataNodes
@Metric({"NumDeadDataNodes","Number of datanodes which are currently dead"}) public int getNumDeadDataNodes()Description copied from interface:FSNamesystemMBeanNumber of dead data nodes- Specified by:
getNumDeadDataNodesin interfaceFSNamesystemMBean- Returns:
- number of dead data nodes
-
getNumDecomLiveDataNodes
@Metric({"NumDecomLiveDataNodes","Number of datanodes which have been decommissioned and are now live"}) public int getNumDecomLiveDataNodes()Description copied from interface:FSNamesystemMBeanNumber of decommissioned Live data nodes- Specified by:
getNumDecomLiveDataNodesin interfaceFSNamesystemMBean- Returns:
- number of decommissioned live data nodes
-
getNumDecomDeadDataNodes
@Metric({"NumDecomDeadDataNodes","Number of datanodes which have been decommissioned and are now dead"}) public int getNumDecomDeadDataNodes()Description copied from interface:FSNamesystemMBeanNumber of decommissioned dead data nodes- Specified by:
getNumDecomDeadDataNodesin interfaceFSNamesystemMBean- Returns:
- number of decommissioned dead data nodes
-
getNumInServiceLiveDataNodes
@Metric({"NumInServiceLiveDataNodes","Number of live datanodes which are currently in service"}) public int getNumInServiceLiveDataNodes()- Specified by:
getNumInServiceLiveDataNodesin interfaceFSNamesystemMBean- Returns:
- Number of in-service data nodes, where NumInServiceDataNodes = NumLiveDataNodes - NumDecomLiveDataNodes - NumInMaintenanceLiveDataNodes
-
getVolumeFailuresTotal
@Metric({"VolumeFailuresTotal","Total number of volume failures across all Datanodes"}) public int getVolumeFailuresTotal()Description copied from interface:FSNamesystemMBeanNumber of failed data volumes across all live data nodes.- Specified by:
getVolumeFailuresTotalin interfaceFSNamesystemMBean- Returns:
- number of failed data volumes across all live data nodes
-
getEstimatedCapacityLostTotal
@Metric({"EstimatedCapacityLostTotal","An estimate of the total capacity lost due to volume failures"}) public long getEstimatedCapacityLostTotal()Description copied from interface:FSNamesystemMBeanReturns an estimate of total capacity lost due to volume failures in bytes across all live data nodes.- Specified by:
getEstimatedCapacityLostTotalin interfaceFSNamesystemMBean- Returns:
- estimate of total capacity lost in bytes
-
getNumDecommissioningDataNodes
@Metric({"NumDecommissioningDataNodes","Number of datanodes in decommissioning state"}) public int getNumDecommissioningDataNodes()Description copied from interface:FSNamesystemMBeanNumber of data nodes that are in the decommissioning state- Specified by:
getNumDecommissioningDataNodesin interfaceFSNamesystemMBean
-
getNumStaleDataNodes
@Metric({"StaleDataNodes","Number of datanodes marked stale due to delayed heartbeat"}) public int getNumStaleDataNodes()Description copied from interface:FSNamesystemMBeanNumber of stale data nodes- Specified by:
getNumStaleDataNodesin interfaceFSNamesystemMBean- Returns:
- number of stale data nodes
-
getNumStaleStorages
@Metric({"NumStaleStorages","Number of storages marked as content stale"}) public int getNumStaleStorages()Storages are marked as "content stale" after NN restart or fails over and before NN receives the first Heartbeat followed by the first Blockreport.- Specified by:
getNumStaleStoragesin interfaceFSNamesystemMBean- Returns:
- number of content stale storages
-
getTopUserOpCounts
Description copied from interface:FSNamesystemMBeanReturns a nested JSON object listing the top users for different RPC operations over tracked time windows.- Specified by:
getTopUserOpCountsin interfaceFSNamesystemMBean- Returns:
- JSON string
-
logUpdateMasterKey
public void logUpdateMasterKey(org.apache.hadoop.security.token.delegation.DelegationKey key) Log the updateMasterKey operation to edit logs.- Parameters:
key- new delegation key.
-
logExpireDelegationToken
public void logExpireDelegationToken(org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier id) Log the cancellation of expired tokens to edit logs.- Parameters:
id- token identifier to cancel
-
getVersion
Class representing Namenode information for JMX interfaces.- Specified by:
getVersionin interfaceNameNodeMXBean- Returns:
- the version.
-
getUsed
public long getUsed()Description copied from interface:NameNodeMXBeanGets the used space by data nodes.- Specified by:
getUsedin interfaceNameNodeMXBean- Returns:
- the used space by data nodes.
-
getFree
public long getFree()Description copied from interface:NameNodeMXBeanGets total non-used raw bytes.- Specified by:
getFreein interfaceNameNodeMXBean- Returns:
- total non-used raw bytes.
-
getTotal
public long getTotal()Description copied from interface:NameNodeMXBeanGets total raw bytes including non-dfs used space.- Specified by:
getTotalin interfaceNameNodeMXBean- Returns:
- the total raw bytes including non-dfs used space.
-
getProvidedCapacity
public long getProvidedCapacity()Description copied from interface:NameNodeMXBeanGets capacity of the provided storage mounted, in bytes.- Specified by:
getProvidedCapacityin interfaceNameNodeMXBean- Returns:
- the total raw bytes present in the provided storage.
-
getSafemode
Description copied from interface:NameNodeMXBeanGets the safemode status.- Specified by:
getSafemodein interfaceNameNodeMXBean- Returns:
- the safemode status.
-
isUpgradeFinalized
public boolean isUpgradeFinalized()Description copied from interface:NameNodeMXBeanChecks if upgrade is finalized.- Specified by:
isUpgradeFinalizedin interfaceNameNodeMXBean- Returns:
- true, if upgrade is finalized.
-
getNonDfsUsedSpace
public long getNonDfsUsedSpace()Description copied from interface:NameNodeMXBeanGets total used space by data nodes for non DFS purposes such as storing temporary files on the local file system.- Specified by:
getNonDfsUsedSpacein interfaceNameNodeMXBean- Returns:
- the non dfs space of the cluster.
-
getPercentUsed
public float getPercentUsed()Description copied from interface:NameNodeMXBeanGets the total used space by data nodes as percentage of total capacity.- Specified by:
getPercentUsedin interfaceNameNodeMXBean- Returns:
- the percentage of used space on the cluster.
-
getBlockPoolUsedSpace
public long getBlockPoolUsedSpace()Description copied from interface:NameNodeMXBeanGet the total space used by the block pools of this namenode.- Specified by:
getBlockPoolUsedSpacein interfaceNameNodeMXBean- Returns:
- the total space used by the block pools of this namenode.
-
getPercentBlockPoolUsed
public float getPercentBlockPoolUsed()Description copied from interface:NameNodeMXBeanGet the total space used by the block pool as percentage of total capacity.- Specified by:
getPercentBlockPoolUsedin interfaceNameNodeMXBean- Returns:
- the total space used by the block pool as percentage of total capacity.
-
getPercentRemaining
public float getPercentRemaining()Description copied from interface:NameNodeMXBeanGets the total remaining space by data nodes as percentage of total capacity.- Specified by:
getPercentRemainingin interfaceNameNodeMXBean- Returns:
- the percentage of the remaining space on the cluster.
-
getCacheCapacity
public long getCacheCapacity()Description copied from interface:NameNodeMXBeanGets the total cache capacity of the datanode (in bytes).- Specified by:
getCacheCapacityin interfaceNameNodeMXBean- Returns:
- the total cache capacity of the datanode (in bytes).
-
getCacheUsed
public long getCacheUsed()Description copied from interface:NameNodeMXBeanGets the amount of cache used by the datanode (in bytes).- Specified by:
getCacheUsedin interfaceNameNodeMXBean- Returns:
- the amount of cache used by the datanode (in bytes).
-
getTotalBlocks
public long getTotalBlocks()Description copied from interface:NameNodeMXBeanGets the total numbers of blocks on the cluster.- Specified by:
getTotalBlocksin interfaceNameNodeMXBean- Returns:
- the total number of blocks of the cluster.
-
getNumberOfMissingBlocks
public long getNumberOfMissingBlocks()Description copied from interface:NameNodeMXBeanGets the total number of missing blocks on the cluster.- Specified by:
getNumberOfMissingBlocksin interfaceNameNodeMXBean- Returns:
- the total number of missing blocks on the cluster.
-
getNumberOfMissingBlocksWithReplicationFactorOne
public long getNumberOfMissingBlocksWithReplicationFactorOne()Description copied from interface:NameNodeMXBeanGets the total number of missing blocks on the cluster with replication factor 1.- Specified by:
getNumberOfMissingBlocksWithReplicationFactorOnein interfaceNameNodeMXBean- Returns:
- the total number of missing blocks on the cluster with replication factor 1.
-
getNumberOfBadlyDistributedBlocks
public long getNumberOfBadlyDistributedBlocks()Description copied from interface:NameNodeMXBeanGets the total number of badly distributed blocks.- Specified by:
getNumberOfBadlyDistributedBlocksin interfaceNameNodeMXBean- Returns:
- the total number of badly distrubted blocks.
-
getThreads
public int getThreads()Description copied from interface:NameNodeMXBeanGets the number of threads.- Specified by:
getThreadsin interfaceNameNodeMXBean- Returns:
- the number of threads.
-
getLiveNodes
Returned information is a JSON representation of map with host name as the key and value is a map of live node attribute keys to its values.- Specified by:
getLiveNodesin interfaceNameNodeMXBean- Returns:
- the live node information.
-
getDeadNodes
Returned information is a JSON representation of map with host name as the key and value is a map of dead node attribute keys to its values.- Specified by:
getDeadNodesin interfaceNameNodeMXBean- Returns:
- the dead node information.
-
getDecomNodes
Returned information is a JSON representation of map with host name as the key and value is a map of decommissioning node attribute keys to its values.- Specified by:
getDecomNodesin interfaceNameNodeMXBean- Returns:
- the decommissioning node information.
-
getEnteringMaintenanceNodes
Returned information is a JSON representation of map with host name of nodes entering maintenance as the key and value as a map of various node attributes to its values.- Specified by:
getEnteringMaintenanceNodesin interfaceNameNodeMXBean- Returns:
- the information on nodes entering maintenance.
-
getClusterId
Description copied from interface:NameNodeMXBeanGets the cluster id.- Specified by:
getClusterIdin interfaceNameNodeMXBean- Returns:
- the cluster id.
-
getBlockPoolId
Description copied from interface:NameNodeMXBeanGets the block pool id.- Specified by:
getBlockPoolIdin interfaceNameNodeMXBean- Returns:
- the block pool id.
-
getNameDirStatuses
Description copied from interface:NameNodeMXBeanGet status information about the directories storing image and edits logs of the NN.- Specified by:
getNameDirStatusesin interfaceNameNodeMXBean- Returns:
- the name dir status information, as a JSON string.
-
getNodeUsage
Description copied from interface:NameNodeMXBeanGet Max, Median, Min and Standard Deviation of DataNodes usage.- Specified by:
getNodeUsagein interfaceNameNodeMXBean- Returns:
- the DataNode usage information, as a JSON string.
-
getNameJournalStatus
Description copied from interface:NameNodeMXBeanGet status information about the journals of the NN.- Specified by:
getNameJournalStatusin interfaceNameNodeMXBean- Returns:
- the name journal status information, as a JSON string.
-
getJournalTransactionInfo
Description copied from interface:NameNodeMXBeanGet information about the transaction ID, including the last applied transaction ID and the most recent checkpoint's transaction ID.- Specified by:
getJournalTransactionInfoin interfaceNameNodeMXBean- Returns:
- information about the transaction ID.
-
getNNStartedTimeInMillis
public long getNNStartedTimeInMillis()Description copied from interface:NameNodeMXBeanGets the NN start time in milliseconds.- Specified by:
getNNStartedTimeInMillisin interfaceNameNodeMXBean- Returns:
- the NN start time in msec.
-
getCompileInfo
Description copied from interface:NameNodeMXBeanGet the compilation information which contains date, user and branch.- Specified by:
getCompileInfoin interfaceNameNodeMXBean- Returns:
- the compilation information, as a JSON string.
-
getBlockManager
- Returns:
- the block manager.
-
setBlockManagerForTesting
-
getFSDirectory
- Specified by:
getFSDirectoryin interfaceNamesystem- Returns:
- the FSDirectory.
-
setFSDirectory
Set the FSDirectory. -
getCacheManager
- Specified by:
getCacheManagerin interfaceNamesystem- Returns:
- the cache manager.
-
getErasureCodingPolicyManager
- Returns:
- the ErasureCodingPolicyManager.
-
getHAContext
- Specified by:
getHAContextin interfaceNamesystem
-
getCorruptFiles
Description copied from interface:NameNodeMXBeanGet the list of corrupt files.- Specified by:
getCorruptFilesin interfaceNameNodeMXBean- Returns:
- the list of corrupt files, as a JSON string.
-
getCorruptFilesCount
public int getCorruptFilesCount()Description copied from interface:NameNodeMXBeanGet the length of the list of corrupt files.- Specified by:
getCorruptFilesCountin interfaceNameNodeMXBean- Returns:
- the length of the list of corrupt files.
-
getNumberOfSnapshottableDirs
public long getNumberOfSnapshottableDirs()Description copied from interface:NameNodeMXBeanGets the total number of snapshottable dirs in the system.- Specified by:
getNumberOfSnapshottableDirsin interfaceNameNodeMXBean- Returns:
- the total number of snapshottable dirs in the system.
-
getDistinctVersionCount
public int getDistinctVersionCount()Description copied from interface:NameNodeMXBeanGet the number of distinct versions of live datanodes.- Specified by:
getDistinctVersionCountin interfaceNameNodeMXBean- Returns:
- the number of distinct versions of live datanodes.
-
getDistinctVersions
Description copied from interface:NameNodeMXBeanGet the number of live datanodes for each distinct versions.- Specified by:
getDistinctVersionsin interfaceNameNodeMXBean- Returns:
- the number of live datanodes for each distinct versions.
-
getSoftwareVersion
Description copied from interface:NameNodeMXBeanGet the version of software running on the Namenode.- Specified by:
getSoftwareVersionin interfaceNameNodeMXBean- Returns:
- a string representing the version.
-
getNameDirSize
Description copied from interface:NameNodeMXBeanGet namenode directory size.- Specified by:
getNameDirSizein interfaceNameNodeMXBean- Returns:
- namenode directory size.
-
verifyToken
public void verifyToken(org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier identifier, byte[] password) throws org.apache.hadoop.security.token.SecretManager.InvalidToken, org.apache.hadoop.ipc.RetriableException Verifies that the given identifier and password are valid and match.- Parameters:
identifier- Token identifier.password- Password in the token.- Throws:
org.apache.hadoop.security.token.SecretManager.InvalidTokenorg.apache.hadoop.ipc.RetriableException
-
getEditLogTailer
-
getStandbyLastCheckpointTime
@VisibleForTesting public long getStandbyLastCheckpointTime() -
setEditLogTailerForTests
-
getFsLockForTests
-
getCpLockForTests
-
setNNResourceChecker
-
getSnapshotManager
-
getSnapshottableDirListing
public org.apache.hadoop.hdfs.protocol.SnapshottableDirectoryStatus[] getSnapshottableDirListing() throws IOExceptionGet the list of snapshottable directories that are owned by the current user. Return all the snapshottable directories if the current user is a super user.- Returns:
- The list of all the current snapshottable directories.
- Throws:
IOException- If an I/O error occurred.
-
getSnapshotListing
public org.apache.hadoop.hdfs.protocol.SnapshotStatus[] getSnapshotListing(String snapshotRoot) throws IOException Get the list of snapshots for a given snapshottable directory.- Returns:
- The list of all the snapshots for a snapshottable directory
- Throws:
IOException
-
gcDeletedSnapshot
- Throws:
IOException
-
setCreatedRollbackImages
public void setCreatedRollbackImages(boolean created) -
getRollingUpgradeInfo
public org.apache.hadoop.hdfs.protocol.RollingUpgradeInfo getRollingUpgradeInfo() -
isNeedRollbackFsImage
public boolean isNeedRollbackFsImage() -
setNeedRollbackFsImage
public void setNeedRollbackFsImage(boolean needRollbackFsImage) -
getRollingUpgradeStatus
public org.apache.hadoop.hdfs.protocol.RollingUpgradeInfo.Bean getRollingUpgradeStatus()Description copied from interface:NameNodeMXBeanGets the RollingUpgrade information.- Specified by:
getRollingUpgradeStatusin interfaceNameNodeMXBean- Returns:
- Rolling upgrade information if an upgrade is in progress. Else (e.g. if there is no upgrade or the upgrade is finalized), returns null.
-
isRollingUpgrade
public boolean isRollingUpgrade()Is rolling upgrade in progress? -
getEffectiveLayoutVersion
public int getEffectiveLayoutVersion()Returns the layout version in effect. Under normal operation, this is the same as the software's current layout version, defined inNameNodeLayoutVersion.CURRENT_LAYOUT_VERSION. During a rolling upgrade, this can retain the layout version that was persisted to metadata prior to starting the rolling upgrade, back to a lower bound defined inNameNodeLayoutVersion.MINIMUM_COMPATIBLE_LAYOUT_VERSION. New fsimage files and edit log segments will continue to be written with this older layout version, so that the files are still readable by the old software version if the admin chooses to downgrade.- Returns:
- layout version in effect
-
getECTopologyResultForPolicies
public org.apache.hadoop.hdfs.protocol.ECTopologyVerifierResult getECTopologyResultForPolicies(String[] policyNames) throws IOException Verifies if the given policies are supported in the given cluster setup. If not policy is specified checks for all enabled policies.- Parameters:
policyNames- name of policies.- Returns:
- the result if the given policies are supported in the cluster setup
- Throws:
IOException
-
removeXattr
Description copied from interface:NamesystemRemove xAttr from the inode.- Specified by:
removeXattrin interfaceNamesystem- Throws:
IOException
-
checkAndProvisionSnapshotTrashRoots
public void checkAndProvisionSnapshotTrashRoots()Check if snapshot roots are created for all existing snapshottable directories. Create them if not. Only the active NameNode needs to execute this in HA setup once it is out of safe mode. The function gets called while exiting safe mode or post starting the services in Active NameNode, but comes into effect post whichever event happens later.- Specified by:
checkAndProvisionSnapshotTrashRootsin interfaceNamesystem
-
getTotalSyncCount
@Metric({"TotalSyncCount","Total number of sync operations performed on edit logs"}) public long getTotalSyncCount()Return total number of Sync Operations on FSEditLog.- Specified by:
getTotalSyncCountin interfaceFSNamesystemMBean
-
getTotalSyncTimes
@Metric({"TotalSyncTimes","Total time spend in sync operation on various edit logs"}) public String getTotalSyncTimes()Return total time spent doing sync operations on FSEditLog.- Specified by:
getTotalSyncTimesin interfaceFSNamesystemMBean
-
getBytesInFuture
public long getBytesInFuture()Gets number of bytes in the blocks in future generation stamps.- Returns:
- number of bytes that can be deleted if exited from safe mode.
-
getNumInMaintenanceLiveDataNodes
@Metric({"NumInMaintenanceLiveDataNodes","Number of live Datanodes which are in maintenance state"}) public int getNumInMaintenanceLiveDataNodes()- Specified by:
getNumInMaintenanceLiveDataNodesin interfaceFSNamesystemMBean- Returns:
- Number of IN_MAINTENANCE live data nodes
-
getNumInMaintenanceDeadDataNodes
@Metric({"NumInMaintenanceDeadDataNodes","Number of dead Datanodes which are in maintenance state"}) public int getNumInMaintenanceDeadDataNodes()- Specified by:
getNumInMaintenanceDeadDataNodesin interfaceFSNamesystemMBean- Returns:
- Number of IN_MAINTENANCE dead data nodes
-
getNumEnteringMaintenanceDataNodes
@Metric({"NumEnteringMaintenanceDataNodes","Number of Datanodes that are entering the maintenance state"}) public int getNumEnteringMaintenanceDataNodes()- Specified by:
getNumEnteringMaintenanceDataNodesin interfaceFSNamesystemMBean- Returns:
- Number of ENTERING_MAINTENANCE data nodes
-
getVerifyECWithTopologyResult
Description copied from interface:NameNodeMXBeanVerifies whether the cluster setup can support all enabled EC policies.- Specified by:
getVerifyECWithTopologyResultin interfaceNameNodeMXBean- Returns:
- the result of the verification.
-
checkErasureCodingSupported
Check whether operation is supported.- Parameters:
operationName- the name of operation.- Throws:
UnsupportedActionException- throws UAE if not supported.
-
setMetricsEnabled
public void setMetricsEnabled(boolean metricsEnabled) -
isMetricsEnabled
@VisibleForTesting public boolean isMetricsEnabled() -
setReadLockReportingThresholdMs
public void setReadLockReportingThresholdMs(long readLockReportingThresholdMs) -
getReadLockReportingThresholdMs
@VisibleForTesting public long getReadLockReportingThresholdMs() -
setWriteLockReportingThresholdMs
public void setWriteLockReportingThresholdMs(long writeLockReportingThresholdMs) -
getWriteLockReportingThresholdMs
@VisibleForTesting public long getWriteLockReportingThresholdMs()
-
getLowRedundancyBlocks()instead.