@InterfaceAudience.Private @Metrics(context="dfs") public class FSNamesystem extends Object implements Namesystem, FSClusterStats, FSNamesystemMBean, NameNodeMXBean
Modifier and Type | Field and Description |
---|---|
static org.apache.commons.logging.Log |
auditLog
Logger for audit events, noting successful FSNamesystem operations.
|
static org.apache.commons.logging.Log |
LOG |
Modifier and Type | Method and Description |
---|---|
void |
adjustSafeModeBlockTotals(int deltaSafe,
int deltaTotal)
Adjust the total number of blocks safe and expected during safe mode.
|
long |
allocateNewInodeId()
Allocate a new inode ID.
|
void |
checkOperation(NameNode.OperationCategory op) |
void |
checkSafeMode()
Check safe mode conditions.
|
void |
checkSuperuserPrivilege()
Check if the user has superuser privilege.
|
void |
decrementSafeBlockCount(Block b)
Decrement number of blocks that reached minimal replication.
|
int |
getBlockCapacity() |
BlockManager |
getBlockManager() |
String |
getBlockPoolId()
Gets the block pool id.
|
long |
getBlockPoolUsedSpace()
Get the total space used by the block pools of this namenode
|
long |
getBlocksTotal()
Get the total number of blocks in the system.
|
long |
getCapacityRemaining()
Free (unused) storage capacity
|
float |
getCapacityRemainingGB() |
long |
getCapacityTotal()
Total storage capacity
|
float |
getCapacityTotalGB() |
long |
getCapacityUsed()
Used storage capacity
|
float |
getCapacityUsedGB() |
long |
getCapacityUsedNonDFS() |
String |
getClusterId()
Gets the cluster id.
|
long |
getCorruptReplicaBlocks()
Returns number of blocks with corrupt replicas
|
String |
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
|
String |
getDecomNodes()
Returned information is a JSON representation of map with host name as the
key and value is a map of decomisioning node attribute keys to its values
|
int |
getDistinctVersionCount()
Get the number of distinct versions of live datanodes
|
Map<String,Integer> |
getDistinctVersions()
Get the number of live datanodes for each distinct versions
|
FSEditLog |
getEditLog() |
EditLogTailer |
getEditLogTailer() |
long |
getExcessBlocks() |
int |
getExpiredHeartbeats() |
long |
getFilesTotal()
Total number of files and directories
|
long |
getFree()
Gets total non-used raw bytes.
|
FSDirectory |
getFSDirectory() |
FSImage |
getFSImage() |
String |
getFSState()
The state of the file system: Safemode or Operational
|
String |
getHAState() |
String |
getJournalTransactionInfo()
Get information about the transaction ID, including the last applied
transaction ID and the most recent checkpoint's transaction ID
|
long |
getLastCheckpointTime() |
long |
getLastInodeId() |
long |
getLastWrittenTransactionId() |
String |
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
|
long |
getMillisSinceLastLoadedEdits() |
long |
getMissingBlocksCount() |
String |
getNameDirStatuses()
Get status information about the directories storing image and edits logs
of the NN.
|
static Collection<URI> |
getNamespaceDirs(Configuration conf) |
static List<URI> |
getNamespaceEditsDirs(Configuration conf)
Return an ordered list of edits directories to write to.
|
static List<URI> |
getNamespaceEditsDirs(Configuration conf,
boolean includeShared) |
long |
getNonDfsUsedSpace()
Gets total used space by data nodes for non DFS purposes such as storing
temporary files on the local file system
|
long |
getNumberOfMissingBlocks()
Gets the total number of missing blocks on the cluster
|
int |
getNumDeadDataNodes()
Number of dead data nodes
|
int |
getNumLiveDataNodes()
Number of Live data nodes
|
int |
getNumSnapshots() |
int |
getNumSnapshottableDirs() |
int |
getNumStaleDataNodes()
Number of stale data nodes
|
int |
getPendingDataNodeMessageCount() |
long |
getPendingDeletionBlocks() |
long |
getPendingReplicationBlocks()
Blocks pending to be replicated
|
float |
getPercentBlockPoolUsed()
Get the total space used by the block pool as percentage of total capacity
|
float |
getPercentRemaining()
Gets the total remaining space by data nodes as percentage of total
capacity
|
float |
getPercentUsed()
Gets the total used space by data nodes as percentage of total capacity
|
long |
getPostponedMisreplicatedBlocks() |
static Collection<URI> |
getRequiredNamespaceEditsDirs(Configuration conf)
Get all edits dirs which are required.
|
RetryCache |
getRetryCache() |
String |
getSafemode()
Gets the safemode status
|
org.apache.hadoop.hdfs.server.namenode.FSNamesystem.SafeModeInfo |
getSafeModeInfoForTests() |
long |
getScheduledReplicationBlocks()
Blocks scheduled for replication
|
static List<URI> |
getSharedEditsDirs(Configuration conf)
Returns edit directories that are shared between primary and secondary.
|
SnapshotManager |
getSnapshotManager() |
SnapshottableDirectoryStatus[] |
getSnapshottableDirListing()
Get the list of snapshottable directories that are owned
by the current user.
|
String |
getSoftwareVersion()
Get the version of software running on the Namenode
|
int |
getThreads()
Gets the number of threads.
|
long |
getTotal()
Gets total raw bytes including non-dfs used space.
|
long |
getTotalBlocks()
Gets the total numbers of blocks on the cluster.
|
long |
getTotalFiles()
Gets the total number of files on the cluster
|
int |
getTotalLoad()
Total number of connections.
|
long |
getTransactionsSinceLastCheckpoint() |
long |
getTransactionsSinceLastLogRoll() |
long |
getUnderReplicatedBlocks()
Blocks under replicated
|
long |
getUsed()
Gets the used space by data nodes.
|
String |
getVersion()
Class representing Namenode information for JMX interfaces
|
boolean |
hasReadLock()
Check if the current thread holds read lock.
|
boolean |
hasReadOrWriteLock()
Check if the current thread holds read or write lock.
|
boolean |
hasWriteLock()
Check if the current thread holds write lock.
|
void |
incrementSafeBlockCount(int replication)
Increment number of blocks that reached minimal replication.
|
boolean |
isAuditEnabled() |
boolean |
isAvoidingStaleDataNodesForWrite()
Indicate whether or not the cluster is now avoiding
to use stale DataNodes for writing.
|
boolean |
isGenStampInFuture(Block block) |
boolean |
isInSafeMode()
Is the system in safe mode?
|
boolean |
isInStandbyState() |
boolean |
isInStartupSafeMode()
Is the system in startup safe mode, i.e.
|
boolean |
isPopulatingReplQueues()
Check if replication queues are to be populated
|
boolean |
isRunning()
Is this name system running?
|
boolean |
isUpgradeFinalized()
Checks if upgrade is finalized.
|
static FSNamesystem |
loadFromDisk(Configuration conf)
Instantiates an FSNamesystem loaded from the image and edits
directories specified in the passed Configuration.
|
void |
logExpireDelegationToken(DelegationTokenIdentifier id)
Log the cancellation of expired tokens to edit logs
|
void |
logUpdateMasterKey(DelegationKey key)
Log the updateMasterKey operation to edit logs
|
void |
processIncrementalBlockReport(DatanodeID nodeID,
String poolId,
ReceivedDeletedBlockInfo[] blockInfos) |
void |
readLock()
Acquire read lock.
|
void |
readUnlock()
Release read lock.
|
void |
resetLastInodeId(long newValue)
Set the last allocated inode id when fsimage or editlog is loaded.
|
void |
setBlockTotal()
Set the total number of blocks in the system.
|
void |
setNNResourceChecker(NameNodeResourceChecker nnResourceChecker) |
void |
verifyToken(DelegationTokenIdentifier identifier,
byte[] password)
Verifies that the given identifier and password are valid and match.
|
void |
writeLock()
Acquire write lock.
|
void |
writeLockInterruptibly()
Acquire write lock, unless interrupted while waiting
|
void |
writeUnlock()
Release write lock.
|
public static final org.apache.commons.logging.Log LOG
public static final org.apache.commons.logging.Log auditLog
key=value
pairs 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)>
public boolean isAuditEnabled()
public void resetLastInodeId(long newValue) throws IOException
IOException
public long getLastInodeId()
public long allocateNewInodeId()
public static FSNamesystem loadFromDisk(Configuration conf) throws IOException
conf
- the Configuration which specifies the storage directories
from which to loadIOException
- if loading failspublic RetryCache getRetryCache()
public void checkOperation(NameNode.OperationCategory op) throws StandbyException
checkOperation
in interface Namesystem
StandbyException
public static Collection<URI> getNamespaceDirs(Configuration conf)
public static Collection<URI> getRequiredNamespaceEditsDirs(Configuration conf)
conf
- the HDFS configuration.public static List<URI> getNamespaceEditsDirs(Configuration conf) throws IOException
IOException
- if multiple shared edits directories are configuredpublic static List<URI> getNamespaceEditsDirs(Configuration conf, boolean includeShared) throws IOException
IOException
public static List<URI> getSharedEditsDirs(Configuration conf)
conf
- public void readLock()
RwLock
public void readUnlock()
RwLock
readUnlock
in interface RwLock
public void writeLock()
RwLock
public void writeLockInterruptibly() throws InterruptedException
RwLock
writeLockInterruptibly
in interface RwLock
InterruptedException
public void writeUnlock()
RwLock
writeUnlock
in interface RwLock
public boolean hasWriteLock()
RwLock
hasWriteLock
in interface RwLock
public boolean hasReadLock()
RwLock
hasReadLock
in interface RwLock
public boolean hasReadOrWriteLock()
RwLock
hasReadOrWriteLock
in interface RwLock
public boolean isRunning()
Namesystem
isRunning
in interface Namesystem
public boolean isInStandbyState()
isInStandbyState
in interface Namesystem
public FSImage getFSImage()
public FSEditLog getEditLog()
@Metric(value={"MissingBlocks","Number of missing blocks"}) public long getMissingBlocksCount()
@Metric(value={"ExpiredHeartbeats","Number of expired heartbeats"}) public int getExpiredHeartbeats()
@Metric(value={"TransactionsSinceLastCheckpoint","Number of transactions since last checkpoint"}) public long getTransactionsSinceLastCheckpoint()
@Metric(value={"TransactionsSinceLastLogRoll","Number of transactions since last edit log roll"}) public long getTransactionsSinceLastLogRoll()
@Metric(value={"LastWrittenTransactionId","Transaction ID written to the edit log"}) public long getLastWrittenTransactionId()
@Metric(value={"LastCheckpointTime","Time in milliseconds since the epoch of the last checkpoint"}) public long getLastCheckpointTime()
@Metric(value={"CapacityTotal","Total raw capacity of data nodes in bytes"}) public long getCapacityTotal()
FSNamesystemMBean
getCapacityTotal
in interface FSNamesystemMBean
@Metric(value={"CapacityTotalGB","Total raw capacity of data nodes in GB"}) public float getCapacityTotalGB()
@Metric(value={"CapacityUsed","Total used capacity across all data nodes in bytes"}) public long getCapacityUsed()
FSNamesystemMBean
getCapacityUsed
in interface FSNamesystemMBean
@Metric(value={"CapacityUsedGB","Total used capacity across all data nodes in GB"}) public float getCapacityUsedGB()
@Metric(value={"CapacityRemaining","Remaining capacity in bytes"}) public long getCapacityRemaining()
FSNamesystemMBean
getCapacityRemaining
in interface FSNamesystemMBean
@Metric(value={"CapacityRemainingGB","Remaining capacity in GB"}) public float getCapacityRemainingGB()
@Metric(value={"CapacityUsedNonDFS","Total space used by data nodes for non DFS purposes in bytes"}) public long getCapacityUsedNonDFS()
@Metric public int getTotalLoad()
getTotalLoad
in interface FSClusterStats
getTotalLoad
in interface FSNamesystemMBean
@Metric(value={"SnapshottableDirectories","Number of snapshottable directories"}) public int getNumSnapshottableDirs()
public void checkSafeMode()
SafeMode
checkSafeMode
in interface SafeMode
public boolean isInSafeMode()
SafeMode
isInSafeMode
in interface SafeMode
public boolean isInStartupSafeMode()
SafeMode
isInStartupSafeMode
in interface SafeMode
public boolean isPopulatingReplQueues()
isPopulatingReplQueues
in interface SafeMode
public void incrementSafeBlockCount(int replication)
SafeMode
incrementSafeBlockCount
in interface SafeMode
replication
- current replicationpublic void decrementSafeBlockCount(Block b)
SafeMode
decrementSafeBlockCount
in interface SafeMode
public void adjustSafeModeBlockTotals(int deltaSafe, int deltaTotal)
adjustSafeModeBlockTotals
in interface Namesystem
deltaSafe
- the change in number of safe blocksdeltaTotal
- the change i nnumber of total blocks expectedpublic void setBlockTotal()
@Metric public long getBlocksTotal()
getBlocksTotal
in interface FSNamesystemMBean
public void processIncrementalBlockReport(DatanodeID nodeID, String poolId, ReceivedDeletedBlockInfo[] blockInfos) throws IOException
IOException
public void checkSuperuserPrivilege() throws AccessControlException
Namesystem
checkSuperuserPrivilege
in interface Namesystem
AccessControlException
@Metric public long getFilesTotal()
FSNamesystemMBean
getFilesTotal
in interface FSNamesystemMBean
@Metric public long getPendingReplicationBlocks()
FSNamesystemMBean
getPendingReplicationBlocks
in interface FSNamesystemMBean
@Metric public long getUnderReplicatedBlocks()
FSNamesystemMBean
getUnderReplicatedBlocks
in interface FSNamesystemMBean
@Metric(value={"CorruptBlocks","Number of blocks with corrupt replicas"}) public long getCorruptReplicaBlocks()
@Metric public long getScheduledReplicationBlocks()
FSNamesystemMBean
getScheduledReplicationBlocks
in interface FSNamesystemMBean
@Metric public long getPendingDeletionBlocks()
@Metric public long getExcessBlocks()
@Metric public long getPostponedMisreplicatedBlocks()
@Metric public int getPendingDataNodeMessageCount()
@Metric public long getMillisSinceLastLoadedEdits()
@Metric public int getBlockCapacity()
public String getFSState()
FSNamesystemMBean
getFSState
in interface FSNamesystemMBean
public int getNumLiveDataNodes()
FSNamesystemMBean
getNumLiveDataNodes
in interface FSNamesystemMBean
public int getNumDeadDataNodes()
FSNamesystemMBean
getNumDeadDataNodes
in interface FSNamesystemMBean
@Metric(value={"StaleDataNodes","Number of datanodes marked stale due to delayed heartbeat"}) public int getNumStaleDataNodes()
FSNamesystemMBean
getNumStaleDataNodes
in interface FSNamesystemMBean
public void logUpdateMasterKey(DelegationKey key)
key
- new delegation key.public void logExpireDelegationToken(DelegationTokenIdentifier id)
id
- token identifier to cancelpublic String getVersion()
getVersion
in interface NameNodeMXBean
public long getUsed()
NameNodeMXBean
getUsed
in interface NameNodeMXBean
public long getFree()
NameNodeMXBean
getFree
in interface NameNodeMXBean
public long getTotal()
NameNodeMXBean
getTotal
in interface NameNodeMXBean
public String getSafemode()
NameNodeMXBean
getSafemode
in interface NameNodeMXBean
public boolean isUpgradeFinalized()
NameNodeMXBean
isUpgradeFinalized
in interface NameNodeMXBean
public long getNonDfsUsedSpace()
NameNodeMXBean
getNonDfsUsedSpace
in interface NameNodeMXBean
public float getPercentUsed()
NameNodeMXBean
getPercentUsed
in interface NameNodeMXBean
public long getBlockPoolUsedSpace()
NameNodeMXBean
getBlockPoolUsedSpace
in interface NameNodeMXBean
public float getPercentBlockPoolUsed()
NameNodeMXBean
getPercentBlockPoolUsed
in interface NameNodeMXBean
public float getPercentRemaining()
NameNodeMXBean
getPercentRemaining
in interface NameNodeMXBean
public long getTotalBlocks()
NameNodeMXBean
getTotalBlocks
in interface NameNodeMXBean
@Metric public long getTotalFiles()
NameNodeMXBean
getTotalFiles
in interface NameNodeMXBean
public long getNumberOfMissingBlocks()
NameNodeMXBean
getNumberOfMissingBlocks
in interface NameNodeMXBean
public int getThreads()
NameNodeMXBean
getThreads
in interface NameNodeMXBean
public String getLiveNodes()
getLiveNodes
in interface NameNodeMXBean
public String getDeadNodes()
getDeadNodes
in interface NameNodeMXBean
public String getDecomNodes()
getDecomNodes
in interface NameNodeMXBean
public String getClusterId()
NameNodeMXBean
getClusterId
in interface NameNodeMXBean
public String getBlockPoolId()
NameNodeMXBean
getBlockPoolId
in interface NameNodeMXBean
getBlockPoolId
in interface Namesystem
public String getNameDirStatuses()
NameNodeMXBean
getNameDirStatuses
in interface NameNodeMXBean
public String getJournalTransactionInfo()
NameNodeMXBean
getJournalTransactionInfo
in interface NameNodeMXBean
public BlockManager getBlockManager()
public FSDirectory getFSDirectory()
public int getDistinctVersionCount()
NameNodeMXBean
getDistinctVersionCount
in interface NameNodeMXBean
public Map<String,Integer> getDistinctVersions()
NameNodeMXBean
getDistinctVersions
in interface NameNodeMXBean
public String getSoftwareVersion()
NameNodeMXBean
getSoftwareVersion
in interface NameNodeMXBean
public void verifyToken(DelegationTokenIdentifier identifier, byte[] password) throws SecretManager.InvalidToken
identifier
- Token identifier.password
- Password in the token.SecretManager.InvalidToken
public boolean isGenStampInFuture(Block block)
isGenStampInFuture
in interface Namesystem
public EditLogTailer getEditLogTailer()
public org.apache.hadoop.hdfs.server.namenode.FSNamesystem.SafeModeInfo getSafeModeInfoForTests()
public void setNNResourceChecker(NameNodeResourceChecker nnResourceChecker)
public boolean isAvoidingStaleDataNodesForWrite()
FSClusterStats
isAvoidingStaleDataNodesForWrite
in interface FSClusterStats
public SnapshotManager getSnapshotManager()
public SnapshottableDirectoryStatus[] getSnapshottableDirListing() throws IOException
IOException
Copyright © 2013 Apache Software Foundation. All rights reserved.