ihji commented on a change in pull request #12144: URL: https://github.com/apache/beam/pull/12144#discussion_r452551623
########## 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: Regarding my previous comment, I prefer failing the job instead of just printing out warnings when two files have a same staging destination. ---------------------------------------------------------------- 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