[ 
https://issues.apache.org/jira/browse/HADOOP-18697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17716831#comment-17716831
 ] 

ASF GitHub Bot commented on HADOOP-18697:
-----------------------------------------

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





> Fix transient failure of 
> ITestS3APrefetchingInputStream#testRandomReadLargeFile
> -------------------------------------------------------------------------------
>
>                 Key: HADOOP-18697
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18697
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: fs/s3, test
>    Affects Versions: 3.4.0
>            Reporter: Steve Loughran
>            Assignee: Viraj Jasani
>            Priority: Major
>              Labels: pull-request-available
>
> intermittent failure of test; caller in uk, no VPN involved. does not always 
> surface
> {code}
> testRandomReadLargeFile(org.apache.hadoop.fs.s3a.ITestS3APrefetchingInputStream)
>   Time elapsed: 19.913 s  <<< FAILURE!
> org.junit.ComparisonFailure: [Gauge named stream_read_blocks_in_cache with 
> expected value 3] expected:<[3]L> but was:<[2]L>
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to