@@ -138,6 +138,30 @@ class FsHistoryProviderSuite extends FunSuite with BeforeAndAfter with Matchers
138138 }
139139 }
140140
141+ test(" SPARK-3697: ignore directories that cannot be read." ) {
142+ val logFile1 = new File (testDir, " new1" )
143+ writeFile(logFile1, true , None ,
144+ SparkListenerApplicationStart (" app1-1" , None , 1L , " test" ),
145+ SparkListenerApplicationEnd (2L )
146+ )
147+ val logFile2 = new File (testDir, " new2" )
148+ writeFile(logFile2, true , None ,
149+ SparkListenerApplicationStart (" app1-2" , None , 1L , " test" ),
150+ SparkListenerApplicationEnd (2L )
151+ )
152+ logFile2.setReadable(false , false )
153+
154+ val conf = new SparkConf ()
155+ .set(" spark.history.fs.logDirectory" , testDir.getAbsolutePath())
156+ .set(" spark.history.fs.updateInterval" , " 0" )
157+ val provider = new FsHistoryProvider (conf)
158+ provider.checkForLogs()
159+
160+ val list = provider.getListing().toSeq
161+ list should not be (null )
162+ list.size should be (1 )
163+ }
164+
141165 private def writeFile (file : File , isNewFormat : Boolean , codec : Option [CompressionCodec ],
142166 events : SparkListenerEvent * ) = {
143167 val out =
0 commit comments