steveloughran commented on a change in pull request #983: HADOOP-16379: 
S3AInputStream#unbuffer should merge input stream stats into fs-wide stats
URL: https://github.com/apache/hadoop/pull/983#discussion_r294866058
 
 

 ##########
 File path: 
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AUnbuffer.java
 ##########
 @@ -60,6 +70,66 @@ public void testUnbuffer() throws IOException {
     }
   }
 
+  /**
+   * Test that calling {@link S3AInputStream#unbuffer()} merges a stream's
+   * {@link org.apache.hadoop.fs.s3a.S3AInstrumentation.InputStreamStatistics}
+   * into the {@link S3AFileSystem}'s {@link S3AInstrumentation} instance.
+   */
+  @Test
+  public void testUnbufferStreamStatistics() throws IOException {
+    describe("testUnbufferStreamStatistics");
+
+    // Create a new S3AFileSystem instance so we can have an independent
+    // instance of S3AInstrumentation
+    Configuration conf = createConfiguration();
+    S3AFileSystem fs = new S3AFileSystem();
+    fs.initialize(getFileSystem().getUri(), conf);
+
+    // Open file, read half the data, and then call unbuffer
+    FSDataInputStream inputStream = null;
+    try {
+      inputStream = fs.open(dest);
+
+      // Sanity check to make sure the stream statistics are 0
+      assertEquals(0,
 
 Review comment:
   use org.apache.hadoop.fs.s3a.S3ATestUtils.MetricDiff for measuring and 
asserting on state of metrics, as it generates meaningful error messages on 
assert failures.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to