pabloem commented on a change in pull request #12144: URL: https://github.com/apache/beam/pull/12144#discussion_r452535839
########## 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: Should this throw an exception? IIUC, this would most likely mean that a user-specified file to upload would fail, right? (classpath JAR files with equal names should have equal contents as they usually include version in their name) Wouldn't it be best to error out, and inform the use about that? ---------------------------------------------------------------- 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