yzang commented on a change in pull request #1168: Fix TestBKSyncLogReader URL: https://github.com/apache/bookkeeper/pull/1168#discussion_r171987812
########## File path: stream/distributedlog/core/src/test/java/org/apache/distributedlog/TestBKSyncLogReader.java ########## @@ -184,26 +184,19 @@ public void testReadRecordsAfterReadAheadCaughtUp() throws Exception { logger.info("Write another 10 records"); - // wait until readahead move on - while (reader.getReadAheadReader().getNextEntryPosition().getEntryId() < 21) { - TimeUnit.MILLISECONDS.sleep(20); - } - - logger.info("ReadAhead is caught up with another 10 records"); - - // resume reading from sync reader. so it should be able to read all 20 records - // and return null to claim it as caughtup - LogRecord record = reader.readNext(false); - int numReads = 0; + // resume reading from sync reader util it consumes 20 records long expectedTxId = 1L; - while (null != record) { - ++numReads; + for (int i = 0; i < 20; i++) { + LogRecord record = reader.readNext(false); + while (null == record) { Review comment: Nit: we can probably use "do ... while" here? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services