|
||||||||||
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 int[] |
LAYOUT_VERSIONS_203
Layout versions of 0.20.203 release |
static org.apache.commons.logging.Log |
LOG
|
static int |
PRE_GENERATIONSTAMP_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 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)
|
static boolean |
is203LayoutVersion(int layoutVersion)
|
boolean |
isLockSupported(int idx)
Check whether underlying file system supports file locking. |
abstract boolean |
isPreUpgradableLayout(Storage.StorageDirectory sd)
Return true if the layout of the given storage directory is from a version of Hadoop prior to the introduction of the "current" and "previous" directories which allow upgrade and rollback. |
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. |
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[] LAYOUT_VERSIONS_203
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 isPreUpgradableLayout(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)
public static boolean is203LayoutVersion(int layoutVersion)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |