xiangfu0 commented on code in PR #17070:
URL: https://github.com/apache/pinot/pull/17070#discussion_r2467844857


##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeSegmentDataManager.java:
##########
@@ -1167,10 +1182,10 @@ protected SegmentBuildDescriptor 
buildSegmentInternal(boolean forCommit)
       final long lockAcquireTimeMillis = now();
       // Build a segment from in-memory rows.
       // If build compressed archive is true, then build the tar.compressed 
file as well
-      // TODO Use an auto-closeable object to delete temp resources.
+      // Create an auto-closeable object to ensure temp resources are deleted
       File tempSegmentFolder = new File(_resourceTmpDir, "tmp-" + 
_segmentNameStr + "-" + now());
-
-      SegmentZKPropsConfig segmentZKPropsConfig = new SegmentZKPropsConfig();
+      try (TempFolderCloseable tempFolderCloseable = new 
TempFolderCloseable(tempSegmentFolder)) {
+        SegmentZKPropsConfig segmentZKPropsConfig = new SegmentZKPropsConfig();
       segmentZKPropsConfig.setStartOffset(_segmentZKMetadata.getStartOffset());

Review Comment:
   You need to fix the indentation for the code block



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