[ 
https://issues.apache.org/jira/browse/BEAM-5036?focusedWorklogId=150607&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-150607
 ]

ASF GitHub Bot logged work on BEAM-5036:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 03/Oct/18 05:39
            Start Date: 03/Oct/18 05:39
    Worklog Time Spent: 10m 
      Work Description: timrobertson100 commented on a change in pull request 
#6289: [BEAM-5036] Optimize the FileBasedSink WriteOperation.moveToOutput()
URL: https://github.com/apache/beam/pull/6289#discussion_r222186921
 
 

 ##########
 File path: 
sdks/java/core/src/main/java/org/apache/beam/sdk/io/LocalFileSystem.java
 ##########
 @@ -80,8 +82,20 @@
 class LocalFileSystem extends FileSystem<LocalResourceId> {
 
   private static final Logger LOG = 
LoggerFactory.getLogger(LocalFileSystem.class);
+  private static final CopyOption[] DEFAULT_RENAME_COPY_OPTIONS =
+      new CopyOption[] {StandardCopyOption.ATOMIC_MOVE};
 
-  LocalFileSystem() {}
+  private final CopyOption[] renameCopyOption;
+
+  LocalFileSystem() {
+    renameCopyOption = DEFAULT_RENAME_COPY_OPTIONS;
+  }
+
+  // Exists to allow testing behaviour of the FileSystems utility methods
+  @VisibleForTesting
+  LocalFileSystem(CopyOption[] renameCopyOption) {
 
 Review comment:
   The original tests for FileSystem already test the behavior of 
LocalFileSystem with atomic move. The other FileSystem implementations like 
HDFS do not have that behavior though. 
   
   I considered that to test FileSystems.rename we could either:
   1) Use a LocalFileSystem configured in a way to behave like other FS 
implementations (of course you would not use it in that manner normally)
   2) Have a standard test suite for FileSystems but run it in the tests of 
each FileSystem implementation
   
   I opted for approach 1) here but I get the impression that is not 
particularly clear so perhaps 2) would be better after all? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 150607)
    Time Spent: 8h 20m  (was: 8h 10m)

> Optimize FileBasedSink's WriteOperation.moveToOutput()
> ------------------------------------------------------
>
>                 Key: BEAM-5036
>                 URL: https://issues.apache.org/jira/browse/BEAM-5036
>             Project: Beam
>          Issue Type: Improvement
>          Components: io-java-files
>    Affects Versions: 2.5.0
>            Reporter: Jozef Vilcek
>            Assignee: Tim Robertson
>            Priority: Major
>          Time Spent: 8h 20m
>  Remaining Estimate: 0h
>
> moveToOutput() methods in FileBasedSink.WriteOperation implements move by 
> copy+delete. It would be better to use a rename() which can be much more 
> effective for some filesystems.
> Filesystem must support cross-directory rename. BEAM-4861 is related to this 
> for the case of HDFS filesystem.
> Feature was discussed here:
> http://mail-archives.apache.org/mod_mbox/beam-dev/201807.mbox/%3CCAF9t7_4Mp54pQ+vRrJrBh9Vx0=uaknupzd_qdh_qdm9vxll...@mail.gmail.com%3E



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to