// arbitrary sleep for now.
Clock.sleep(1000);
// three blocks should have successfully made it.
assertEquals(3, master.getAckMan().getPending().size()); // (g0, g1, g3)
CounterSink ctr = (CounterSink) ReportManager.get().getReportable(rpt);
LOG.info(" Ack begin dropped, but all true messages went through. 20 == "
+ ctr.getCount() + " sent");
// We dropped an ack begin message. Messages still make it through and there
// should be some sort of ack warning on the master.
assertEquals(20, ctr.getCount());
// check master state
master.getAckMan().dumpLog();
Set<String> pending = master.getAckMan().getPending();
assertEquals(3, pending.size());
// check to make sure wal files are gone.
node.getAckChecker().checkAcks();
node.getAckChecker().checkRetry();
master.getAckMan().dumpLog();
pending = master.getAckMan().getPending();
LOG.info("Number of pending acks (retry had failure)" + pending.size());
assertEquals(0, pending.size());
LOG.info("Event count 20 (one message missing/lost) ==" + ctr.getCount());
assertEquals(20, ctr.getCount());
Clock.sleep(1000); // somehow force other thread to go.
// // Phase II - force message resent retry but one is dropped. (only 4 make
// it)
node.getAckChecker().checkAcks();
node.getAckChecker().forceRetry();
Clock.sleep(500); // somehow force other thread to go.
LOG.info("Was stuff resent? " + " 24 == " + ctr.getCount() + " sent");
// This retry succeeds sending 4 more messages
assertEquals(24, ctr.getCount());
assertEquals(0, master.getAckMan().getPending().size());
// // Phase III - force another retry
node.getAckChecker().checkAcks();
node.getAckChecker().forceRetry();
LOG
.info("After another check. " + count + " < " + ctr.getCount()
+ " sent");
Clock.sleep(500);
// suceeded sending 5 more messages.
assertEquals(29, ctr.getCount());
assertEquals(1, master.getAckMan().getPending().size());
// check the ack.
node.getAckChecker().checkAcks();
// we are clean.
assertEquals(29, ctr.getCount());
assertEquals(0, master.getAckMan().getPending().size());
wal.close();
}