prashantwason commented on a change in pull request #2496:
URL: https://github.com/apache/hudi/pull/2496#discussion_r568229644



##########
File path: 
hudi-common/src/main/java/org/apache/hudi/common/fs/HoodieWrapperFileSystem.java
##########
@@ -192,27 +261,74 @@ public FSDataOutputStream create(Path f, FsPermission 
permission, boolean overwr
     return executeFuncWithTimeMetrics(MetricName.create.name(), f, () -> {
       final Path translatedPath = convertToDefaultPath(f);
       return wrapOutputStream(f,
-          fileSystem.create(translatedPath, permission, overwrite, bufferSize, 
replication, blockSize, progress));
+          fileSystem.create(translatedPath, permission, overwrite, bufferSize, 
replication, blockSize, progress), bufferSize);
     });
   }
 
-  private FSDataOutputStream wrapOutputStream(final Path path, 
FSDataOutputStream fsDataOutputStream)
+
+  /**
+   * The stream hierarchy after wrapping will be as follows.
+   *
+   *  FSDataOuputStream (returned)
+   *      BufferedOutputStream (required for output buffering)
+   *          TimedSizeAwareOutputStream  (required for tracking metrics, 
timings and the number of bytes written)
+   *               fs.open()   (Original stream returned from underlying 
FileSystem)
+   */
+  private FSDataOutputStream wrapOutputStream(final Path path, 
FSDataOutputStream fsDataOutputStream, int bufferSize)
       throws IOException {
-    if (fsDataOutputStream instanceof SizeAwareFSDataOutputStream) {
-      return fsDataOutputStream;
+    TimedSizeAwareOutputStream tos = new TimedSizeAwareOutputStream(path, 
fsDataOutputStream, consistencyGuard,
+        () -> openStreams.remove(path.getName()));
+
+    if (ioBufferingEnabled) {
+      int minBufferSize = (HoodieFileFormat.isBaseFile(path) || 
FSUtils.isLogFile(path)) ? minDataFileIOBufferSizeBytes
+          : minFileIOBufferSizeBytes;

Review comment:
       Done




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to