本文整理汇总了Java中org.apache.hadoop.hdfs.server.namenode.CheckpointSignature类的典型用法代码示例。如果您正苦于以下问题:Java CheckpointSignature类的具体用法?Java CheckpointSignature怎么用?Java CheckpointSignature使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CheckpointSignature类属于org.apache.hadoop.hdfs.server.namenode包,在下文中一共展示了CheckpointSignature类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convert
import org.apache.hadoop.hdfs.server.namenode.CheckpointSignature; //导入依赖的package包/类
public static CheckpointSignatureProto convert(CheckpointSignature s) {
return CheckpointSignatureProto.newBuilder()
.setBlockPoolId(s.getBlockpoolID())
.setCurSegmentTxId(s.getCurSegmentTxId())
.setMostRecentCheckpointTxId(s.getMostRecentCheckpointTxId())
.setStorageInfo(PBHelper.convert((StorageInfo) s)).build();
}
示例2: rollEditLog
import org.apache.hadoop.hdfs.server.namenode.CheckpointSignature; //导入依赖的package包/类
@Override
public RollEditLogResponseProto rollEditLog(RpcController unused,
RollEditLogRequestProto request) throws ServiceException {
CheckpointSignature signature;
try {
signature = impl.rollEditLog();
} catch (IOException e) {
throw new ServiceException(e);
}
return RollEditLogResponseProto.newBuilder()
.setSignature(PBHelper.convert(signature)).build();
}
示例3: rollEditLog
import org.apache.hadoop.hdfs.server.namenode.CheckpointSignature; //导入依赖的package包/类
@Override
public CheckpointSignature rollEditLog() throws IOException {
try {
return PBHelper.convert(rpcProxy.rollEditLog(NULL_CONTROLLER,
VOID_ROLL_EDITLOG_REQUEST).getSignature());
} catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(e);
}
}
示例4: endCheckpoint
import org.apache.hadoop.hdfs.server.namenode.CheckpointSignature; //导入依赖的package包/类
@Override
public void endCheckpoint(NamenodeRegistration registration,
CheckpointSignature sig) throws IOException {
EndCheckpointRequestProto req = EndCheckpointRequestProto.newBuilder()
.setRegistration(PBHelper.convert(registration))
.setSignature(PBHelper.convert(sig)).build();
try {
rpcProxy.endCheckpoint(NULL_CONTROLLER, req);
} catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(e);
}
}
示例5: testSharedEditsMissingLogs
import org.apache.hadoop.hdfs.server.namenode.CheckpointSignature; //导入依赖的package包/类
/**
* Test for the case where the shared edits dir doesn't have
* all of the recent edit logs.
*/
@Test
public void testSharedEditsMissingLogs() throws Exception {
removeStandbyNameDirs();
CheckpointSignature sig = nn0.getRpcServer().rollEditLog();
assertEquals(3, sig.getCurSegmentTxId());
// Should have created edits_1-2 in shared edits dir
URI editsUri = cluster.getSharedEditsDir(0, 1);
File editsDir = new File(editsUri);
File editsSegment = new File(new File(editsDir, "current"),
NNStorage.getFinalizedEditsFileName(1, 2));
GenericTestUtils.assertExists(editsSegment);
// Delete the segment.
assertTrue(editsSegment.delete());
// Trying to bootstrap standby should now fail since the edit
// logs aren't available in the shared dir.
LogCapturer logs = GenericTestUtils.LogCapturer.captureLogs(
LogFactory.getLog(BootstrapStandby.class));
try {
int rc = BootstrapStandby.run(
new String[]{"-force"},
cluster.getConfiguration(1));
assertEquals(BootstrapStandby.ERR_CODE_LOGS_UNAVAILABLE, rc);
} finally {
logs.stopCapturing();
}
GenericTestUtils.assertMatches(logs.getOutput(),
"FATAL.*Unable to read transaction ids 1-3 from the configured shared");
}
示例6: testConvertCheckpointSignature
import org.apache.hadoop.hdfs.server.namenode.CheckpointSignature; //导入依赖的package包/类
@Test
public void testConvertCheckpointSignature() {
CheckpointSignature s = new CheckpointSignature(
getStorageInfo(NodeType.NAME_NODE), "bpid", 100, 1);
CheckpointSignatureProto sProto = PBHelper.convert(s);
CheckpointSignature s1 = PBHelper.convert(sProto);
assertEquals(s.getBlockpoolID(), s1.getBlockpoolID());
assertEquals(s.getClusterID(), s1.getClusterID());
assertEquals(s.getCTime(), s1.getCTime());
assertEquals(s.getCurSegmentTxId(), s1.getCurSegmentTxId());
assertEquals(s.getLayoutVersion(), s1.getLayoutVersion());
assertEquals(s.getMostRecentCheckpointTxId(),
s1.getMostRecentCheckpointTxId());
assertEquals(s.getNamespaceID(), s1.getNamespaceID());
}
示例7: testSharedEditsMissingLogs
import org.apache.hadoop.hdfs.server.namenode.CheckpointSignature; //导入依赖的package包/类
/**
* Test for the case where the shared edits dir doesn't have
* all of the recent edit logs.
*/
@Test
public void testSharedEditsMissingLogs() throws Exception {
removeStandbyNameDirs();
CheckpointSignature sig = nn0.getRpcServer().rollEditLog();
assertEquals(3, sig.getCurSegmentTxId());
// Should have created edits_1-2 in shared edits dir
URI editsUri = cluster.getSharedEditsDir(0, maxNNCount - 1);
File editsDir = new File(editsUri);
File currentDir = new File(editsDir, "current");
File editsSegment = new File(currentDir,
NNStorage.getFinalizedEditsFileName(1, 2));
GenericTestUtils.assertExists(editsSegment);
GenericTestUtils.assertExists(currentDir);
// Delete the segment.
assertTrue(editsSegment.delete());
// Trying to bootstrap standby should now fail since the edit
// logs aren't available in the shared dir.
LogCapturer logs = GenericTestUtils.LogCapturer.captureLogs(
LogFactory.getLog(BootstrapStandby.class));
try {
assertEquals(BootstrapStandby.ERR_CODE_LOGS_UNAVAILABLE, forceBootstrap(1));
} finally {
logs.stopCapturing();
}
GenericTestUtils.assertMatches(logs.getOutput(),
"FATAL.*Unable to read transaction ids 1-3 from the configured shared");
}
示例8: finalizeCheckpoint
import org.apache.hadoop.hdfs.server.namenode.CheckpointSignature; //导入依赖的package包/类
private void finalizeCheckpoint(CheckpointSignature sig)
throws IOException{
try {
File imageFile = fsImage.storage.getFsImageName(
StorageLocationType.LOCAL, sig.mostRecentCheckpointTxId);
InjectionHandler.processEvent(InjectionEvent.STANDBY_BEFORE_PUT_IMAGE,
imageFile);
// start a thread to validate image while uploading the image to primary
createImageValidation(imageFile);
// copy image to primary namenode
uploadImage(sig.mostRecentCheckpointTxId);
// check if the image is valid
checkImageValidation();
// make transaction to primary namenode to switch edit logs
LOG.info("Standby: Checkpointing - Roll fsimage on primary namenode.");
InjectionHandler.processEventIO(InjectionEvent.STANDBY_BEFORE_ROLL_IMAGE);
assertState(
StandbyIngestState.NOT_INGESTING,
StandbyIngestState.INGESTING_EDITS);
primaryNamenode.rollFsImage(new CheckpointSignature(fsImage));
setLastRollSignature(null);
LOG.info("Standby: Checkpointing - Checkpoint done. New Image Size: "
+ fsImage.getFsImageName(StorageLocationType.LOCAL).length());
checkpointStatus("Completed");
} finally {
interruptImageValidation();
}
}
示例9: testConvertCheckpointSignature
import org.apache.hadoop.hdfs.server.namenode.CheckpointSignature; //导入依赖的package包/类
@Test
public void testConvertCheckpointSignature() {
CheckpointSignature s = new CheckpointSignature(getStorageInfo(), "bpid",
100, 1);
CheckpointSignatureProto sProto = PBHelper.convert(s);
CheckpointSignature s1 = PBHelper.convert(sProto);
assertEquals(s.getBlockpoolID(), s1.getBlockpoolID());
assertEquals(s.getClusterID(), s1.getClusterID());
assertEquals(s.getCTime(), s1.getCTime());
assertEquals(s.getCurSegmentTxId(), s1.getCurSegmentTxId());
assertEquals(s.getLayoutVersion(), s1.getLayoutVersion());
assertEquals(s.getMostRecentCheckpointTxId(),
s1.getMostRecentCheckpointTxId());
assertEquals(s.getNamespaceID(), s1.getNamespaceID());
}