steveloughran commented on code in PR #5580:
URL: https://github.com/apache/hadoop/pull/5580#discussion_r1178178480


##########
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3APrefetchingInputStream.java:
##########
@@ -202,13 +203,31 @@ public void testRandomReadLargeFile() throws Throwable {
 
       // Expected to get block 0 (partially read), 1 (prefetch), 2 (fully 
read), 3 (prefetch)
       // Blocks 0, 1, 3 were not fully read, so remain in the file cache
-      verifyStatisticCounterValue(ioStats, ACTION_HTTP_GET_REQUEST, 4);
-      verifyStatisticCounterValue(ioStats, STREAM_READ_OPENED, 4);
-      verifyStatisticCounterValue(ioStats, STREAM_READ_PREFETCH_OPERATIONS, 2);
-      verifyStatisticGaugeValue(ioStats, STREAM_READ_BLOCKS_IN_FILE_CACHE, 3);
+      GenericTestUtils.waitFor(() -> {

Review Comment:
   use LambdaTestUtils.eventually(), which will catch the asserts and retry the 
call, but when timing out will throw the exception for that useful stack trace 
we need.



##########
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3APrefetchingInputStream.java:
##########
@@ -202,13 +203,31 @@ public void testRandomReadLargeFile() throws Throwable {
 
       // Expected to get block 0 (partially read), 1 (prefetch), 2 (fully 
read), 3 (prefetch)
       // Blocks 0, 1, 3 were not fully read, so remain in the file cache
-      verifyStatisticCounterValue(ioStats, ACTION_HTTP_GET_REQUEST, 4);
-      verifyStatisticCounterValue(ioStats, STREAM_READ_OPENED, 4);
-      verifyStatisticCounterValue(ioStats, STREAM_READ_PREFETCH_OPERATIONS, 2);
-      verifyStatisticGaugeValue(ioStats, STREAM_READ_BLOCKS_IN_FILE_CACHE, 3);
+      GenericTestUtils.waitFor(() -> {
+        try {
+          LOG.info("IO stats: {}", ioStats);
+          verifyStatisticCounterValue(ioStats, ACTION_HTTP_GET_REQUEST, 4);
+          verifyStatisticCounterValue(ioStats, STREAM_READ_OPENED, 4);
+          verifyStatisticCounterValue(ioStats, 
STREAM_READ_PREFETCH_OPERATIONS, 2);
+          verifyStatisticGaugeValue(ioStats, STREAM_READ_BLOCKS_IN_FILE_CACHE, 
3);
+          return true;
+        } catch (AssertionError e) {
+          LOG.error("Assertion failure.", e);
+          return false;
+        }
+      }, 500, 5000, "IO stats assertion failed");

Review Comment:
   make these two timings constants and use below too



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to