当前位置: 首页>>代码示例>>Java>>正文


Java Storage.LAST_UPGRADABLE_LAYOUT_VERSION属性代码示例

本文整理汇总了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;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:EditLogFileInputStream.java

示例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;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:26,代码来源:EditLogFileInputStream.java

示例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
  };
}
 
开发者ID:naver,项目名称:hadoop,代码行数:66,代码来源:TestDFSStartupVersions.java

示例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
  };
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:66,代码来源:TestDFSStartupVersions.java


注:本文中的org.apache.hadoop.hdfs.server.common.Storage.LAST_UPGRADABLE_LAYOUT_VERSION属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。