HDFS-10641. TestBlockManager#testBlockReportQueueing fails intermittently. (Contributed by Daryn Sharp)
This commit is contained in:
parent
23161c67cf
commit
2f4660ce98
|
@ -945,6 +945,7 @@ public class TestBlockManager {
|
||||||
|
|
||||||
final CyclicBarrier startBarrier = new CyclicBarrier(2);
|
final CyclicBarrier startBarrier = new CyclicBarrier(2);
|
||||||
final CountDownLatch endLatch = new CountDownLatch(3);
|
final CountDownLatch endLatch = new CountDownLatch(3);
|
||||||
|
final CountDownLatch doneLatch = new CountDownLatch(1);
|
||||||
|
|
||||||
// create a task intended to block while processing, thus causing
|
// create a task intended to block while processing, thus causing
|
||||||
// the queue to backup. simulates how a full BR is processed.
|
// the queue to backup. simulates how a full BR is processed.
|
||||||
|
@ -952,7 +953,7 @@ public class TestBlockManager {
|
||||||
new Callable<Void>(){
|
new Callable<Void>(){
|
||||||
@Override
|
@Override
|
||||||
public Void call() throws IOException {
|
public Void call() throws IOException {
|
||||||
return bm.runBlockOp(new Callable<Void>() {
|
bm.runBlockOp(new Callable<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Void call()
|
public Void call()
|
||||||
throws InterruptedException, BrokenBarrierException {
|
throws InterruptedException, BrokenBarrierException {
|
||||||
|
@ -962,6 +963,9 @@ public class TestBlockManager {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// signal that runBlockOp returned
|
||||||
|
doneLatch.countDown();
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1006,7 +1010,7 @@ public class TestBlockManager {
|
||||||
startBarrier.await(1, TimeUnit.SECONDS);
|
startBarrier.await(1, TimeUnit.SECONDS);
|
||||||
assertTrue(endLatch.await(1, TimeUnit.SECONDS));
|
assertTrue(endLatch.await(1, TimeUnit.SECONDS));
|
||||||
assertEquals(0, bm.getBlockOpQueueLength());
|
assertEquals(0, bm.getBlockOpQueueLength());
|
||||||
assertTrue(blockingOp.isDone());
|
assertTrue(doneLatch.await(1, TimeUnit.SECONDS));
|
||||||
} finally {
|
} finally {
|
||||||
cluster.shutdown();
|
cluster.shutdown();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue