amogh-jahagirdar commented on code in PR #14947:
URL: https://github.com/apache/iceberg/pull/14947#discussion_r2683943676
##########
core/src/main/java/org/apache/iceberg/SnapshotProducer.java:
##########
@@ -465,6 +464,10 @@ public void commit() {
// to ensure that if a concurrent operation assigns the
UUID, this operation will
// not fail.
taskOps.commit(base, updated.withUUID());
+
+ // Set the staged snapshot AFTER successful commit to ensure
cleanup uses
+ // the actually committed snapshot, not one from a
failed/no-op attempt
Review Comment:
If there's a failure I think we'd hit one of the the catch statements below
or it'd just throw before we end up using staged snapshot later on. I think the
specific case that's problematic is if it's a no-op after a retry due to a
network partition after a successful commit?
Either way though, I do believe this fix is correct, just wanted to make
sure I understood the specific problematic area.
##########
core/src/test/java/org/apache/iceberg/TestManifestCleanupCorruption.java:
##########
@@ -0,0 +1,149 @@
+/*
+ * 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 static org.assertj.core.api.Assertions.assertThat;
+
+import java.io.File;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
+import org.apache.iceberg.exceptions.CommitFailedException;
+import org.apache.iceberg.io.FileIO;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+@ExtendWith(ParameterizedTestExtension.class)
+public class TestManifestCleanupCorruption extends TestBase {
Review Comment:
Instead of a separate test class, I believe we should be able to just use
one of the Append unit tests and use TestTableOperations existing utilitiies
https://github.com/apache/iceberg/blob/f8ee29e6eb8b5f33ea0e91fa4406a76643cb4ef6/core/src/test/java/org/apache/iceberg/TestTables.java#L219
to simulate a commit state unknown?
--
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]