本文整理汇总了Java中org.apache.hadoop.hdfs.server.common.Storage.LAST_UPGRADABLE_LAYOUT_VERSION属性的典型用法代码示例。如果您正苦于以下问题:Java Storage.LAST_UPGRADABLE_LAYOUT_VERSION属性的具体用法?Java Storage.LAST_UPGRADABLE_LAYOUT_VERSION怎么用?Java Storage.LAST_UPGRADABLE_LAYOUT_VERSION使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.hadoop.hdfs.server.common.Storage
的用法示例。
在下文中一共展示了Storage.LAST_UPGRADABLE_LAYOUT_VERSION属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readLogVersion
/**
* Read the header of fsedit log
* @param in fsedit stream
* @return the edit log version number
* @throws IOException if error occurs
*/
@VisibleForTesting
static int readLogVersion(DataInputStream in, boolean verifyLayoutVersion)
throws IOException, LogHeaderCorruptException {
int logVersion;
try {
logVersion = in.readInt();
} catch (EOFException eofe) {
throw new LogHeaderCorruptException(
"Reached EOF when reading log header");
}
if (verifyLayoutVersion &&
(logVersion < HdfsConstants.NAMENODE_LAYOUT_VERSION || // future version
logVersion > Storage.LAST_UPGRADABLE_LAYOUT_VERSION)) { // unsupported
throw new LogHeaderCorruptException(
"Unexpected version of the file system log file: "
+ logVersion + ". Current version = "
+ HdfsConstants.NAMENODE_LAYOUT_VERSION + ".");
}
return logVersion;
}
示例2: readLogVersion
/**
* Read the header of fsedit log
* @param in fsedit stream
* @return the edit log version number
* @throws IOException if error occurs
*/
@VisibleForTesting
static int readLogVersion(DataInputStream in, boolean verifyLayoutVersion)
throws IOException, LogHeaderCorruptException {
int logVersion;
try {
logVersion = in.readInt();
} catch (EOFException eofe) {
throw new LogHeaderCorruptException(
"Reached EOF when reading log header");
}
if (verifyLayoutVersion &&
(logVersion < HdfsServerConstants.NAMENODE_LAYOUT_VERSION || // future version
logVersion > Storage.LAST_UPGRADABLE_LAYOUT_VERSION)) { // unsupported
throw new LogHeaderCorruptException(
"Unexpected version of the file system log file: "
+ logVersion + ". Current version = "
+ HdfsServerConstants.NAMENODE_LAYOUT_VERSION + ".");
}
return logVersion;
}
示例3: initializeVersions
/**
* Initialize the versions array. This array stores all combinations
* of cross product:
* {oldLayoutVersion,currentLayoutVersion,futureLayoutVersion} X
* {currentNamespaceId,incorrectNamespaceId} X
* {pastFsscTime,currentFsscTime,futureFsscTime}
*/
private StorageData[] initializeVersions() throws Exception {
int layoutVersionOld = Storage.LAST_UPGRADABLE_LAYOUT_VERSION;
int layoutVersionCur = HdfsConstants.DATANODE_LAYOUT_VERSION;
int layoutVersionNew = Integer.MIN_VALUE;
int namespaceIdCur = UpgradeUtilities.getCurrentNamespaceID(null);
int namespaceIdOld = Integer.MIN_VALUE;
long fsscTimeOld = Long.MIN_VALUE;
long fsscTimeCur = UpgradeUtilities.getCurrentFsscTime(null);
long fsscTimeNew = Long.MAX_VALUE;
String clusterID = "testClusterID";
String invalidClusterID = "testClusterID";
String bpid = UpgradeUtilities.getCurrentBlockPoolID(null);
String invalidBpid = "invalidBpid";
return new StorageData[] {
new StorageData(layoutVersionOld, namespaceIdCur, clusterID,
fsscTimeOld, bpid), // 0
new StorageData(layoutVersionOld, namespaceIdCur, clusterID,
fsscTimeCur, bpid), // 1
new StorageData(layoutVersionOld, namespaceIdCur, clusterID,
fsscTimeNew, bpid), // 2
new StorageData(layoutVersionOld, namespaceIdOld, clusterID,
fsscTimeOld, bpid), // 3
new StorageData(layoutVersionOld, namespaceIdOld, clusterID,
fsscTimeCur, bpid), // 4
new StorageData(layoutVersionOld, namespaceIdOld, clusterID,
fsscTimeNew, bpid), // 5
new StorageData(layoutVersionCur, namespaceIdCur, clusterID,
fsscTimeOld, bpid), // 6
new StorageData(layoutVersionCur, namespaceIdCur, clusterID,
fsscTimeCur, bpid), // 7
new StorageData(layoutVersionCur, namespaceIdCur, clusterID,
fsscTimeNew, bpid), // 8
new StorageData(layoutVersionCur, namespaceIdOld, clusterID,
fsscTimeOld, bpid), // 9
new StorageData(layoutVersionCur, namespaceIdOld, clusterID,
fsscTimeCur, bpid), // 10
new StorageData(layoutVersionCur, namespaceIdOld, clusterID,
fsscTimeNew, bpid), // 11
new StorageData(layoutVersionNew, namespaceIdCur, clusterID,
fsscTimeOld, bpid), // 12
new StorageData(layoutVersionNew, namespaceIdCur, clusterID,
fsscTimeCur, bpid), // 13
new StorageData(layoutVersionNew, namespaceIdCur, clusterID,
fsscTimeNew, bpid), // 14
new StorageData(layoutVersionNew, namespaceIdOld, clusterID,
fsscTimeOld, bpid), // 15
new StorageData(layoutVersionNew, namespaceIdOld, clusterID,
fsscTimeCur, bpid), // 16
new StorageData(layoutVersionNew, namespaceIdOld, clusterID,
fsscTimeNew, bpid), // 17
// Test with invalid clusterId
new StorageData(layoutVersionCur, namespaceIdCur, invalidClusterID,
fsscTimeCur, bpid), // 18
// Test with invalid block pool Id
new StorageData(layoutVersionCur, namespaceIdCur, clusterID,
fsscTimeCur, invalidBpid) // 19
};
}
示例4: initializeVersions
/**
* Initialize the versions array. This array stores all combinations
* of cross product:
* {oldLayoutVersion,currentLayoutVersion,futureLayoutVersion} X
* {currentNamespaceId,incorrectNamespaceId} X
* {pastFsscTime,currentFsscTime,futureFsscTime}
*/
private StorageData[] initializeVersions() throws Exception {
int layoutVersionOld = Storage.LAST_UPGRADABLE_LAYOUT_VERSION;
int layoutVersionCur = HdfsServerConstants.DATANODE_LAYOUT_VERSION;
int layoutVersionNew = Integer.MIN_VALUE;
int namespaceIdCur = UpgradeUtilities.getCurrentNamespaceID(null);
int namespaceIdOld = Integer.MIN_VALUE;
long fsscTimeOld = Long.MIN_VALUE;
long fsscTimeCur = UpgradeUtilities.getCurrentFsscTime(null);
long fsscTimeNew = Long.MAX_VALUE;
String clusterID = "testClusterID";
String invalidClusterID = "testClusterID";
String bpid = UpgradeUtilities.getCurrentBlockPoolID(null);
String invalidBpid = "invalidBpid";
return new StorageData[] {
new StorageData(layoutVersionOld, namespaceIdCur, clusterID,
fsscTimeOld, bpid), // 0
new StorageData(layoutVersionOld, namespaceIdCur, clusterID,
fsscTimeCur, bpid), // 1
new StorageData(layoutVersionOld, namespaceIdCur, clusterID,
fsscTimeNew, bpid), // 2
new StorageData(layoutVersionOld, namespaceIdOld, clusterID,
fsscTimeOld, bpid), // 3
new StorageData(layoutVersionOld, namespaceIdOld, clusterID,
fsscTimeCur, bpid), // 4
new StorageData(layoutVersionOld, namespaceIdOld, clusterID,
fsscTimeNew, bpid), // 5
new StorageData(layoutVersionCur, namespaceIdCur, clusterID,
fsscTimeOld, bpid), // 6
new StorageData(layoutVersionCur, namespaceIdCur, clusterID,
fsscTimeCur, bpid), // 7
new StorageData(layoutVersionCur, namespaceIdCur, clusterID,
fsscTimeNew, bpid), // 8
new StorageData(layoutVersionCur, namespaceIdOld, clusterID,
fsscTimeOld, bpid), // 9
new StorageData(layoutVersionCur, namespaceIdOld, clusterID,
fsscTimeCur, bpid), // 10
new StorageData(layoutVersionCur, namespaceIdOld, clusterID,
fsscTimeNew, bpid), // 11
new StorageData(layoutVersionNew, namespaceIdCur, clusterID,
fsscTimeOld, bpid), // 12
new StorageData(layoutVersionNew, namespaceIdCur, clusterID,
fsscTimeCur, bpid), // 13
new StorageData(layoutVersionNew, namespaceIdCur, clusterID,
fsscTimeNew, bpid), // 14
new StorageData(layoutVersionNew, namespaceIdOld, clusterID,
fsscTimeOld, bpid), // 15
new StorageData(layoutVersionNew, namespaceIdOld, clusterID,
fsscTimeCur, bpid), // 16
new StorageData(layoutVersionNew, namespaceIdOld, clusterID,
fsscTimeNew, bpid), // 17
// Test with invalid clusterId
new StorageData(layoutVersionCur, namespaceIdCur, invalidClusterID,
fsscTimeCur, bpid), // 18
// Test with invalid block pool Id
new StorageData(layoutVersionCur, namespaceIdCur, clusterID,
fsscTimeCur, invalidBpid) // 19
};
}