aokolnychyi commented on code in PR #6335:
URL: https://github.com/apache/iceberg/pull/6335#discussion_r1277739592
##########
core/src/main/java/org/apache/iceberg/MergingSnapshotProducer.java:
##########
@@ -907,9 +907,17 @@ public Object updateEvent() {
}
private void cleanUncommittedAppends(Set<ManifestFile> committed) {
- if (cachedNewDataManifest != null &&
!committed.contains(cachedNewDataManifest)) {
- deleteFile(cachedNewDataManifest.path());
- this.cachedNewDataManifest = null;
+ if (cachedNewDataManifests != null) {
+ List<ManifestFile> committedNewManifests = Lists.newArrayList();
Review Comment:
Optional: `committedNewManifests` -> `committedNewDataManifests`?
##########
core/src/main/java/org/apache/iceberg/RollingManifestWriter.java:
##########
@@ -0,0 +1,167 @@
+/*
+ * 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;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.util.List;
+import java.util.function.Supplier;
+import org.apache.iceberg.io.FileIO;
+import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+import org.apache.iceberg.relocated.com.google.common.collect.Lists;
+
+/** As opposed to {@link ManifestWriter}, a rolling writer could produce
multiple manifest files. */
+public class RollingManifestWriter<F extends ContentFile<F>> implements
Closeable {
+ private static final int ROWS_DIVISOR = 250;
+
+ private final FileIO fileIO;
+ private final Supplier<ManifestWriter<F>> manifestWriterSupplier;
+ private final long targetFileSizeInBytes;
+ private final List<ManifestFile> manifestFiles;
+
+ private long currentFileRows = 0;
+ private ManifestWriter<F> currentWriter = null;
+
+ private boolean closed = false;
+
+ public RollingManifestWriter(
+ FileIO fileIO,
Review Comment:
Do you think it is still needed? We switched to a lazy writer that is
initialized only when there is a new entry to write. The same also applies to
cases when we roll to a new file. It can only happen if there is a pending
entry to write. If I am not missing anything, we can drop `FileIO` here and
simplify `closeCurrentWriter`.
--
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]