[ 
https://issues.apache.org/jira/browse/HDFS-16847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17636189#comment-17636189
 ] 

ASF GitHub Bot commented on HDFS-16847:
---------------------------------------

simbadzina commented on code in PR #5145:
URL: https://github.com/apache/hadoop/pull/5145#discussion_r1027110257


##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileSystemImpl.java:
##########
@@ -82,17 +82,8 @@ protected boolean mkdir(String path) {
   @Override
   protected boolean rename(String src, String dst) {
     try {
-      if (fs instanceof DistributedFileSystem) {
-        DistributedFileSystem dfs = (DistributedFileSystem)fs;
-        dfs.rename(new Path(src), new Path(dst), Options.Rename.OVERWRITE);
-        return true;
-      } else {
-        // Replace should be atomic but not available
-        if (fs.exists(new Path(dst))) {
-          fs.delete(new Path(dst), true);
-        }
-        return fs.rename(new Path(src), new Path(dst));
-      }
+      FileUtil.rename(fs, new Path(src), new Path(dst), 
Options.Rename.OVERWRITE);

Review Comment:
   Hi @tomscut , if we aren't using a DistributedFileSystem, the old code does 
the replace itself by using a delete (if necessary) and then rename. This code 
is already available in Filesystem.java.
   
   More importantly, if there is a non DistributedFileSystem that has an atomic 
rename, the old code prevents us from using the available atomic rename.
   
   My change delegates the implementation of rename to the underlying 
Filesystem.
   
https://github.com/apache/hadoop/blob/c71a68ca8079ad8c87ddca37e51dfdc3bc2dbfc1/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java#L1648-L1650





> RBF: StateStore writer should not commit tmp fail if there was an error in 
> writing the file.
> --------------------------------------------------------------------------------------------
>
>                 Key: HDFS-16847
>                 URL: https://issues.apache.org/jira/browse/HDFS-16847
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: hdfs, rbf
>            Reporter: Simbarashe Dzinamarira
>            Assignee: Simbarashe Dzinamarira
>            Priority: Critical
>              Labels: pull-request-available
>
> The file based implementation of the RBF state store has a commit step that 
> moves a temporary file to a permanent location.
> There is a check to see if the write of the temp file was successfully, 
> however, the code to commit doesn't check the success flag.
> This is the relevant code: 
> [https://github.com/apache/hadoop/blob/7d39abd799a5f801a9fd07868a193205ab500bfa/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileBaseImpl.java#L369]
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to