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


Java NameNodeLayoutVersion.CURRENT_LAYOUT_VERSION属性代码示例

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


在下文中一共展示了NameNodeLayoutVersion.CURRENT_LAYOUT_VERSION属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testRejectNewFsImage

/**
 * Ensure that during downgrade the NN fails to load a fsimage with newer
 * format.
 */
@Test(expected = IncorrectVersionException.class)
public void testRejectNewFsImage() throws IOException {
  final Configuration conf = new Configuration();
  MiniDFSCluster cluster = null;
  try {
    cluster = new MiniDFSCluster.Builder(conf).numDataNodes(0).build();
    cluster.waitActive();
    DistributedFileSystem fs = cluster.getFileSystem();
    fs.setSafeMode(SafeModeAction.SAFEMODE_ENTER);
    fs.saveNamespace();
    fs.setSafeMode(SafeModeAction.SAFEMODE_LEAVE);
    NNStorage storage = spy(cluster.getNameNode().getFSImage().getStorage());
    int futureVersion = NameNodeLayoutVersion.CURRENT_LAYOUT_VERSION - 1;
    doReturn(futureVersion).when(storage).getServiceLayoutVersion();
    storage.writeAll();
    cluster.restartNameNode(0, true, "-rollingUpgrade", "downgrade");
  } finally {
    if (cluster != null) {
      cluster.shutdown();
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:TestRollingUpgradeDowngrade.java

示例2: testRejectNewFsImage

/**
 * Ensure that restart namenode with downgrade option should throw exception
 * because it has been obsolete.
 */
@Test(expected = IllegalArgumentException.class)
public void testRejectNewFsImage() throws IOException {
  final Configuration conf = new Configuration();
  MiniDFSCluster cluster = null;
  try {
    cluster = new MiniDFSCluster.Builder(conf).numDataNodes(0).build();
    cluster.waitActive();
    DistributedFileSystem fs = cluster.getFileSystem();
    fs.setSafeMode(SafeModeAction.SAFEMODE_ENTER);
    fs.saveNamespace();
    fs.setSafeMode(SafeModeAction.SAFEMODE_LEAVE);
    NNStorage storage = spy(cluster.getNameNode().getFSImage().getStorage());
    int futureVersion = NameNodeLayoutVersion.CURRENT_LAYOUT_VERSION - 1;
    doReturn(futureVersion).when(storage).getServiceLayoutVersion();
    storage.writeAll();
    cluster.restartNameNode(0, true, "-rollingUpgrade", "downgrade");
  } finally {
    if (cluster != null) {
      cluster.shutdown();
    }
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:26,代码来源:TestRollingUpgradeDowngrade.java

示例3: startLogSegment

/** @see JournalProtocol#startLogSegment */
@Override
public StartLogSegmentResponseProto startLogSegment(RpcController controller,
    StartLogSegmentRequestProto req) throws ServiceException {
  try {
    int layoutVersion = req.hasLayoutVersion() ? req.getLayoutVersion()
        : NameNodeLayoutVersion.CURRENT_LAYOUT_VERSION;
    impl.startLogSegment(convert(req.getReqInfo()), req.getTxid(),
        layoutVersion);
  } catch (IOException e) {
    throw new ServiceException(e);
  }
  return VOID_START_LOG_SEGMENT_RESPONSE;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:QJournalProtocolServerSideTranslatorPB.java


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