adutra commented on code in PR #516: URL: https://github.com/apache/polaris/pull/516#discussion_r1881905988
########## polaris-service/src/main/java/org/apache/polaris/service/task/FileCleanupTaskHandler.java: ########## @@ -0,0 +1,109 @@ +/* + * 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.polaris.service.task; + +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.function.Function; +import org.apache.iceberg.catalog.TableIdentifier; +import org.apache.iceberg.io.FileIO; +import org.apache.polaris.core.entity.TaskEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * {@link FileCleanupTaskHandler} responsible for cleaning up files in table tasks. Handles retries + * for file deletions and skips files that are already missing. Subclasses must implement + * task-specific logic. + */ +public abstract class FileCleanupTaskHandler implements TaskHandler { + + public static final int MAX_ATTEMPTS = 3; + public static final int FILE_DELETION_RETRY_MILLIS = 100; + public final Function<TaskEntity, FileIO> fileIOSupplier; + public final ExecutorService executorService; + private static final Logger LOGGER = + LoggerFactory.getLogger(ManifestFileCleanupTaskHandler.class); + + public FileCleanupTaskHandler( + Function<TaskEntity, FileIO> fileIOSupplier, ExecutorService executorService) { + this.fileIOSupplier = fileIOSupplier; + this.executorService = executorService; + } + + @Override + public abstract boolean canHandleTask(TaskEntity task); + + @Override + public abstract boolean handleTask(TaskEntity task); + + public abstract Logger getLogger(); Review Comment: This is imho not necessary, using this class' `LOGGER` is enough. -- 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]
