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



##########
File path: 
pinot-server/src/main/java/org/apache/pinot/server/starter/helix/BaseServerStarter.java
##########
@@ -363,6 +377,41 @@ private void startupServiceStatusCheck(long endTimeMs) {
         ServiceStatus.getStatusDescription());
   }
 
+  /**
+   * Recursively deletes all data directories starting with tmp- last modified 
before the startTime.
+   * @param startTime start time of the application
+   * @param dataDir data directory to start from
+   */
+  @VisibleForTesting
+  public static void deleteTempFilesSinceCutoffTime(long startTime, @Nonnull 
File dataDir) {
+    if (!dataDir.exists() || !dataDir.isDirectory()) {
+      LOGGER.warn("Data directory {} does not exist or is not a directory", 
dataDir);
+      return;
+    }
+    IOFileFilter beforeStartTimeFilter = new AgeFileFilter(startTime, true);
+    IOFileFilter tmpPrefixFilter = new PrefixFileFilter("tmp-");

Review comment:
       hmm.. I gave it a try in my test env and found I could create tables 
with 'tmp-' prefix. Things like pushing segment to it and querying it worked as 
usual. In the server's dataDir, there was folder for the table like below. So 
it may be risky to use "tmp-" to clean up dirs. 
   
   ```
   
...PinotServerDataDir0/tmp-baseballStats_OFFLINE/tmp-baseballStats_OFFLINE_0/v3/
   columns.psf          creation.meta        index_map            
metadata.properties
   ```
   
   
![image](https://user-images.githubusercontent.com/61892277/148141545-5000a8dd-abd2-4cde-9bc0-4379b7469adc.png)
   
   




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