Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,15 @@ BackupNode startBackupNode(Configuration conf,
return bn;
}

void waitCheckpointDone(MiniDFSCluster cluster, long txid) {
long thisCheckpointTxId;
do {
try {
LOG.info("Waiting checkpoint to complete... " +
"checkpoint txid should increase above " + txid);
Thread.sleep(1000);
} catch (Exception e) {}
// The checkpoint is not done until the nn has received it from the bn
thisCheckpointTxId = cluster.getNameNode().getFSImage().getStorage()
void waitCheckpointDone(MiniDFSCluster cluster, long txid)
throws Exception {
GenericTestUtils.waitFor(
() -> cluster.getNameNode().getFSImage().getStorage()
.getMostRecentCheckpointTxId() >= txid,
1000, 60000,
"Checkpoint txid did not advance above " + txid);
long thisCheckpointTxId = cluster.getNameNode().getFSImage().getStorage()
.getMostRecentCheckpointTxId();
} while (thisCheckpointTxId < txid);
// Check that the checkpoint got uploaded to NN successfully
FSImageTestUtil.assertNNHasCheckpoints(cluster,
Collections.singletonList((int)thisCheckpointTxId));
Expand Down Expand Up @@ -504,7 +501,7 @@ void testCheckpoint(StartupOption op) throws Exception {
* Verify that a file can be read both from NameNode and BackupNode.
*/
@Test
public void testCanReadData() throws IOException {
public void testCanReadData() throws Exception {
Path file1 = new Path("/fileToRead.dat");
Configuration conf = new HdfsConfiguration();
MiniDFSCluster cluster = null;
Expand Down
Loading