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


Java HdfsConstants.NAMENODE_LAYOUT_VERSION属性代码示例

本文整理汇总了Java中org.apache.hadoop.hdfs.protocol.HdfsConstants.NAMENODE_LAYOUT_VERSION属性的典型用法代码示例。如果您正苦于以下问题:Java HdfsConstants.NAMENODE_LAYOUT_VERSION属性的具体用法?Java HdfsConstants.NAMENODE_LAYOUT_VERSION怎么用?Java HdfsConstants.NAMENODE_LAYOUT_VERSION使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.hadoop.hdfs.protocol.HdfsConstants的用法示例。


在下文中一共展示了HdfsConstants.NAMENODE_LAYOUT_VERSION属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: check203UpgradeFailure

/**
 * Throw appropriate exception during upgrade from 203, when editlog loading
 * could fail due to opcode conflicts.
 */
private void check203UpgradeFailure(int logVersion, Throwable e)
    throws IOException {
  // 0.20.203 version version has conflicting opcodes with the later releases.
  // The editlog must be emptied by restarting the namenode, before proceeding
  // with the upgrade.
  if (Storage.is203LayoutVersion(logVersion)
      && logVersion != HdfsConstants.NAMENODE_LAYOUT_VERSION) {
    String msg = "During upgrade failed to load the editlog version "
        + logVersion + " from release 0.20.203. Please go back to the old "
        + " release and restart the namenode. This empties the editlog "
        + " and saves the namespace. Resume the upgrade after this step.";
    throw new IOException(msg, e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:FSEditLogLoader.java

示例3: format

public void format() throws IOException {
  this.layoutVersion = HdfsConstants.NAMENODE_LAYOUT_VERSION;
  for (Iterator<StorageDirectory> it =
                         dirIterator(); it.hasNext();) {
    StorageDirectory sd = it.next();
    format(sd);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:NNStorage.java

示例4: updateStorageVersionForRollingUpgrade

private void updateStorageVersionForRollingUpgrade(final long layoutVersion,
    StartupOption startOpt) throws IOException {
  boolean rollingStarted = RollingUpgradeStartupOption.STARTED
      .matches(startOpt) && layoutVersion > HdfsConstants
      .NAMENODE_LAYOUT_VERSION;
  boolean rollingRollback = RollingUpgradeStartupOption.ROLLBACK
      .matches(startOpt);
  if (rollingRollback || rollingStarted) {
    fsImage.updateStorageVersion();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:FSNamesystem.java

示例5: NamespaceInfo

public NamespaceInfo(int nsID, String clusterID, String bpID,
    long cT, String buildVersion, String softwareVersion,
    long capabilities) {
  super(HdfsConstants.NAMENODE_LAYOUT_VERSION, nsID, clusterID, cT,
      NodeType.NAME_NODE);
  blockPoolID = bpID;
  this.buildVersion = buildVersion;
  this.softwareVersion = softwareVersion;
  this.capabilities = capabilities;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:NamespaceInfo.java

示例6: testMetadataVersionOutput

@Test(timeout = 30000)
public void testMetadataVersionOutput() throws IOException {

  initConfig();
  dfsCluster = new MiniDFSCluster.Builder(conf).
      manageNameDfsDirs(false).
      numDataNodes(1).
      checkExitOnShutdown(false).
      build();
  dfsCluster.waitClusterUp();
  dfsCluster.shutdown(false);
  initConfig();
  final PrintStream origOut = System.out;
  final ByteArrayOutputStream baos = new ByteArrayOutputStream();
  final PrintStream stdOut = new PrintStream(baos);
  System.setOut(stdOut);
  try {
    NameNode.createNameNode(new String[] { "-metadataVersion" }, conf);
  } catch (Exception e) {
    assertExceptionContains("ExitException", e);
  }
  /* Check if meta data version is printed correctly. */
  final String verNumStr = HdfsConstants.NAMENODE_LAYOUT_VERSION + "";
  assertTrue(baos.toString("UTF-8").
    contains("HDFS Image Version: " + verNumStr));
  assertTrue(baos.toString("UTF-8").
    contains("Software format version: " + verNumStr));
  System.setOut(origOut);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:TestMetadataVersionOutput.java

示例7: checkLayoutVersion

private boolean checkLayoutVersion(NamespaceInfo nsInfo) throws IOException {
  return (nsInfo.getLayoutVersion() == HdfsConstants.NAMENODE_LAYOUT_VERSION);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:3,代码来源:BootstrapStandby.java

示例8: verifyLayoutVersion

/**
 * Verify version.
 * @param version layout version
 * @throws IOException on layout version mismatch
 */
void verifyLayoutVersion(int version) throws IOException {
  if (version != HdfsConstants.NAMENODE_LAYOUT_VERSION)
    throw new IncorrectVersionException(
        HdfsConstants.NAMENODE_LAYOUT_VERSION, version, "data node");
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:NameNodeRpcServer.java

示例9: getServiceLayoutVersion

public int getServiceLayoutVersion() {
  return storageType == NodeType.DATA_NODE ? HdfsConstants.DATANODE_LAYOUT_VERSION
      : HdfsConstants.NAMENODE_LAYOUT_VERSION;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:4,代码来源:StorageInfo.java

示例10: testVersions

/**
 * This test ensures the appropriate response (successful or failure) from 
 * a Datanode when the system is started with differing version combinations. 
 * <pre>
 * For each 3-tuple in the cross product
 *   ({oldLayoutVersion,currentLayoutVersion,futureLayoutVersion},
 *    {currentNamespaceId,incorrectNamespaceId},
 *    {pastFsscTime,currentFsscTime,futureFsscTime})
 *      1. Startup Namenode with version file containing 
 *         (currentLayoutVersion,currentNamespaceId,currentFsscTime)
 *      2. Attempt to startup Datanode with version file containing 
 *         this iterations version 3-tuple
 * </pre>
 */
@Test (timeout=300000)
public void testVersions() throws Exception {
  UpgradeUtilities.initialize();
  Configuration conf = UpgradeUtilities.initializeStorageStateConf(1, 
                                                    new HdfsConfiguration());
  StorageData[] versions = initializeVersions();
  UpgradeUtilities.createNameNodeStorageDirs(
      conf.getStrings(DFSConfigKeys.DFS_NAMENODE_NAME_DIR_KEY), "current");
  cluster = new MiniDFSCluster.Builder(conf).numDataNodes(0)
                                            .format(false)
                                            .manageDataDfsDirs(false)
                                            .manageNameDfsDirs(false)
                                            .startupOption(StartupOption.REGULAR)
                                            .build();
  StorageData nameNodeVersion = new StorageData(
      HdfsConstants.NAMENODE_LAYOUT_VERSION,
      UpgradeUtilities.getCurrentNamespaceID(cluster),
      UpgradeUtilities.getCurrentClusterID(cluster),
      UpgradeUtilities.getCurrentFsscTime(cluster),
      UpgradeUtilities.getCurrentBlockPoolID(cluster));
  
  log("NameNode version info", NAME_NODE, null, nameNodeVersion);
  String bpid = UpgradeUtilities.getCurrentBlockPoolID(cluster);
  for (int i = 0; i < versions.length; i++) {
    File[] storage = UpgradeUtilities.createDataNodeStorageDirs(
        conf.getStrings(DFSConfigKeys.DFS_DATANODE_DATA_DIR_KEY), "current");
    log("DataNode version info", DATA_NODE, i, versions[i]);
    UpgradeUtilities.createDataNodeVersionFile(storage,
        versions[i].storageInfo, bpid, versions[i].blockPoolId);
    try {
      cluster.startDataNodes(conf, 1, false, StartupOption.REGULAR, null);
    } catch (Exception ignore) {
      // Ignore.  The asserts below will check for problems.
      // ignore.printStackTrace();
    }
    assertTrue(cluster.getNameNode() != null);
    assertEquals(isVersionCompatible(nameNodeVersion, versions[i]),
                 cluster.isDataNodeUp());
    cluster.shutdownDataNodes();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:55,代码来源:TestDFSStartupVersions.java

示例11: getCurrentNameNodeLayoutVersion

/**
 * Return the layout version inherent in the current version
 * of the Namenode, whether it is running or not.
 */
public static int getCurrentNameNodeLayoutVersion() {
  return HdfsConstants.NAMENODE_LAYOUT_VERSION;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:7,代码来源:UpgradeUtilities.java


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