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



##########
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:
       yeah good call, this can never be hit since the destination names will 
never be the same.  I'll just remove the dupe check completely.




----------------------------------------------------------------
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