GitHub user vitillo opened a pull request:
https://github.com/apache/spark/pull/17012
[SPARK-19677][SS] Renaming a file atop an existing one should not fail on
HDFS
## What changes were proposed in this pull request?
HDFSBackedStateStoreProvider fails to rename files on HDFS but not on the
local filesystem. According to the [implementation
notes](https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-common/filesystem/filesystem.html)
of `rename()`, the behavior of the local filesystem and HDFS varies:
> Destination exists and is a file
> Renaming a file atop an existing file is specified as failing, raising an
exception.
> - Local FileSystem : the rename succeeds; the destination file is
replaced by the source file.
> - HDFS : The rename fails, no exception is raised. Instead the method
call simply returns false.
This patch ensures that the destination of `rename()` is overwritten also
in HDFS.
## How was this patch tested?
This patch was tested by running `StateStoreSuite`.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/vitillo/spark fix_rename
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/17012.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 #17012
----
commit c985f39ad56e39943cff2341036e36919d8d063e
Author: Roberto Agostino Vitillo <[email protected]>
Date: 2017-02-21T07:34:28Z
Renaming a file atop an existing one should not fail on HDFS
----
---
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]