kabhishek4 commented on code in PR #5605: URL: https://github.com/apache/hbase/pull/5605#discussion_r1540512005
########## hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestPrefetch.java: ########## @@ -295,10 +302,23 @@ private void readStoreFile(Path storeFilePath, throws Exception { // Open the file HFile.Reader reader = HFile.createReader(fs, storeFilePath, cacheConfig, true, conf); + startTimer(); while (!reader.prefetchComplete()) { // Sleep for a bit Thread.sleep(1000); + if (getComputeTiming()) { + // After task is scheduled and before the delay expires, prefetch should not start + // if prefetchFutures contains entry (which means it's not cancelled or completed) + // and wait time remaining is below delay expiry watermark, it can be deduced that + // the prefetch is not started yet. + if (getElapsedTime() >= (conf.getLong(PREFETCH_DELAY, 1000))) { + assertTrue("Prefetch should be started at this point", reader.prefetchStarted()); + setComputeTiming(false); + } else { + assertFalse("Prefetch Should not start at this point", reader.prefetchStarted()); + } + } Review Comment: In prefetch executor, we further compute passed in delay using variation and a random multiplier to get 'effective delay'. Hence, in the test, for delay of 25000 milli-secs checking that prefetch is started after 20000 milli-sec and prefetch started after that. However, prefetch should not start after configured delay. In previous change set, I had introduced new class variable i.e. computedDealy which could have helped to get the exact value however, later removed due to previous comments. Tried to disable the PREFETCH_DELAY_VARIATION in the tests but looks like it's not possible. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@hbase.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org