shounakmk219 commented on code in PR #19627:
URL: https://github.com/apache/pinot/pull/19627#discussion_r4079866040


##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/ControllerAdminApiApplication.java:
##########
@@ -233,4 +242,30 @@ public void dispose(ExecutorService executorService) {
       // managed in ControllerAdminApiApplication.stop()
     }
   }
+
+  /// Points Jersey's multipart parser at the controller's own temporary 
directory instead of `java.io.tmpdir`.
+  ///
+  /// Jersey buffers any part larger than its threshold to disk, but only 
registers the parsed `MultiPart` with the
+  /// request's `CloseableService` after parsing succeeds. A request that 
fails to parse — a truncated upload, a
+  /// client disconnect, a malformed `Content-Disposition` — therefore leaves 
its spilled parts behind, and for
+  /// segment uploads those are the size of the segment. Directing them at the 
controller's temp tree means the
+  /// startup clean in [ControllerFilePathProvider] reclaims them rather than 
leaving them on the host forever.
+  ///
+  /// Resolved lazily: the admin application is constructed before 
[ControllerFilePathProvider] is initialized, but
+  /// Jersey does not build the multipart reader until the first multipart 
request arrives.
+  @VisibleForTesting
+  static class MultiPartTempDirResolver implements 
ContextResolver<MultiPartProperties> {
+    @Override
+    public MultiPartProperties getContext(Class<?> type) {
+      MultiPartProperties properties = new MultiPartProperties();
+      try {
+        return 
properties.tempDir(ControllerFilePathProvider.getInstance().getMultiPartTempDir().getAbsolutePath());

Review Comment:
   Good catch, addressed it



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