java.io.Closeable, java.lang.AutoCloseableBackupImage@Private
@Evolving
public class FSImage
extends java.lang.Object
implements java.io.Closeable
| Modifier and Type | Field | Description |
|---|---|---|
protected NNStorageRetentionManager |
archivalManager |
|
protected FSEditLog |
editLog |
|
protected long |
lastAppliedTxId |
The last transaction ID that was either loaded from an image
or loaded by loading edits files.
|
static org.slf4j.Logger |
LOG |
|
static int |
SHUTDOWN_HOOK_PRIORITY |
Priority of the FSImageSaver shutdown hook: 10.
|
protected NNStorage |
storage |
| Modifier | Constructor | Description |
|---|---|---|
|
FSImage(org.apache.hadoop.conf.Configuration conf) |
Construct an FSImage
|
protected |
FSImage(org.apache.hadoop.conf.Configuration conf,
java.util.Collection<java.net.URI> imageDirs,
java.util.List<java.net.URI> editsDirs) |
Construct the FSImage.
|
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
addToCheckpointing(long txid) |
|
static void |
checkUpgrade(NNStorage storage) |
Check if upgrade is in progress.
|
void |
close() |
|
java.lang.String |
getBlockPoolID() |
|
java.lang.String |
getClusterID() |
|
long |
getCorrectLastAppliedOrWrittenTxId() |
This method holds a lock of FSEditLog to get the correct value.
|
FSEditLog |
getEditLog() |
|
long |
getLastAppliedOrWrittenTxId() |
|
long |
getLastAppliedTxId() |
|
int |
getLayoutVersion() |
|
long |
getMostRecentCheckpointTxId() |
|
int |
getNamespaceID() |
|
NNStorage |
getStorage() |
|
boolean |
hasRollbackFSImage() |
|
void |
initEditLog(HdfsServerConstants.StartupOption startOpt) |
|
long |
loadEdits(java.lang.Iterable<EditLogInputStream> editStreams,
FSNamesystem target) |
Load the specified list of edit files into the image.
|
long |
loadEdits(java.lang.Iterable<EditLogInputStream> editStreams,
FSNamesystem target,
long maxTxnsToRead,
HdfsServerConstants.StartupOption startOpt,
MetaRecoveryContext recovery) |
|
static boolean |
recoverStorageDirs(HdfsServerConstants.StartupOption startOpt,
NNStorage storage,
java.util.Map<Storage.StorageDirectory,Storage.StorageState> dataDirStates) |
For each storage directory, performs recovery of incomplete transitions
(eg.
|
void |
removeFromCheckpointing(long txid) |
|
void |
saveDigestAndRenameCheckpointImage(NNStorage.NameNodeFile nnf,
long txid,
org.apache.hadoop.io.MD5Hash digest) |
This is called by the 2NN after having downloaded an image, and by
the NN after having received a new image from the 2NN.
|
protected void |
saveFSImageInAllDirs(FSNamesystem source,
long txid) |
|
void |
saveLegacyOIVImage(FSNamesystem source,
java.lang.String targetDir,
Canceler canceler) |
Save FSimage in the legacy format.
|
boolean |
saveNamespace(long timeWindow,
long txGap,
FSNamesystem source) |
|
void |
saveNamespace(FSNamesystem source) |
|
void |
saveNamespace(FSNamesystem source,
NNStorage.NameNodeFile nnf,
Canceler canceler) |
Save the contents of the FS image to a new image file in each of the
current storage directories.
|
void |
updateLastAppliedTxIdFromWritten() |
|
void |
updateStorageVersion() |
Update version of all storage directories.
|
public static final org.slf4j.Logger LOG
public static final int SHUTDOWN_HOOK_PRIORITY
protected FSEditLog editLog
protected NNStorage storage
protected long lastAppliedTxId
protected NNStorageRetentionManager archivalManager
public FSImage(org.apache.hadoop.conf.Configuration conf)
throws java.io.IOException
conf - Configurationjava.io.IOException - if default directories are invalid.protected FSImage(org.apache.hadoop.conf.Configuration conf,
java.util.Collection<java.net.URI> imageDirs,
java.util.List<java.net.URI> editsDirs)
throws java.io.IOException
conf - ConfigurationimageDirs - Directories the image can be stored in.editsDirs - Directories the editlog can be stored in.java.io.IOException - if directories are invalid.public static boolean recoverStorageDirs(HdfsServerConstants.StartupOption startOpt, NNStorage storage, java.util.Map<Storage.StorageDirectory,Storage.StorageState> dataDirStates) throws java.io.IOException
dataDirStates - output of storage directory statesjava.io.IOExceptionpublic static void checkUpgrade(NNStorage storage) throws java.io.IOException
java.io.IOExceptionpublic boolean hasRollbackFSImage()
throws java.io.IOException
java.io.IOExceptionpublic FSEditLog getEditLog()
public void initEditLog(HdfsServerConstants.StartupOption startOpt) throws java.io.IOException
java.io.IOExceptionpublic long loadEdits(java.lang.Iterable<EditLogInputStream> editStreams, FSNamesystem target) throws java.io.IOException
java.io.IOExceptionpublic long loadEdits(java.lang.Iterable<EditLogInputStream> editStreams, FSNamesystem target, long maxTxnsToRead, HdfsServerConstants.StartupOption startOpt, MetaRecoveryContext recovery) throws java.io.IOException
java.io.IOExceptionpublic void saveLegacyOIVImage(FSNamesystem source, java.lang.String targetDir, Canceler canceler) throws java.io.IOException
java.io.IOExceptionpublic void updateStorageVersion()
throws java.io.IOException
java.io.IOExceptionpublic boolean saveNamespace(long timeWindow,
long txGap,
FSNamesystem source)
throws java.io.IOException
timeWindow - a checkpoint is done if the latest checkpoint
was done more than this number of seconds ago.txGap - a checkpoint is done also if the gap between the latest tx id
and the latest checkpoint is greater than this number.java.io.IOExceptionsaveNamespace(FSNamesystem, NameNodeFile, Canceler)public void saveNamespace(FSNamesystem source) throws java.io.IOException
java.io.IOExceptionpublic void saveNamespace(FSNamesystem source, NNStorage.NameNodeFile nnf, Canceler canceler) throws java.io.IOException
java.io.IOExceptionprotected void saveFSImageInAllDirs(FSNamesystem source, long txid) throws java.io.IOException
java.io.IOExceptionsaveFSImageInAllDirs(FSNamesystem, NameNodeFile, long, Canceler)public boolean addToCheckpointing(long txid)
public void removeFromCheckpointing(long txid)
public void saveDigestAndRenameCheckpointImage(NNStorage.NameNodeFile nnf, long txid, org.apache.hadoop.io.MD5Hash digest) throws java.io.IOException
java.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.lang.AutoCloseableclose in interface java.io.Closeablejava.io.IOExceptionpublic NNStorage getStorage()
public int getLayoutVersion()
public int getNamespaceID()
public java.lang.String getClusterID()
public java.lang.String getBlockPoolID()
public long getLastAppliedTxId()
public long getLastAppliedOrWrittenTxId()
public long getCorrectLastAppliedOrWrittenTxId()
public void updateLastAppliedTxIdFromWritten()
public long getMostRecentCheckpointTxId()
Copyright © 2008–2025 Apache Software Foundation. All rights reserved.