Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11250#discussion_r53547665
  
    --- Diff: 
streaming/src/main/scala/org/apache/spark/streaming/dstream/FileInputDStream.scala
 ---
    @@ -163,8 +166,11 @@ class FileInputDStream[K, V, F <: NewInputFormat[K, 
V]](
       /** Clear the old time-to-files mappings along with old RDDs */
       protected[streaming] override def clearMetadata(time: Time) {
         super.clearMetadata(time)
    -    val oldFiles = batchTimeToSelectedFiles.filter(_._1 < (time - 
rememberDuration))
    -    batchTimeToSelectedFiles --= oldFiles.keys
    +    val oldFiles = batchTimeToSelectedFiles.synchronized
    +    {
    +      batchTimeToSelectedFiles.filter(_._1 < (time - rememberDuration))
    --- End diff --
    
    Same, I don't think it's safe to use the filtered collection outside the 
synchronized block. Here, maybe copying the collection result isn't a bad idea


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to