HeartSaVioR commented on a change in pull request #25488: [SPARK-28025][SS] Fix 
FileContextBasedCheckpointFileManager leaking crc files
URL: https://github.com/apache/spark/pull/25488#discussion_r315003857
 
 

 ##########
 File path: 
sql/core/src/test/scala/org/apache/spark/sql/execution/streaming/HDFSMetadataLogSuite.scala
 ##########
 @@ -75,12 +91,16 @@ class HDFSMetadataLogSuite extends SparkFunSuite with 
SharedSQLContext {
       assert(metadataLog.get(2).isDefined)
       assert(metadataLog.getLatest().get._1 == 2)
 
-      // There should be exactly one file, called "2", in the metadata 
directory.
+      // There should be at most two files, called "2", and optionally crc 
file,
+      // in the metadata directory.
       // This check also tests for regressions of SPARK-17475
-      val allFiles = new File(metadataLog.metadataPath.toString).listFiles()
-        .filter(!_.getName.startsWith(".")).toSeq
-      assert(allFiles.size == 1)
-      assert(allFiles(0).getName() == "2")
+      val allFiles = new 
File(metadataLog.metadataPath.toString).listFiles().toSeq
+      assert(allFiles.size <= 2)
+      assert(allFiles.exists(_.getName == "2"))
+      if (allFiles.size == 2) {
 
 Review comment:
   FileSystemBasedCheckpointFileManager is the case of crc file being left: 
it's not a leak because the origin file exists. It correctly deletes crc file 
when origin file is requested to be deleted, hence crc files for 0 and 1 don't 
exist.

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