vanzin commented on a change in pull request #26502: [SPARK-29876][SS] 
Delete/archive file source completed files in separate thread
URL: https://github.com/apache/spark/pull/26502#discussion_r351530290
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/FileStreamSource.scala
 ##########
 @@ -395,42 +404,50 @@ object FileStreamSource {
     }
 
     override def clean(entry: FileEntry): Unit = {
-      val curPath = new Path(new URI(entry.path))
-      val newPath = new Path(baseArchivePath.toString.stripSuffix("/") + 
curPath.toUri.getPath)
-
-      try {
-        logDebug(s"Creating directory if it doesn't exist 
${newPath.getParent}")
-        if (!fileSystem.exists(newPath.getParent)) {
-          fileSystem.mkdirs(newPath.getParent)
-        }
+      cleanThreadPool.submit(new Runnable {
 
 Review comment:
   You can avoid this by having `clean` be implemented in the base class and 
have concrete classes implement a `cleanTask` method, for example.
   
   Then it even makes it easy to disable the thread pool altogether (numThreads 
= 0).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to