You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/02/16 22:02:00 UTC

[jira] [Work logged] (BEAM-11494) FileIO.Write overwrites destination files on retries

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

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

                Author: ASF GitHub Bot
            Created on: 16/Feb/21 22:01
            Start Date: 16/Feb/21 22:01
    Worklog Time Spent: 10m 
      Work Description: reuvenlax commented on a change in pull request #13558:
URL: https://github.com/apache/beam/pull/13558#discussion_r577167815



##########
File path: sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileSystems.java
##########
@@ -401,12 +412,23 @@ public ResourceId apply(@Nonnull Metadata input) {
     List<ResourceId> srcToHandle = new ArrayList<>();
     List<ResourceId> destToHandle = new ArrayList<>();
 
-    List<MatchResult> matchResults = matchResources(srcResourceIds);
-    for (int i = 0; i < matchResults.size(); ++i) {
-      if (!matchResults.get(i).status().equals(Status.NOT_FOUND)) {
-        srcToHandle.add(srcResourceIds.get(i));
-        destToHandle.add(destResourceIds.get(i));
+    List<MatchResult> matchSrcResults = matchResources(srcResourceIds);
+    List<MatchResult> matchDestResults = matchResources(destResourceIds);

Review comment:
       only populate matchDestResults if skipExistingDest is ste.

##########
File path: sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileSystems.java
##########
@@ -401,12 +412,23 @@ public ResourceId apply(@Nonnull Metadata input) {
     List<ResourceId> srcToHandle = new ArrayList<>();
     List<ResourceId> destToHandle = new ArrayList<>();
 
-    List<MatchResult> matchResults = matchResources(srcResourceIds);
-    for (int i = 0; i < matchResults.size(); ++i) {
-      if (!matchResults.get(i).status().equals(Status.NOT_FOUND)) {
-        srcToHandle.add(srcResourceIds.get(i));
-        destToHandle.add(destResourceIds.get(i));
+    List<MatchResult> matchSrcResults = matchResources(srcResourceIds);
+    List<MatchResult> matchDestResults = matchResources(destResourceIds);
+
+    for (int i = 0; i < matchSrcResults.size(); ++i) {
+      if (matchSrcResults.get(i).status().equals(Status.NOT_FOUND) && ignoreMissingSrc) {
+        // If the source is not found, and we are ignoring found source files, then we skip it.
+        continue;
+      }
+      if (matchDestResults.get(i).status().equals(Status.OK)
+          && matchDestResults.get(i).metadata().get(0).sizeBytes()
+              == matchSrcResults.get(i).metadata().get(0).sizeBytes()
+          && skipExistingDest) {

Review comment:
       put skipExistingDest first in the conditional.

##########
File path: sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileSystems.java
##########
@@ -401,12 +412,23 @@ public ResourceId apply(@Nonnull Metadata input) {
     List<ResourceId> srcToHandle = new ArrayList<>();
     List<ResourceId> destToHandle = new ArrayList<>();
 
-    List<MatchResult> matchResults = matchResources(srcResourceIds);
-    for (int i = 0; i < matchResults.size(); ++i) {
-      if (!matchResults.get(i).status().equals(Status.NOT_FOUND)) {
-        srcToHandle.add(srcResourceIds.get(i));
-        destToHandle.add(destResourceIds.get(i));
+    List<MatchResult> matchSrcResults = matchResources(srcResourceIds);
+    List<MatchResult> matchDestResults = matchResources(destResourceIds);
+
+    for (int i = 0; i < matchSrcResults.size(); ++i) {
+      if (matchSrcResults.get(i).status().equals(Status.NOT_FOUND) && ignoreMissingSrc) {
+        // If the source is not found, and we are ignoring found source files, then we skip it.
+        continue;
+      }
+      if (matchDestResults.get(i).status().equals(Status.OK)
+          && matchDestResults.get(i).metadata().get(0).sizeBytes()
+              == matchSrcResults.get(i).metadata().get(0).sizeBytes()
+          && skipExistingDest) {

Review comment:
       Wish there was something better than byte size we could use here (e.g. file hash).




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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

    Worklog Id:     (was: 553221)
    Time Spent: 40m  (was: 0.5h)

> FileIO.Write overwrites destination files on retries
> ----------------------------------------------------
>
>                 Key: BEAM-11494
>                 URL: https://issues.apache.org/jira/browse/BEAM-11494
>             Project: Beam
>          Issue Type: Improvement
>          Components: io-java-files
>            Reporter: Pablo Estrada
>            Assignee: Pablo Estrada
>            Priority: P2
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Users have reported cases of FileIO.Write becoming stuck or failing due to overwriting destination files.
> The failure/stuckness occurs because there are some file system buckets with strict retention policies that do not allow files to be deleted.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)