HDFS-6533. TestBPOfferService#testBasicFunctionalitytest fails intermittently. (Contributed by Wei-Chiu Chuang)
This commit is contained in:
parent
a99274ea96
commit
05d7202b1e
|
@ -1550,6 +1550,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
HDFS-9336. deleteSnapshot throws NPE when snapshotname is null.
|
HDFS-9336. deleteSnapshot throws NPE when snapshotname is null.
|
||||||
(Brahma Reddy Battula via aajisaka)
|
(Brahma Reddy Battula via aajisaka)
|
||||||
|
|
||||||
|
HDFS-6533. TestBPOfferService#testBasicFunctionalitytest fails
|
||||||
|
intermittently. (Wei-Chiu Chuang via Arpit Agarwal)
|
||||||
|
|
||||||
Release 2.7.3 - UNRELEASED
|
Release 2.7.3 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -127,6 +127,10 @@ class BPServiceActor implements Runnable {
|
||||||
scheduler = new Scheduler(dnConf.heartBeatInterval, dnConf.blockReportInterval);
|
scheduler = new Scheduler(dnConf.heartBeatInterval, dnConf.blockReportInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DatanodeRegistration getBpRegistration() {
|
||||||
|
return bpRegistration;
|
||||||
|
}
|
||||||
|
|
||||||
boolean isAlive() {
|
boolean isAlive() {
|
||||||
if (!shouldServiceRun || !bpThread.isAlive()) {
|
if (!shouldServiceRun || !bpThread.isAlive()) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -180,7 +180,7 @@ public class TestBPOfferService {
|
||||||
BPOfferService bpos = setupBPOSForNNs(mockNN1, mockNN2);
|
BPOfferService bpos = setupBPOSForNNs(mockNN1, mockNN2);
|
||||||
bpos.start();
|
bpos.start();
|
||||||
try {
|
try {
|
||||||
waitForInitialization(bpos);
|
waitForBothActors(bpos);
|
||||||
|
|
||||||
// The DN should have register to both NNs.
|
// The DN should have register to both NNs.
|
||||||
Mockito.verify(mockNN1).registerDatanode(
|
Mockito.verify(mockNN1).registerDatanode(
|
||||||
|
@ -205,6 +205,7 @@ public class TestBPOfferService {
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
bpos.stop();
|
bpos.stop();
|
||||||
|
bpos.join();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,6 +236,7 @@ public class TestBPOfferService {
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
bpos.stop();
|
bpos.stop();
|
||||||
|
bpos.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should ignore the delete command from the standby
|
// Should ignore the delete command from the standby
|
||||||
|
@ -260,6 +262,7 @@ public class TestBPOfferService {
|
||||||
waitForOneToFail(bpos);
|
waitForOneToFail(bpos);
|
||||||
} finally {
|
} finally {
|
||||||
bpos.stop();
|
bpos.stop();
|
||||||
|
bpos.join();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,6 +310,7 @@ public class TestBPOfferService {
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
bpos.stop();
|
bpos.stop();
|
||||||
|
bpos.join();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,6 +353,7 @@ public class TestBPOfferService {
|
||||||
waitForBlockReport(mockNN1, mockNN2);
|
waitForBlockReport(mockNN1, mockNN2);
|
||||||
} finally {
|
} finally {
|
||||||
bpos.stop();
|
bpos.stop();
|
||||||
|
bpos.join();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,6 +409,27 @@ public class TestBPOfferService {
|
||||||
}, 100, 10000);
|
}, 100, 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void waitForBothActors(final BPOfferService bpos)
|
||||||
|
throws Exception {
|
||||||
|
GenericTestUtils.waitFor(new Supplier<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public Boolean get() {
|
||||||
|
List<BPServiceActor> actors = bpos.getBPServiceActors();
|
||||||
|
|
||||||
|
return bpos.isAlive() && getRegisteredActors(actors) == 2;
|
||||||
|
}
|
||||||
|
private int getRegisteredActors(List<BPServiceActor> actors) {
|
||||||
|
int regActors = 0;
|
||||||
|
for (BPServiceActor actor : actors) {
|
||||||
|
if (actor.getBpRegistration() != null) {
|
||||||
|
regActors++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return regActors;
|
||||||
|
}
|
||||||
|
}, 100, 10000);
|
||||||
|
}
|
||||||
|
|
||||||
private void waitForBlockReport(final DatanodeProtocolClientSideTranslatorPB mockNN)
|
private void waitForBlockReport(final DatanodeProtocolClientSideTranslatorPB mockNN)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
GenericTestUtils.waitFor(new Supplier<Boolean>() {
|
GenericTestUtils.waitFor(new Supplier<Boolean>() {
|
||||||
|
@ -540,6 +566,7 @@ public class TestBPOfferService {
|
||||||
difference < 5000);
|
difference < 5000);
|
||||||
} finally {
|
} finally {
|
||||||
bpos.stop();
|
bpos.stop();
|
||||||
|
bpos.join();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,6 +606,7 @@ public class TestBPOfferService {
|
||||||
+ " processing ", difference < 5000);
|
+ " processing ", difference < 5000);
|
||||||
} finally {
|
} finally {
|
||||||
bpos.stop();
|
bpos.stop();
|
||||||
|
bpos.join();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -624,6 +652,7 @@ public class TestBPOfferService {
|
||||||
+ "when errorReport threw IOException", secondCallTime != 0);
|
+ "when errorReport threw IOException", secondCallTime != 0);
|
||||||
} finally {
|
} finally {
|
||||||
bpos.stop();
|
bpos.stop();
|
||||||
|
bpos.join();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -675,6 +704,7 @@ public class TestBPOfferService {
|
||||||
.reportBadBlocks(Mockito.any(LocatedBlock[].class));
|
.reportBadBlocks(Mockito.any(LocatedBlock[].class));
|
||||||
} finally {
|
} finally {
|
||||||
bpos.stop();
|
bpos.stop();
|
||||||
|
bpos.join();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue