rdblue commented on code in PR #15006:
URL: https://github.com/apache/iceberg/pull/15006#discussion_r2850235542
##########
core/src/main/java/org/apache/iceberg/MergingSnapshotProducer.java:
##########
@@ -1092,6 +1095,34 @@ private List<ManifestFile> newDeleteFilesAsManifests() {
return cachedNewDeleteManifests;
}
+ private List<DeleteFile> mergeDVs() {
+ for (Map.Entry<String, List<DeleteFile>> entry :
dvsByReferencedFile.entrySet()) {
+ if (entry.getValue().size() > 1) {
+ LOG.warn(
+ "Merging {} duplicate DVs for data file {} in table {}.",
+ entry.getValue().size(),
+ entry.getKey(),
+ tableName);
+ }
+ }
+
+ FileIO fileIO = EncryptingFileIO.combine(ops().io(), ops().encryption());
+ List<DeleteFile> finalDVs =
+ DVUtil.mergeAndWriteDVsIfRequired(
+ dvsByReferencedFile,
+ () -> {
+ String filename =
FileFormat.PUFFIN.addExtension(String.valueOf(snapshotId()));
+ return
fileIO.newOutputFile(ops().locationProvider().newDataLocation(filename));
Review Comment:
I think we should add a little more to this path. This doesn't show what the
file is and will overwrite the same file name on each retry.
I would use an instance field so that we can embed a file counter:
```java
private final AtomicInteger dvMergeAttempt = new AtomicInteger(0);
String filename =
FileFormat.PUFFIN.addExtension(String.format("merged-dvs-%s-%s", snapshotId(),
dvMergeAttempt.incrementAndGet()));
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]