mxm commented on code in PR #19061:
URL: https://github.com/apache/iceberg/pull/19061#discussion_r4679429541
##########
flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DynamicWriteResultAggregator.java:
##########
@@ -220,10 +222,19 @@ private Tuple2<ManifestOutputFileFactory, Integer>
outputFileFactoryAndFormatVer
// Make sure to append an identifier to avoid file clashes in case
the factory was to get
// re-created during a checkpoint, i.e. due to cache eviction.
String fileSuffix = UUID.randomUUID().toString();
+ // Resolve the manifest dir now, so the cached factory can hold a
table without snapshots.
+ Map<String, String> props = Maps.newHashMap(table.properties());
+ // some TableOperation reject an empty file name, derive the dir
from a probe path
+ String probePath =
+ ((HasTableOperations)
table).operations().metadataFileLocation("probe");
+ props.putIfAbsent(
+ ManifestOutputFileFactory.FLINK_MANIFEST_LOCATION,
+ probePath.substring(0, probePath.lastIndexOf('/')));
+ Table manifestTable = SerializableTable.copyOf(table);
Review Comment:
I'd prefer not to write the derived directory into
`flink.manifests.location`, since that makes the design leaky.
##########
flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DynamicWriteResultAggregator.java:
##########
@@ -220,10 +222,19 @@ private Tuple2<ManifestOutputFileFactory, Integer>
outputFileFactoryAndFormatVer
// Make sure to append an identifier to avoid file clashes in case
the factory was to get
// re-created during a checkpoint, i.e. due to cache eviction.
String fileSuffix = UUID.randomUUID().toString();
+ // Resolve the manifest dir now, so the cached factory can hold a
table without snapshots.
+ Map<String, String> props = Maps.newHashMap(table.properties());
+ // some TableOperation reject an empty file name, derive the dir
from a probe path
+ String probePath =
+ ((HasTableOperations)
table).operations().metadataFileLocation("probe");
+ props.putIfAbsent(
+ ManifestOutputFileFactory.FLINK_MANIFEST_LOCATION,
+ probePath.substring(0, probePath.lastIndexOf('/')));
Review Comment:
This will get us in all sorts of trouble. Let's get rid of this code and
pass `TableOperations` below to `createOutputFileFactory`. This should safe
memory as well.
##########
flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DynamicWriteResultAggregator.java:
##########
@@ -220,10 +222,19 @@ private Tuple2<ManifestOutputFileFactory, Integer>
outputFileFactoryAndFormatVer
// Make sure to append an identifier to avoid file clashes in case
the factory was to get
// re-created during a checkpoint, i.e. due to cache eviction.
String fileSuffix = UUID.randomUUID().toString();
+ // Resolve the manifest dir now, so the cached factory can hold a
table without snapshots.
+ Map<String, String> props = Maps.newHashMap(table.properties());
+ // some TableOperation reject an empty file name, derive the dir
from a probe path
+ String probePath =
+ ((HasTableOperations)
table).operations().metadataFileLocation("probe");
+ props.putIfAbsent(
+ ManifestOutputFileFactory.FLINK_MANIFEST_LOCATION,
+ probePath.substring(0, probePath.lastIndexOf('/')));
+ Table manifestTable = SerializableTable.copyOf(table);
ManifestOutputFileFactory outputFileFactory =
FlinkManifestUtil.createOutputFileFactory(
- () -> table,
- table.properties(),
+ () -> manifestTable,
+ props,
Review Comment:
We can pass `TableOperations` and the table props here.
--
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]