Package org.apache.hadoop.hdfs.protocol
Class LayoutVersion
java.lang.Object
org.apache.hadoop.hdfs.protocol.LayoutVersion
This class tracks changes in the layout version of HDFS.
Layout version is changed for following reasons:
How to update layout version:
When a change requires new layout version, please add an entry into
- The layout of how namenode or datanode stores information on disk changes.
- A new operation code is added to the editlog.
- Modification such as format of a record, content of a record in editlog or fsimage.
How to update layout version:
When a change requires new layout version, please add an entry into
LayoutVersion.Feature with a short enum name, new layout version and description
of the change. Please see LayoutVersion.Feature for further details.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnums for features that change the layout version before rolling upgrade is supported.static classFeature information.static interfaceThe interface to be implemented by NameNode and DataNode layout features -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intVersion in which HDFS-2991 was fixed. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intgetCurrentLayoutVersion(LayoutVersion.LayoutFeature[] features) Get the current layout versionstatic intGets the minimum compatible layout version.getString(Map<Integer, SortedSet<LayoutVersion.LayoutFeature>> map, LayoutVersion.LayoutFeature[] values) Gets formatted string that describesLayoutVersioninformation.static booleansupports(Map<Integer, SortedSet<LayoutVersion.LayoutFeature>> map, LayoutVersion.LayoutFeature f, int lv) Returns true if a given feature is supported in the given layout versionstatic voidupdateMap(Map<Integer, SortedSet<LayoutVersion.LayoutFeature>> map, LayoutVersion.LayoutFeature[] features)
-
Field Details
-
BUGFIX_HDFS_2991_VERSION
public static final int BUGFIX_HDFS_2991_VERSIONVersion in which HDFS-2991 was fixed. This bug caused OP_ADD to sometimes be skipped for append() calls. If we see such a case when loading the edits, but the version is known to have that bug, we workaround the issue. Otherwise we should consider it a corruption and bail.- See Also:
-
-
Constructor Details
-
LayoutVersion
public LayoutVersion()
-
-
Method Details
-
updateMap
public static void updateMap(Map<Integer, SortedSet<LayoutVersion.LayoutFeature>> map, LayoutVersion.LayoutFeature[] features) -
getString
public String getString(Map<Integer, SortedSet<LayoutVersion.LayoutFeature>> map, LayoutVersion.LayoutFeature[] values) Gets formatted string that describesLayoutVersioninformation. -
supports
public static boolean supports(Map<Integer, SortedSet<LayoutVersion.LayoutFeature>> map, LayoutVersion.LayoutFeature f, int lv) Returns true if a given feature is supported in the given layout version- Parameters:
map- layout feature mapf- Featurelv- LayoutVersion- Returns:
- true if
fis supported in layout versionlv
-
getCurrentLayoutVersion
Get the current layout version -
getMinimumCompatibleLayoutVersion
Gets the minimum compatible layout version.- Parameters:
features- all features to check- Returns:
- minimum compatible layout version
-