wzhero1 commented on code in PR #7027: URL: https://github.com/apache/paimon/pull/7027#discussion_r2973186715
########## paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/action/ExpireSnapshotsActionITCase.java: ########## @@ -0,0 +1,231 @@ +/* + * 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.paimon.flink.action; + +import org.apache.paimon.Snapshot; +import org.apache.paimon.catalog.Identifier; +import org.apache.paimon.consumer.ConsumerManager; +import org.apache.paimon.flink.expire.RangePartitionedExpireFunction; +import org.apache.paimon.flink.expire.SnapshotExpireSink; +import org.apache.paimon.flink.util.MiniClusterWithClientExtension; +import org.apache.paimon.flink.utils.JavaTypeInfo; +import org.apache.paimon.fs.Path; +import org.apache.paimon.operation.ExpireSnapshotsTest; +import org.apache.paimon.operation.SnapshotDeletion; +import org.apache.paimon.operation.expire.DeletionReport; +import org.apache.paimon.operation.expire.ExpireSnapshotsExecutor; +import org.apache.paimon.operation.expire.ExpireSnapshotsPlan; +import org.apache.paimon.operation.expire.ExpireSnapshotsPlanner; +import org.apache.paimon.operation.expire.SnapshotExpireTask; +import org.apache.paimon.options.ExpireConfig; + +import org.apache.flink.api.common.RuntimeExecutionMode; +import org.apache.flink.runtime.testutils.MiniClusterResourceConfiguration; +import org.apache.flink.streaming.api.datastream.DataStream; +import org.apache.flink.streaming.api.datastream.DataStreamSource; +import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Supplier; + +/** + * IT Case for parallel expire snapshots using Flink execution. This class extends {@link + * ExpireSnapshotsTest} and overrides {@link #doExpire} to test parallel execution mode with real + * Flink DataStream API. + * + * <p>This test validates that the Flink-based parallel expire logic produces the same results as + * the serial implementation. It extends the production {@link RangePartitionedExpireFunction} and + * {@link SnapshotExpireSink} classes, overriding {@code initExecutor} to inject test executors. + */ +public class ExpireSnapshotsActionITCase extends ExpireSnapshotsTest { Review Comment: Done. Added testExpireRecoveryAfterPartialFailure: uses a failAfterTasks flag in TestExpireFunction to simulate a mid-job crash during the worker phase (some data files deleted, but snapshot metadata intact). Then runs expire again and verifies it completes successfully despite missing files. -- 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]
