mxm commented on code in PR #14810:
URL: https://github.com/apache/iceberg/pull/14810#discussion_r2630631249
##########
flink/v2.0/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DynamicCommittableSerializer.java:
##########
@@ -46,26 +47,59 @@ public byte[] serialize(DynamicCommittable committable)
throws IOException {
view.writeUTF(committable.jobId());
view.writeUTF(committable.operatorId());
view.writeLong(committable.checkpointId());
- view.writeInt(committable.manifest().length);
- view.write(committable.manifest());
+
+ view.writeInt(committable.manifests().length);
+ for (int i = 0; i < committable.manifests().length; i++) {
+ view.writeInt(committable.manifests()[i].length);
+ view.write(committable.manifests()[i]);
+ }
Review Comment:
I prefer this for readability:
```suggestion
int numManifests = committable.manifests().length;
view.writeInt(numManifests);
for (int i = 0; i < numManifests; i++) {
int manifest = committable.manifests()[i];
view.writeInt(manifest.length);
view.write(manifest);
}
```
##########
flink/v2.0/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/TableKey.java:
##########
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg.flink.sink.dynamic;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Objects;
+import org.apache.flink.core.memory.DataInputView;
+import org.apache.flink.core.memory.DataOutputView;
+import org.apache.iceberg.relocated.com.google.common.base.MoreObjects;
+
+class TableKey implements Serializable {
Review Comment:
```suggestion
class TableKey {
```
This shouldn't be using Java serialization, as we have our own serialization
logic in this class.
##########
flink/v2.0/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DynamicCommitter.java:
##########
@@ -126,9 +125,14 @@ public void
commit(Collection<CommitRequest<DynamicCommittable>> commitRequests)
return;
}
- // For every table and every checkpoint, we store the list of
to-be-committed
- // DynamicCommittable.
- // There may be DynamicCommittable from previous checkpoints which have
not been committed yet.
+ /*
+ Each (table, branch, checkpoint) triplet must have only one commit
request.
+ There may be commit requests from previous checkpoints which have not
been committed yet.
+
+ We currently keep a List of commit requests per checkpoint instead of a
single CommitRequest<DynamicCommittable>
+ to process the Flink state from previous releases, which had multiple
commit requests due to a bug in the upstream
+ DynamicWriteResultAggregator. We should replace this with a single
commit request in the next major release.
Review Comment:
Is it strictly necessary to merge this change to 1.10.1? The original bug
which motivated this change has already been fixed in 1.10.1. The changes here
are great, but I think they can wait until 1.11.0.
--
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]