jackjlli commented on a change in pull request #7961:
URL: https://github.com/apache/pinot/pull/7961#discussion_r779942253



##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeTableDataManager.java
##########
@@ -465,9 +465,9 @@ private void downloadSegmentFromDeepStore(String 
segmentName, IndexLoadingConfig
    */
   private void untarAndMoveSegment(String segmentName, IndexLoadingConfig 
indexLoadingConfig, File segmentTarFile)
       throws IOException {
-    // TODO: This could leave temporary directories in _indexDir if JVM shuts 
down before the temporary directory is
-    //       deleted. Consider cleaning up all temporary directories when 
starting the server.
-    File tempSegmentDir = new File(_indexDir, "tmp-" + segmentName + "." + 
System.currentTimeMillis());
+    // This could leave temporary directories in _indexDir if JVM shuts down 
before the temp directory is deleted.

Review comment:
       If we really see a JVM gets shut down, I think it'd be good to consider 
changing JVM configs.

##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/data/manager/BaseTableDataManager.java
##########
@@ -102,6 +103,12 @@ public void init(TableDataManagerConfig 
tableDataManagerConfig, String instanceI
     if (!_indexDir.exists()) {
       Preconditions.checkState(_indexDir.mkdirs());
     }
+    _resourceTmpDir = new File(_indexDir, "tmp");
+    // Delete and recreate the tmp directory if it exists as it may contain 
old files from previous runs.
+    _resourceTmpDir.delete();

Review comment:
       +1 on deleting the directory quietly. We don't want an exception thrown 
during the startup of the server.




-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to