ihji commented on a change in pull request #12144:
URL: https://github.com/apache/beam/pull/12144#discussion_r452549676



##########
File path: 
runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/util/PackageUtil.java
##########
@@ -311,8 +315,26 @@ public DataflowPackage stageToFile(
       CompletionStage<StagingResult> stagingResult =
           computePackageAttributes(source, hash, dest, stagingPath)
               .thenComposeAsync(
-                  packageAttributes ->
-                      stagePackage(packageAttributes, retrySleeper, 
createOptions));
+                  packageAttributes -> {
+                    String destLocation = 
packageAttributes.getDestination().getLocation();
+                    String existingHash =
+                        distinctDestinations.putIfAbsent(destLocation, 
packageAttributes.getHash());
+                    if (existingHash == null) {
+                      return stagePackage(packageAttributes, retrySleeper, 
createOptions);
+                    } else {
+                      if (!existingHash.equals(packageAttributes.getHash())) {
+                        LOG.warn(
+                            "Upload of {} would overwrite {} with different 
content",
+                            packageAttributes.getSource(),
+                            destLocation);

Review comment:
       Two files should not have a same destination in the first place. They 
are deduplicated by postfixing hash when dependency information is created: 
https://github.com/apache/beam/blob/master/runners/core-construction-java/src/main/java/org/apache/beam/runners/core/construction/Environments.java#L320




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to