maytasm commented on a change in pull request #11492:
URL: https://github.com/apache/druid/pull/11492#discussion_r676870803



##########
File path: 
indexing-service/src/main/java/org/apache/druid/indexing/worker/shuffle/ShuffleResource.java
##########
@@ -98,14 +96,19 @@ public Response getPartition(
       );
       return Response.status(Status.NOT_FOUND).entity(errorMessage).build();
     } else {
-      shuffleMetrics.ifPresent(metrics -> 
metrics.shuffleRequested(supervisorTaskId, partitionFile.length()));
-      return Response.ok(
-          (StreamingOutput) output -> {
-            try (final FileInputStream fileInputStream = new 
FileInputStream(partitionFile)) {
-              ByteStreams.copy(fileInputStream, output);
-            }
-          }
-      ).build();
+      try {
+        long size = partitionFile.get().size();

Review comment:
       The `LocalIntermediaryDataManager` uses `Files.asByteSource()` which 
returns `FileByteSource` which do file.length() which is the same as current 
behavior. The extension (that implements `IntermediaryDataManager`) can extends 
ByteSource and provide a method of returning size efficiently. I added javadoc 
to indicate this




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