Samrat002 commented on code in PR #27187: URL: https://github.com/apache/flink/pull/27187#discussion_r2841892713
########## flink-filesystems/flink-s3-fs-native/src/main/java/org/apache/flink/fs/s3native/writer/NativeS3Committer.java: ########## @@ -0,0 +1,97 @@ +/* + * 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.flink.fs.s3native.writer; + +import org.apache.flink.core.fs.RecoverableFsDataOutputStream; +import org.apache.flink.core.fs.RecoverableWriter; + +import java.io.IOException; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +/** + * Committer for S3 multipart uploads that finalizes the upload when commit is called. + * + * <p><b>Failure Handling:</b> A commit failure will propagate as an IOException, which typically + * causes the Flink job to fail and trigger recovery. This is intentional because: + * + * <ul> + * <li>S3 requires all multipart uploads to be explicitly committed or aborted + * <li>A failed commit means the file is not finalized and data would be lost + * <li>Flink's checkpoint mechanism will handle recovery from the last successful checkpoint + * </ul> + * + * <p>The "empty parts" check is a defensive measure against programming errors - in normal + * operation, a multipart upload should always have at least one part before committing. + */ +public class NativeS3Committer implements RecoverableFsDataOutputStream.Committer { + + private final NativeS3AccessHelper s3AccessHelper; + private final NativeS3Recoverable recoverable; + private final AtomicInteger errorCount; Review Comment: AtomicInteger is not needed here. I used this variable earlier to debug and track errors in the multipart operation and missed removing it during cleanup. In the current code, it’s a leftover residue. I’ve removed it -- 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]
