jasperjiaguo commented on code in PR #8753:
URL: https://github.com/apache/pinot/pull/8753#discussion_r892887411


##########
pinot-common/src/main/java/org/apache/pinot/common/utils/TarGzCompressionUtils.java:
##########
@@ -198,4 +221,29 @@ public static void untarOneFile(File inputFile, String 
fileName, File outputFile
       throw new IOException(String.format("Failed to find file: %s in: %s", 
fileName, inputFile));
     }
   }
+
+  public static long copyLarge(InputStream inputStream, FileOutputStream 
outputStream, long rateLimit)
+      throws IOException {
+    Objects.requireNonNull(inputStream, "inputStream is null");
+    Objects.requireNonNull(outputStream, "outputStream is null");
+    FileDescriptor fd = outputStream.getFD();
+    byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
+    RateLimiter rateLimiter = RateLimiter.create(rateLimit);
+    long count;
+    int n;
+
+    if (rateLimit == MATCH_UNTAR_RATE) {
+      for (count = 0L; -1 != (n = inputStream.read(buffer)); count += (long) 
n) {
+        outputStream.write(buffer, 0, n);
+        fd.sync();

Review Comment:
   added



-- 
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