Samrat002 commented on code in PR #28867: URL: https://github.com/apache/flink/pull/28867#discussion_r3882930418
########## flink-filesystems/flink-s3-fs-native/src/test/java/org/apache/flink/fs/s3native/writer/NativeS3RecoverableWriterRecoveryITCase.java: ########## @@ -0,0 +1,238 @@ +/* + * 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.Path; +import org.apache.flink.core.fs.RecoverableFsDataOutputStream; +import org.apache.flink.core.fs.RecoverableWriter; +import org.apache.flink.core.testutils.AllCallbackWrapper; +import org.apache.flink.core.testutils.TestContainerExtension; +import org.apache.flink.fs.s3native.SeaweedFsNativeS3TestContainer; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.junit.jupiter.api.io.TempDir; + +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +/** + * Integration tests for {@link NativeS3RecoverableWriter#recover} running against SeaweedFS. + * + * <p>SeaweedFS enforces the S3 5 MiB minimum part size on multipart-complete, so every scenario + * writes one full {@value #PART}-byte first part (the only non-final part) followed by a small tail + * that becomes the final part. + * + * <p>Terminology used below: + * + * <pre> + * target object (the file the caller is writing, e.g. "out-<uuid>.txt") + * +-- part 1: PART bytes, uploaded as a completed multipart upload part + * +-- tail: any bytes written after part 1, not yet part of a completed multipart part + * + * side object ("_<name>.incomplete.<uuid>", see #incompletePrefix()) + * - written by persist() only when there IS a tail, so that the tail bytes survive a + * writer restart + * - read back by recover(), which downloads it locally and appends it to the in-progress + * multipart upload before returning a resumed output stream + * - has no side object at all when persist() is called exactly on a part boundary + * (see recoverWithoutIncompleteTailStillWorks) + * </pre> + */ +class NativeS3RecoverableWriterRecoveryITCase { + + private static final int PART = 5 * 1024 * 1024; Review Comment: Changed it to use the constant from NativeS3RecoverableWriter. -- 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]
