GitHub user windpiger opened a pull request:

    https://github.com/apache/spark/pull/17079

    [SPARK-19748][SQL]refresh function has an wrong order to do cache 
invalidate and regenerate the inmemory var for InMemoryFileIndex with 
FileStatusCache

    ## What changes were proposed in this pull request?
    
    If we refresh a InMemoryFileIndex with a FileStatusCache, it will first use 
the FileStatusCache to re-generate the cachedLeafFiles etc, then call 
FileStatusCache.invalidateAll. 
    
    While the order to do these two actions is wrong, this lead to the refresh 
action does not take effect.
    
    ```
      override def refresh(): Unit = {
        refresh0()
        fileStatusCache.invalidateAll()
      }
    
      private def refresh0(): Unit = {
        val files = listLeafFiles(rootPaths)
        cachedLeafFiles =
          new mutable.LinkedHashMap[Path, FileStatus]() ++= files.map(f => 
f.getPath -> f)
        cachedLeafDirToChildrenFiles = 
files.toArray.groupBy(_.getPath.getParent)
        cachedPartitionSpec = null
      }
    ```
    ## How was this patch tested?
    unit test added

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/windpiger/spark fixInMemoryFileIndexRefresh

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/17079.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #17079
    
----
commit 552955a5293bc22da1cd644ffde90b883fc560e8
Author: windpiger <[email protected]>
Date:   2017-02-27T07:46:18Z

    [SPARK-19748][SQL]refresh function has an wrong order to do cache 
invalidate and regenerate the inmemory var for InMemoryFileIndex with 
FileStatusCache

commit fd3bb21597809409e7f33796589c9178744063c5
Author: windpiger <[email protected]>
Date:   2017-02-27T07:53:46Z

    modify the test case

----


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