本文整理汇总了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();
}
}
}
示例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();
}
}
}
示例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;
}