|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hdfs.server.common.StorageInfo
org.apache.hadoop.hdfs.server.common.Storage
@InterfaceAudience.Private public abstract class Storage
Storage information file.
Local storage information is stored in a separate file VERSION. It contains type of the node, the storage layout version, the namespace id, and the fs state creation time.
Local storage can reside in multiple directories. Each directory should contain the same VERSION file as the others. During startup Hadoop servers (name-node and data-nodes) read their local storage information from them.
The servers hold a lock for each storage directory while they run so that other nodes were not able to startup sharing the same storage. The locks are released when the servers stop (normally or abnormally).
Nested Class Summary | |
---|---|
class |
Storage.StorageDirectory
One of the storage directories. |
static interface |
Storage.StorageDirType
An interface to denote storage directory type Implementations can define a type for storage directory by implementing this interface. |
static class |
Storage.StorageState
|
Field Summary | |
---|---|
protected static int |
LAST_PRE_UPGRADE_LAYOUT_VERSION
|
protected static String |
LAST_UPGRADABLE_HADOOP_VERSION
|
static int |
LAST_UPGRADABLE_LAYOUT_VERSION
|
static org.apache.commons.logging.Log |
LOG
|
static int |
PRE_GENERATIONSTAMP_LAYOUT_VERSION
|
static int |
PRE_RBW_LAYOUT_VERSION
|
static String |
STORAGE_DIR_CURRENT
|
protected static String |
STORAGE_FILE_VERSION
|
protected List<Storage.StorageDirectory> |
storageDirs
|
Fields inherited from class org.apache.hadoop.hdfs.server.common.StorageInfo |
---|
cTime, layoutVersion, namespaceID |
Constructor Summary | |
---|---|
protected |
Storage(HdfsConstants.NodeType type)
Create empty storage info of the specified type |
protected |
Storage(HdfsConstants.NodeType type,
int nsID,
long cT)
|
protected |
Storage(HdfsConstants.NodeType type,
StorageInfo storageInfo)
|
Method Summary | |
---|---|
protected void |
addStorageDir(Storage.StorageDirectory sd)
|
protected static void |
checkVersionUpgradable(int oldVersion)
Checks if the upgrade from the given old version is supported. |
protected abstract void |
corruptPreUpgradeStorage(File rootDir)
|
protected static void |
deleteDir(File dir)
|
Iterator<Storage.StorageDirectory> |
dirIterator()
Return default iterator This iterator returns all entries in storageDirs |
Iterator<Storage.StorageDirectory> |
dirIterator(Storage.StorageDirType dirType)
Return iterator based on Storage Directory Type This iterator selects entries in storageDirs of type dirType and returns them via the Iterator |
static String |
getBuildVersion()
|
protected void |
getFields(Properties props,
Storage.StorageDirectory sd)
Get common storage fields. |
int |
getNumStorageDirs()
|
static String |
getRegistrationID(StorageInfo storage)
|
Storage.StorageDirectory |
getStorageDir(int idx)
|
abstract boolean |
isConversionNeeded(Storage.StorageDirectory sd)
|
boolean |
isLockSupported(int idx)
Check whether underlying file system supports file locking. |
String |
listStorageDirectories()
generate storage list (debug line) |
static void |
rename(File from,
File to)
|
protected void |
setFields(Properties props,
Storage.StorageDirectory sd)
Set common storage fields. |
void |
unlockAll()
Unlock all storage directories. |
void |
writeAll()
Write all data storage files. |
protected void |
writeCorruptedData(RandomAccessFile file)
|
Methods inherited from class org.apache.hadoop.hdfs.server.common.StorageInfo |
---|
getCTime, getLayoutVersion, getNamespaceID, readFields, setStorageInfo, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.apache.commons.logging.Log LOG
protected static final int LAST_PRE_UPGRADE_LAYOUT_VERSION
public static final int LAST_UPGRADABLE_LAYOUT_VERSION
protected static final String LAST_UPGRADABLE_HADOOP_VERSION
public static final int PRE_GENERATIONSTAMP_LAYOUT_VERSION
public static final int PRE_RBW_LAYOUT_VERSION
protected static final String STORAGE_FILE_VERSION
public static final String STORAGE_DIR_CURRENT
protected List<Storage.StorageDirectory> storageDirs
Constructor Detail |
---|
protected Storage(HdfsConstants.NodeType type)
protected Storage(HdfsConstants.NodeType type, int nsID, long cT)
protected Storage(HdfsConstants.NodeType type, StorageInfo storageInfo)
Method Detail |
---|
public Iterator<Storage.StorageDirectory> dirIterator()
public Iterator<Storage.StorageDirectory> dirIterator(Storage.StorageDirType dirType)
public String listStorageDirectories()
public int getNumStorageDirs()
public Storage.StorageDirectory getStorageDir(int idx)
protected void addStorageDir(Storage.StorageDirectory sd)
public abstract boolean isConversionNeeded(Storage.StorageDirectory sd) throws IOException
IOException
protected static void checkVersionUpgradable(int oldVersion) throws IOException
oldVersion
-
IOException
protected void getFields(Properties props, Storage.StorageDirectory sd) throws IOException
props
-
IOException
protected void setFields(Properties props, Storage.StorageDirectory sd) throws IOException
props
-
IOException
public static void rename(File from, File to) throws IOException
IOException
protected static void deleteDir(File dir) throws IOException
IOException
public void writeAll() throws IOException
IOException
public void unlockAll() throws IOException
IOException
public boolean isLockSupported(int idx) throws IOException
true
if exclusive locks are supported or
false
otherwise.
IOException
Storage.StorageDirectory.lock()
public static String getBuildVersion()
public static String getRegistrationID(StorageInfo storage)
protected abstract void corruptPreUpgradeStorage(File rootDir) throws IOException
IOException
protected void writeCorruptedData(RandomAccessFile file) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |