use of org.apache.hadoop.hdfs.server.namenode.CheckpointSignature in project hadoop by apache.
the class TestPBHelper method testConvertCheckpointSignature.
@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());
}
use of org.apache.hadoop.hdfs.server.namenode.CheckpointSignature in project hadoop by apache.
the class TestBootstrapStandby method testSharedEditsMissingLogs.
/**
* 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");
}
Aggregations