mbwaheed commented on a change in pull request #1188: SOLR-14044: Support collection and shard deletion in shared storage URL: https://github.com/apache/lucene-solr/pull/1188#discussion_r374926763
########## File path: solr/core/src/java/org/apache/solr/store/blob/process/BlobDeleteProcessor.java ########## @@ -0,0 +1,174 @@ +/* + * 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.solr.store.blob.process; + +import java.lang.invoke.MethodHandles; +import java.util.Set; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.LinkedBlockingDeque; +import java.util.concurrent.TimeUnit; + +import org.apache.lucene.util.NamedThreadFactory; +import org.apache.solr.common.SolrException; +import org.apache.solr.common.cloud.ZkStateReader; +import org.apache.solr.common.util.ExecutorUtil.MDCAwareThreadPoolExecutor; +import org.apache.solr.store.blob.client.BlobClientUtils; +import org.apache.solr.store.blob.client.CoreStorageClient; +import org.apache.solr.store.blob.process.BlobDeleterTask.BlobDeleterTaskResult; +import org.apache.solr.store.blob.process.BlobDeleterTask.BlobFileDeletionTask; +import org.apache.solr.store.blob.process.BlobDeleterTask.BlobPrefixedFileDeletionTask; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.annotations.VisibleForTesting; + +/** + * A generic deletion processor used for deleting object files from shared + * storage. Each processor manages its own task bounded thread pool for processing + * {@link BlobDeleterTask} asynchronously. Processors support retrying tasks if + * necessary but retry decisions are left to the individual task implementations. + * + * Instances of {@link BlobDeleteProcessor} are managed by the {@link BlobDeleteManager}. + */ +public class BlobDeleteProcessor { + + private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private final String name; + private final int almostMaxQueueSize; + /** + * Note we sleep() after each failed attempt, so multiply this value by {@link #fixedRetryDelay} to find + * out how long we'll retry (at least) if Blob access fails for some reason ("at least" because we + * re-enqueue at the tail of the queue ({@link BlobDeleteManager} creates a list), so there might be additional + * processing delay if the queue is not empty and is processed before the enqueued retry is processed). + */ + private final int defaultMaxDeleteAttempts; Review comment: default prefix in the name does not make sense. I guess it can just be maxDeleteAttempts. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org